OpenVPN - 새 서브넷의 클라이언트에 연결할 수 없습니다

OpenVPN - 새 서브넷의 클라이언트에 연결할 수 없습니다

저는 OpenVPN을 통해 많은 클라이언트가 연결된 서버를 운영하고 있는데 클라이언트 수가 며칠 전 255개를 넘을 때까지 천천히 증가했습니다. 처음 VPN을 설정할 때 이 점을 염두에 두고 서브넷 마스크를 '255.255.0.0'으로 설정했습니다. 그럼에도 불구하고 IP 주소가 있는 기존 클라이언트에는 연결할 수 있지만 IP 주소 10.8.0.x가 있는 새 클라이언트에는 연결할 수 없기 때문에 뭔가 문제가 있습니다.10.8.1.x

내 구성에 누락된 것이 있나요?

  • /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
    
  • ifconfig이 VPN 인터페이스가 다른 인터페이스와 IP 충돌이 없다고 보고합니다.
    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)
    

답변1

OpenVPN과 관련이 없으며 다음 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
  • 라이브 iptables규칙을 업데이트하고 해당 규칙을 수정하여 /etc/rc.local넷마스크 /16/24

관련 정보