Recently set up vpn, using ssh tunnel has been involved in issues related to routing, today is simple sort out for next time:
View route:
[JSI @ localhost Desktop] $ route Kernel the IP routing Table the Destination Gateway Genmask-the Flags the Metric Ref the Use Iface 10.134 . 150.0 * 255.255 . 254.0 the U- . 1 0 0 eth2 default 10.134 . 150.1 0.0 . 0.0 UG 0 0 0 eth2 Note: Which front , which will have priority in front are not, with the last default
[jsi@localhost Desktop]$ netstat -nr Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 10.134.150.0 0.0.0.0 255.255.254.0 U 0 0 0 eth2 0.0.0.0 10.134.150.1 0.0.0.0 UG 0 0 0 eth2
[jsi@localhost Desktop]$ ip route show 10.134.150.0/23 dev eth2 proto kernel scope link src 10.134.151.44 metric 1 default via 10.134.150.1 dev eth2 proto static
Add routes (temporary) :( permanently added init scripts can be configured to add)
Use the route command to add the route, or restart the machine after the restart routing network card on the failure, methods: // added to the host route # route the Add -host 192.168 . 168.110 dev eth0 # route the Add -host 192.168 . 168.119 gw 192.168 . 168.1 / / add a route network # route the Add -net MASK IP Netmask eth0 # route the Add -net MASK IP Netmask gw IP # -net route the Add IP / 24- eth1 // add a default gateway # the Add default route gw IP // delete routing # -host del route 192.168 . 168.110 dev eth0
ip RO the Add 192.56 . 76.0 / 24- dev 192.168 . 0.1 # add a static route Via ip RO the Add default 192.168 . 0.1 dev eth0 # Add a default route ip RO del 192.168 . 1.0 / 24- # delete a route ip route show # View the routing table # command to add a route only temporary work, restart failure;
Permanently add routes, useless to me, I do not write here.
Common routing command to back up:
route add -host 202.112.137.223 dev enp4s0 (2019 Nian 6 Yue 8 Ri 19:12:11)