下面修改路由配置:
查看第一跳,localhost (10.10.10.1),已经通过VPN实现路由。
停止VPN
再ping网站,发现网络出现问题。Network is unreachable
重置路由
通过ip-up, ip-down配置路由
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
| #修改路由命令 ~ sudo ip route del default ~ sudo ip route add default dev ppp0 ~ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 ppp0 10.10.10.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0 50.116.27.194 192.168.1.1 255.255.255.255 UGH 0 0 0 eth0 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 ~ ip route default dev ppp0 scope link 10.10.10.1 dev ppp0 proto kernel scope link src 10.10.10.3 50.116.27.194 via 192.168.1.1 dev eth0 src 192.168.1.200 192.168.1.0 /24 dev eth0 proto kernel scope link src 192.168.1.200 ~ traceroute www.163.com traceroute to www.163.com (101.23.128.17), 30 hops max, 60 byte packets 1 localhost (10.10.10.1) 281.093 ms 281.414 ms 280.941 ms 2 router2-dal.linode.com (67.18.7.162) 281.225 ms 281.109 ms 281.841 ms 3 xe-2-0-0.car04.dllstx2.networklayer.com (67.18.7.93) 280.882 ms 284.002 ms 283.913 ms 4 po102.dsr01.dllstx2.networklayer.com (70.87.254.81) 284.123 ms 284.087 ms 283.979 ms 5 po21.dsr01.dllstx3.networklayer.com (70.87.255.65) 284.000 ms 283.921 ms 283.839 ms 6 ae16.bbr01.eq01.dal03.networklayer.com (173.192.18.224) 283.542 ms 279.296 ms 290.455 ms 7 dls-bb1-link.telia.net (213.248.102.173) 301.426 ms 302.092 ms 302.085 ms 8 las-bb1-link.telia.net (213.155.131.77) 327.192 ms 327.350 ms 327.344 ms 9 chinaunicom-ic-151188-las-bb1.telia.net (213.248.94.126) 478.941 ms 479.089 ms 479.083 ms 10 219.158.30.173 (219.158.30.173) 496.679 ms 496.673 ms 496.667 ms 11 219.158.97.57 (219.158.97.57) 516.819 ms 517.035 ms 517.011 ms 12 219.158.5.129 (219.158.5.129) 491.084 ms 490.018 ms 497.472 ms 13 219.158.100.130 (219.158.100.130) 518.239 ms 518.216 ms 518.192 ms 14 61.182.176.186 (61.182.176.186) 533.695 ms 533.673 ms 533.666 ms 15 101.23.255.230 (101.23.255.230) 512.212 ms 512.500 ms 512.479 ms 16 60.5.194.74 (60.5.194.74) 519.246 ms 519.815 ms 519.791 ms 17 101.23.255.45 (101.23.255.45) 526.522 ms 526.907 ms 526.844 ms 18 101.23.128.17 (101.23.128.17) 522.068 ms 517.535 ms 517.240 ms |
停止VPN
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| ~ sudo poff myvpn ~ ifconfig eth0 Link encap:Ethernet HWaddr 08:00:27:90:e8:19 inet addr:192.168.1.200 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe90:e819 /64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:2270 errors:0 dropped:0 overruns:0 frame:0 TX packets:1991 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:207578 (207.5 KB) TX bytes:184147 (184.1 KB) 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:16436 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) |
1
2
3
4
5
6
7
8
9
10
11
12
| ~ ping www.163.com connect: Network is unreachable ~ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 50.116.27.194 192.168.1.1 255.255.255.255 UGH 0 0 0 eth0 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 ~ ip route 50.116.27.194 via 192.168.1.1 dev eth0 src 192.168.1.200 192.168.1.0 /24 dev eth0 proto kernel scope link src 192.168.1.200 |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| ~ sudo ip route add default via 192.168.1.1 ~ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0 50.116.27.194 192.168.1.1 255.255.255.255 UGH 0 0 0 eth0 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 ~ ip route default via 192.168.1.1 dev eth0 50.116.27.194 via 192.168.1.1 dev eth0 src 192.168.1.200 192.168.1.0 /24 dev eth0 proto kernel scope link src 192.168.1.200 #再次ping网站,访问成功! ~ ping www.163.com PING 163.xdwscache.glb0.lxdns.com (101.23.128.17) 56(84) bytes of data. 64 bytes from 101.23.128.17: icmp_req=1 ttl=54 time =25.6 ms 64 bytes from 101.23.128.17: icmp_req=2 ttl=54 time =25.5 ms 64 bytes from 101.23.128.17: icmp_req=3 ttl=54 time =27.8 ms |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| ~ sudo vi /etc/ppp/ip-up .d /route-traffic #!/bin/bash /sbin/ip route add 50.116.27.194 via 192.168.1.1 /sbin/ip route del default /sbin/ip route add default dev ppp0 ~ sudo chmod 755 /etc/ppp/ip-up .d /route-traffic ~ sudo vi /etc/ppp/ip-down .d /disableroute #!/bin/bash /sbin/ip route add default via 192.168.1.1 ~ sudo chmod 755 /etc/ppp/ip-down .d /disableroute |
No comments:
Post a Comment