我有一个安装在我的电脑上的apache web服务器,如预期般工作,直到我使用他们的软件连接到我的VPN服务提供商(私人互联网访问)。
一旦连接,我无法再每次尝试访问Web服务器(使用我的ISP的公共IP地址123.4.5.6 ) Connection Timeout错误。 但是,networking服务器将保持通过我的局域网(使用LAN IP地址192.168.0.6 )。
据我所知,这是我的networking图(isp和vpn ips不是真正的):
以下是关于networking收集的一些信息(我禁用了我的UFW防火墙并刷新了所有的iptables规则,以排除防火墙引起的可能性):
连接到VPN之前:
me@mypc:~$ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0 192.168.0.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0 me@mypc:~$ ifconfig eth0 Link encap:Ethernet HWaddr 00:1d:09:b4:b9:21 inet addr:192.168.0.6 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::21d:9ff:feb4:b921/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:239399 errors:0 dropped:0 overruns:0 frame:0 TX packets:89260 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:321072109 (321.0 MB) TX bytes:17959636 (17.9 MB) Interrupt:17 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:359782 errors:0 dropped:0 overruns:0 frame:0 TX packets:359782 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:140030332 (140.0 MB) TX bytes:140030332 (140.0 MB)UU
连接到VPN后:
me@mypc:~$ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 10.132.1.5 128.0.0.0 UG 0 0 0 tun0 0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0 10.132.1.1 10.132.1.5 255.255.255.255 UGH 0 0 0 tun0 10.132.1.5 0.0.0.0 255.255.255.255 UH 0 0 0 tun0 128.0.0.0 10.132.1.5 128.0.0.0 UG 0 0 0 tun0 192.168.0.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0 234.5.6.7 192.168.0.1 255.255.255.255 UGH 0 0 0 eth0 me@mypc:~$ ifconfig eth0 Link encap:Ethernet HWaddr 00:1d:09:b4:b9:21 inet addr:192.168.0.6 Bcast:192.168.0.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:238838 errors:0 dropped:0 overruns:0 frame:0 TX packets:88929 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:320930349 (320.9 MB) TX bytes:17868326 (17.8 MB) Interrupt:17 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:348572 errors:0 dropped:0 overruns:0 frame:0 TX packets:348572 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:135702614 (135.7 MB) TX bytes:135702614 (135.7 MB) tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet addr:10.132.1.6 PtP:10.132.1.5 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1 RX packets:833 errors:0 dropped:0 overruns:0 frame:0 TX packets:918 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:694943 (694.9 KB) TX bytes:105489 (105.4 KB)
是什么原因导致这个问题,我该如何解决?
你必须添加路由到123.4.5.6带动你的ISP大门。 例如:
route add -host 123.4.5.6 gw 192.168.0.1
根据你的Linux发行版把这个规则路由到适当的configuration文件。