
서버와 가상 머신이 있습니다. 저는 이 서버에서 OpenVPN을 호스팅하고 있습니다. 가상 머신에는 ens18 - 공용 IP용, ens19 - 내부 네트워크용이라는 두 가지 인터페이스가 있습니다. VPN을 통해 10.2.0.3(ens19의 가상 머신 IP)에 ping을 시도하고 있지만 응답하지 않습니다. tcpdump -i ens19 icmp
가상 머신에서 실행하면 다음이 반환됩니다.
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ens19, link-type EN10MB (Ethernet), capture size 262144 bytes
16:50:25.931910 IP 10.8.0.2 > 10.2.0.3: ICMP echo request, id 1, seq 80, length 40
16:50:29.381784 IP 10.8.0.2 > 10.2.0.3: ICMP echo request, id 1, seq 81, length 40
핑 출력:
Pinging 10.2.0.3 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
머신 tcpdump 출력:
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on tun0, link-type RAW (Raw IP), capture size 262144 bytes
15:58:15.007090 IP 10.8.0.2 > 10.2.0.3: ICMP echo request, id 1, seq 45, length 40
내 iptables 규칙:
Chain INPUT (policy ACCEPT 2806K packets, 1097M bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- eth0 any anywhere anywhere state RELATED,ESTABLISHED
198K 27M ACCEPT udp -- vmbr0 any anywhere anywhere udp dpt:[my openvn port]
40 2429 ACCEPT all -- tun0 any anywhere anywhere
0 0 ACCEPT all -- tun+ any anywhere anywhere
0 0 ACCEPT all -- tun+ any anywhere anywhere
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
197K 16M ACCEPT all -- tun0 vmbr0 anywhere anywhere
177K 336M ACCEPT all -- vmbr0 tun0 anywhere anywhere
45 2540 ACCEPT all -- tun0 any 10.8.0.0/24 10.2.0.3
2 104 ACCEPT all -- tun0 any 10.8.0.0/24 10.2.0.0/24
0 0 ACCEPT all -- tun+ any anywhere anywhere
Chain OUTPUT (policy ACCEPT 3102K packets, 1303M bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- any tun0 anywhere anywhere
내 경로 테이블:
default via [my public ip] dev vmbr0 proto kernel onlink
10.2.0.0/24 dev vmbr1 proto kernel scope link src 10.2.0.1
10.8.0.0/24 dev tun0 proto kernel scope link src 10.8.0.1
[my public ip] dev vmbr0 proto kernel scope link src [my gateway]
IP 규칙 목록:
0: from all lookup local
32766: from all lookup main
32767: from all lookup default
추가 정보가 필요하면 댓글을 추가하세요. 내 하찮은 영어 실력에 죄송하다는 말씀을 드리고 싶습니다
답변1
작성자: @TomYan
VM에서 10.2.0.1을 통해 ip r add 10.8.0.0/24를 실행합니다. VPN 부분의 경우 클라이언트 conf에 경로 10.2.0.0 255.255.255.0을 추가하거나 클라이언트 conf에서 client / pull을 사용한다고 가정하고 서버 conf에 push "route 10.2.0.0 255.255.255.0"을 추가하십시오. VM과 VPN 클라이언트가 모두 서버를 기본 게이트웨이로 사용하는 경우 이러한 경로는 필요하지 않습니다.