本地网络与VPN冲突

本地网络与VPN冲突

我在 Linux 机器上(Ubuntu 14.04)。我的本地 wifi 网络是192.168.1.0/24但我的 VPN 也192.168.1.0/24(点对点 VPN)。

是否配置

enp1s0    Link encap:Ethernet  HWaddr 50:7b:9d:98:da:f1  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          Packets reçus:0 erreurs:0 :0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:1000 
          Octets reçus:0 (0.0 B) Octets transmis:0 (0.0 B)

lo        Link encap:Boucle locale  
          inet adr:127.0.0.1  Masque:255.0.0.0
          adr inet6: ::1/128 Scope:Hôte
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          Packets reçus:806 erreurs:0 :0 overruns:0 frame:0
          TX packets:806 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:1 
          Octets reçus:82090 (82.0 KB) Octets transmis:82090 (82.0 KB)

ppp0      Link encap:Protocole Point-à-Point  
          inet adr:192.168.1.205  P-t-P:192.168.1.204  Masque:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1400  Metric:1
          Packets reçus:8 erreurs:0 :0 overruns:0 frame:0
          TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:3 
          Octets reçus:185 (185.0 B) Octets transmis:237 (237.0 B)

wlp2s0    Link encap:Ethernet  HWaddr 08:d4:0c:86:c6:76  
          inet adr:192.168.1.3  Bcast:192.168.1.255  Masque:255.255.255.0
          adr inet6: fd24:df6a:bd78:7b00:8109:a0c4:133a:892b/64 Scope:Global
          adr inet6: fd24:df6a:bd78:7b00:e534:8609:1c44:f40a/64 Scope:Global
          adr inet6: fe80::cdf7:32b8:de5b:ac15/64 Scope:Lien
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Packets reçus:6150 erreurs:0 :0 overruns:0 frame:0
          TX packets:4583 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:1000 
          Octets reçus:5540235 (5.5 MB) Octets transmis:658638 (658.6 KB)

网络状态监测

Table de routage IP du noyau
Destination     Passerelle      Genmask         Indic   MSS Fenêtre irtt Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 wlp2s0
80.13.172.131   192.168.1.1     255.255.255.255 UGH       0 0          0 wlp2s0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 ppp0
192.168.1.0     192.168.1.204   255.255.255.0   UG        0 0          0 ppp0
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 wlp2s0
192.168.1.204   0.0.0.0         255.255.255.255 UH        0 0          0 ppp0

我只想重定向来自192.168.1.39到 VPN,我该怎么做?

答案1

需要删除到 ppp0 设备的路由:

192.168.1.0     192.168.1.204   255.255.255.0   UG        0 0          0 ppp0

使用以下命令:

sudo route del -net 192.168.1.0/24 gw 192.168.1.204

然后需要添加192.168.1.39的路由

sudo route add -host 192.168.1.39 gw 192.168.1.204 dev ppp0

相关内容