A. Route set
1, View: route -n
2、添加: route add [-net|-host] target [netmask Nm] [gw Gw] [[dev If]
Goal: 192.168.40.211 Gateway: 192.168.40.1 (must be in the same network as the local address)
Such as: [root @ zjz ~] # route add -host 192.168.40.211 gw 192.168.40.1 dev ens33 (NIC through which local)
3、ip route add TARGET via GW [dev IFACE] [src SOURCE_IP]
(Dev an outflow interface, via: via next hop)
For example: ip route add 192.168.1.3 via 172.16.0.1 dev eth0
ip route add 192.168.0.0/24 via 172.16.0.1
Note TARGET in the format:
Host route: IP
Network Routing: NETWORK / MASK
[root@localhost ~]# ip route show 或者 ip route list
default via 192.168.40.2 dev ens33 proto static metric 100
192.168.40.0/24 dev ens33 proto kernel scope link src 192.168.40.211 metric 100
default via 192.168.40.2 dev ens33 proto static metric 100
192.168.40.0/24 dev ens33 proto kernel scope link src 192.168.40.211 metric 100
4、[root@localhost ~]# ip route add 192.168.40.132 via 192.168.40.1 dev ens33
5, delete the route: ip route del IP
6, profile permanent
vim /etc/rc.local
Second, the difference between routing and gateway
Gateway is a ip, when a network to other network to go through a "gateway"
Route: communication address routing table, containing direction "destination" can be understood as the path.