OpenVPN: no puedo conectarme a clientes en una nueva subred

OpenVPN: no puedo conectarme a clientes en una nueva subred

Ejecuto un servidor con muchos clientes conectados a través de OpenVPN y la cantidad de clientes creció lentamente hasta llegar a más de 255 hace unos días. Cuando configuré inicialmente la VPN, tuve esto en mente y configuré la máscara de subred en '255.255.0.0'; sin embargo, algo anda mal, ya que puedo conectarme a clientes antiguos con 10.8.0.xdirecciones IP, pero no a clientes nuevos con 10.8.1.xdirecciones IP.

¿Me falta algo en mis configuraciones?

  • /etc/openvpn/server.conf:
    port 1194
    proto udp
    dev tun
    
    ca ca.crt
    crl-verify crl.pem
    cert server.crt
    key server.key
    dh dh.pem
    
    auth SHA512
    tls-auth ta.key 0
    cipher AES-256-CBC
    
    topology subnet
    server 10.8.0.0 255.255.0.0
    ifconfig-pool-persist ipp.txt
    
    push "bypass-dhcp"
    push "dhcp-option DNS 8.8.8.8"
    push "dhcp-option DNS 8.8.4.4"
    push "dhcp-option DNS 10.8.0.1"
    
    keepalive 10 120
    sndbuf 0
    rcvbuf 0
    persist-key
    persist-tun
    
    verb 3
    
    log /var/log/openvpn.log
    status openvpn-status.log
    
    # This automatically assigns domain names to clients, based on their names:
      # NOTE: You have to comment out user and grop lines above for this to even work
        #user nobody
        #group nogroup
    
        # default is 1 which doesn't allow user-defined scripts
        script-security 2
        learn-address /home/dvida/openvpn_scripts/learn_address.sh
    
  • /etc/openvpn/client-common.txt:
    client
    dev tun
    proto udp
    remote blah.blah.com 1194
    
    sndbuf 0
    rcvbuf 0
    mssfix 1160
    
    resolv-retry infinite
    persist-key
    persist-tun
    nobind
    
    remote-cert-tls server
    tls-version-min 1.0
    key-direction 1
    
    auth SHA512
    cipher AES-256-CBC
    
    verb 3
    
  • ifconfiginforma que esta interfaz VPN no tiene conflictos de IP con otras interfaces:
    tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
              inet addr:10.8.0.1  P-t-P:10.8.0.1  Mask:255.255.0.0
              UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
              RX packets:71105670 errors:0 dropped:0 overruns:0 frame:0
              TX packets:70755978 errors:0 dropped:391 overruns:0 carrier:0
              collisions:0 txqueuelen:100
              RX bytes:42092973453 (39.2 GiB)  TX bytes:42070922921 (39.1 GiB)
    

Respuesta1

Resulta que no estaba relacionado con OpenVPN y tenía esta regla SNAT:

iptables -t nat -A POSTROUTING -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to 129.100.40.167
  • Actualicé la iptablesregla en vivo y arreglé la que está /etc/rc.localpara que la máscara de red esté /16en lugar de/24

información relacionada