..png)
두 VPS 사이에 OpenVPN 클라이언트와 서버가 설정되어 있습니다. 클라이언트와 서버 설정이 있고 서버는 tun 인터페이스의 10.8.0.1
IP를 사용 10.8.0.2
하고 클라이언트는 tun 인터페이스의 10.8.0.6
IP를 사용합니다 10.8.0.5
. (vps1은 클라이언트이고 vps2는 서버입니다.) 클라이언트는 서버 tun IP에 ping을 보낼 수 있지만 10.8.0.1
다른 IP에는 ping을 보낼 수 없습니다. 서버에서 tun IP 또는 클라이언트 tun IP를 ping할 수 없습니다.
서버 구성:
port 1194
proto udp
dev tun0
ca ca.crt
cert server.crt
key server.key
tls-server
dh dh2048.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
keepalive 10 120
comp-lzo
user nobody
group nobody
persist-key
persist-tun
verb 3
클라이언트 구성:
client
dev tun
proto udp
remote 198.168.XXX 1194
nobind
tun-mtu 1500
persist-key
persist-tun
keepalive 14 120
ca ca.crt
cert client.crt
key client.key
comp-lzo
verb 3
로그에 따르면 연결이 성공적으로 설정되었습니다.
Jun 9 13:25:28 vps2 openvpn[6484]: MULTI_sva: pool returned IPv4=10.8.0.6, IPv6=(Not enabled)
Jun 9 13:25:28 vps2 openvpn[6484]: MULTI: Learn: 10.8.0.6 -> vps1.xxx/xxxxx:33012
Jun 9 13:25:28 vps2 openvpn[6484]: MULTI: primary virtual IP for vps1.xxx/xxxxx:33012: 10.8.0.6
Jun 9 13:25:30 vps2 openvpn[6484]: vps1.xxx/xxxxx:33012 PUSH: Received control message: 'PUSH_REQUEST'
Jun 9 13:25:30 vps2 openvpn[6484]: vps1.xxx/xxxxx:33012 send_push_reply(): safe_cap=940
Jun 9 13:25:30 vps2 openvpn[6484]: vps1.xxx/xxxxx:33012 SENT CONTROL [vps1.xxx]: 'PUSH_REPLY,route 10.8.0.1,topology net30,ping 10,ping-restart 120,ifconfig 10.8.0.6 10.8.0.5' (status=1)
그리고 양쪽 끝에 터널을 설정합니다.
섬기는 사람
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.2 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:5 errors:0 dropped:0 overruns:0 frame:0
TX packets:28 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:420 (420.0 b) TX bytes:1968 (1.9 KiB)
고객
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.6 P-t-P:10.8.0.5 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
클라이언트는 게이트웨이 IP를 통해 서버에 ping 및 ssh를 보낼 수도 있습니다.
root@vps1:~# ping 10.8.0.1
PING 10.8.0.1 (10.8.0.1) 56(84) bytes of data.
64 bytes from 10.8.0.1: icmp_seq=1 ttl=64 time=72.6 ms
64 bytes from 10.8.0.1: icmp_seq=2 ttl=64 time=72.6 ms
64 bytes from 10.8.0.1: icmp_seq=3 ttl=64 time=72.7 ms
^C
--- 10.8.0.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 72.666/72.691/72.726/0.221 ms
root@vps1:~# ssh 10.8.0.1
[email protected]'s password:
그러나 서버와 클라이언트에서 opnevpn ip를 ping할 수 없습니다.
root@vps1:~# ping 10.8.0.2
PING 10.8.0.2 (10.8.0.2) 56(84) bytes of data.
^C
--- 10.8.0.2 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2000ms
root@vps1:~# ping 10.8.0.5
PING 10.8.0.5 (10.8.0.5) 56(84) bytes of data.
답변1
당신은 많은 것들이 뒤섞여 있습니다. 보다 영구적인 구성을 설정하기 전에 설명된 대로 테스트하십시오.여기.
서버의 경우ifconfig
`openvpn --dev tun1 --ifconfig 10.9.8.1 10.9.8.2`
ifconfig
클라이언트에서는 그 반대를 수행 해야 합니다 .
openvpn --remote 192.168.SER.VER --dev tun1 --ifconfig 10.9.8.2 10.9.8.1
연결을 설정하기 전에 다음을 확인하십시오.
Sat Aug 20 15:37:39 2016 Peer Connection Initiated with [AF_INET]192.168.0.178:1194
Sat Aug 20 15:37:39 2016 Initialization Sequence Completed
각 당사자는 자신에게만 핑을 보낼 수 있습니다.
답변2
확인해야 할 상태는 다양합니다.
1 클라이언트에서 서버로 라우팅
2 사용 중인 소스 인터페이스를 확인하세요.ping
그 이유는 예를 들어 물리적 인터페이스 중 하나를 사용하여 ping을 사용하고 있는데 서버에 물리적 인터페이스 터널에 대한 경로가 없기 때문입니다.
3 목적지 경로 iptable
등을 확인하세요.