将流量从 VPN 客户端转发到另一个 VPN 服务器

将流量从 VPN 客户端转发到另一个 VPN 服务器

我有一台 vpn 服务器(服务器 A)。服务器 A 连接到另一台 vpn 服务器(服务器 B)。服务器 A 有一些客户端。

是否可以仅将来自服务器 A 的 vpn 客户端的流量路由到服务器 B 的连接,以便机器 A 将使用默认互联网连接?

每个客户端都连接到某个 ppp+ 接口(ppp1-10),其 IP 地址为 11.0.0.1-10。11.0.1.1 - pptpd 服务器的 IP。Ppp0 是连接到服务器 B 的接口。

ifconfig 输出:

eth0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
   ether e8:03:9a:93:07:53  txqueuelen 1000  (Ethernet)
   RX packets 0  bytes 0 (0.0 B)
   RX errors 0  dropped 0  overruns 0  frame 0
   TX packets 0  bytes 0 (0.0 B)
   TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
   inet 127.0.0.1  netmask 255.0.0.0
   inet6 ::1  prefixlen 128  scopeid 0x10<host>
   loop  txqueuelen 1000  (Local Loopback)
   RX packets 13486316  bytes 3242965197 (3.0 GiB)
   RX errors 0  dropped 0  overruns 0  frame 0
   TX packets 13486316  bytes 3242965197 (3.0 GiB)
   TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1400
   inet 192.168.1.50  netmask 255.255.255.255  destination 192.168.1.1
   ppp  txqueuelen 3  (Point-to-Point Protocol)
   RX packets 12  bytes 949 (949.0 B)
   RX errors 0  dropped 0  overruns 0  frame 0
   TX packets 12  bytes 1411 (1.3 KiB)
   TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ppp1: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1396
   inet 11.0.1.1  netmask 255.255.255.255  destination 11.0.0.1
   ppp  txqueuelen 3  (Point-to-Point Protocol)
   RX packets 7  bytes 88 (88.0 B)
   RX errors 0  dropped 0  overruns 0  frame 0
   TX packets 7  bytes 82 (82.0 B)
   TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
   inet 192.168.1.4  netmask 255.255.255.0  broadcast 192.168.1.255
   inet6 fe80::9244:b58:9664:49b3  prefixlen 64  scopeid 0x20<link>
   ether b8:03:05:4f:8a:44  txqueuelen 1000  (Ethernet)
   RX packets 3950317  bytes 2674081227 (2.4 GiB)
   RX errors 0  dropped 0  overruns 0  frame 0
   TX packets 9771716  bytes 2046374004 (1.9 GiB)
   TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

路线-n输出:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface 
0.0.0.0         0.0.0.0         0.0.0.0         U     50     0        0 ppp0
0.0.0.0         192.168.1.1     0.0.0.0         UG    600    0        0 wlan0
11.0.0.1        0.0.0.0         255.255.255.255 UH    0      0        0 ppp1
"ip of server B"     192.168.1.1     255.255.255.255 UGH   0      0        0 wlan0
"ip of server B"     192.168.1.1     255.255.255.255 UGH   600    0        0 wlan0
192.168.1.0     0.0.0.0         255.255.255.0   U     600    0        0 wlan0
192.168.1.1     0.0.0.0         255.255.255.255 UH    50     0        0 ppp0
192.168.1.1     0.0.0.0         255.255.255.255 UH    600    0        0 wlan0

相关内容