我有自己的无线路由器,远程VPN客户端10.7.0.6连接到它上面。我希望其中一个无线客户端的流量通过它传输,但是我得到了“下一跳具有无效网关”的错误提示。(我知道我需要说服10.7.0.6合作,但目前的问题似乎在此之前。)
这是路由器的IP地址,10.0.0.1:
[ad@rout ~]$ ip addr
1: lo: ...
2: wlp0s20f0u1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 78:32:1b:06:18:1b brd ff:ff:ff:ff:ff:ff
inet 10.0.0.1/24 brd 10.0.0.255 scope global wlp0s20f0u1
valid_lft forever preferred_lft forever
...
6: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 100
link/none
inet 10.7.0.1 peer 10.7.0.2/32 scope global tun0
valid_lft forever preferred_lft forever
...
23: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1492 qdisc fq_codel state UNKNOWN group default qlen 3
link/ppp
inet 82.69.221.62 peer 62.3.89.162/32 scope global ppp0
valid_lft forever preferred_lft forever
[ad@rout ~]$ ip route
default dev ppp0 scope link
10.0.0.0/24 dev wlp0s20f0u1 proto kernel scope link src 10.0.0.1
10.7.0.0/24 via 10.7.0.2 dev tun0
10.7.0.2 dev tun0 proto kernel scope link src 10.7.0.1
62.3.89.162 dev ppp0 proto kernel scope link src 82.69.221.62
这是客户端,10.0.0.2,在我开始折腾之前。
ad@blackmail:~$ ip addr
1: ...
2: ...
3: wls1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 60:57:18:43:12:fa brd ff:ff:ff:ff:ff:ff
inet 10.0.0.2/24 brd 10.0.0.255 scope global noprefixroute wls1
valid_lft forever preferred_lft forever
inet6 fe80::6257:18ff:fe43:12fa/64 scope link
valid_lft forever preferred_lft forever
ad@blackmail:~$ ip route
default via 10.0.0.1 dev wls1 proto dhcp src 10.0.0.2 metric 303 mtu 1492
10.0.0.0/24 dev wls1 proto dhcp scope link src 10.0.0.2 metric 303 mtu 1492
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
ad@blackmail:~$ ping google.com
PING google.com (216.58.198.238) 56(84) bytes of data.
64 bytes from lhr26s04-in-f238.1e100.net (216.58.198.238): icmp_seq=1 ttl=53 time=17.0 ms
ad@blackmail:~$ ping 10.7.0.6
PING 10.7.0.6 (10.7.0.6) 56(84) bytes of data.
64 bytes from 10.7.0.6: icmp_seq=1 ttl=63 time=626 ms
ad@blackmail:~$ traceroute 10.7.0.6
traceroute to 10.7.0.6 (10.7.0.6), 30 hops max, 60 byte packets
1 rout (10.0.0.1) 3.777 ms 5.372 ms 7.143 ms
2 10.7.0.6 (10.7.0.6) 153.924 ms 153.948 ms 153.999 ms
现在我尝试让它通过10.7.0.6去传输:
ad@blackmail:~$ su
Password:
[root@blackmail ~]# ip route del default
[root@blackmail ~]# ip route add 10.7.0.0/24 via 10.0.0.1
[root@blackmail ~]# ping 10.7.0.6
PING 10.7.0.6 (10.7.0.6) 56(84) bytes of data.
64 bytes from 10.7.0.6: icmp_seq=1 ttl=63 time=428 ms
[root@blackmail ~]# ip route add default via 10.7.0.6
Error: Nexthop has invalid gateway.
为什么?