pc1 是局域网内的客户端,其 openvpn ip 为 10.8.0.1
/sbin/ifconfig
eth0 Link encap:Ethernet HWaddr 90:09:D0:08:99:15
inet addr:192.168.2.130 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::9209:d0ff:fe08:9915/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:206125 errors:0 dropped:0 overruns:0 frame:0
TX packets:206479 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:68902617 (65.7 MiB) TX bytes:49582255 (47.2 MiB)
Interrupt:11
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:277005 errors:0 dropped:0 overruns:0 frame:0
TX packets:277005 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:38573288 (36.7 MiB) TX bytes:38573288 (36.7 MiB)
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:3486 errors:0 dropped:0 overruns:0 frame:0
TX packets:3075 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:300198 (293.1 KiB) TX bytes:2344684 (2.2 MiB)
route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.2.100 0.0.0.0 UG 0 0 0 eth0
10.8.0.0 10.8.0.2 255.255.255.0 UG 0 0 0 tun0
10.8.0.2 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
iptables -t nat -A PREROUTING -p tcp -i tun0 --dport 8888 -j DNAT --to-destination 192.168.2.100:80
iptables -A FORWARD -p tcp -d 192.168.2.100 --dport 80 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
在这个局域网内,eth0 上有另一个客户端:192.168.2.100
从另一侧的另一个 vpn 客户端 ip: 10.8.0.2 我需要连接到 192.168.2.100 的 80 端口
暂停