Static route modification command under Linux
Method One:
Add route
Route add-net 192.168.1.0/24 GW 192.168.1.1
Route add-host 192.168.1.8 Dev 192.168.1.1
Delete route
Route del-net 192.168.0.0/24 GW 192.168.0.1
Add Add route
del Delete route
-net setting a route to a network segment
-host setting a route to a host
GW Export Gateway IP address
Dev Egress Gateway Physical device name
Add default route
Route add default GW 192.168.3.1
Route-n Viewing the routing table
Method Two:
Add route
IP route add 192.168.0.0/24 via 192.168.0.1
IP route add 192.168.1.1 dev 192.168.0.1
Delete route
IP route del 192.168.0.0/24 via 192.168.0.1
Add Add route
del Delete route
Via Gateway egress IP Address
Dev Gateway Export Physical device name
Add default route
IP route add default via 192.168.0.1 dev eth0
Via 192.168.0.1 is my default router
Viewing routing information
IP route
Permanent effect
Vi/etc/sysconfig/network-scripts/route-eth0 #默认不存在此文件
Add the following content:
192.168.1.0/24 via 192.168.1.1
Hint: Write to the configuration, restart the network service and restart the system will be effective, or append to/etc/rc.loacl inside can also
This article is from the "Bill of Operations Notes" blog, please be sure to keep this source http://chenshoubiao.blog.51cto.com/6159058/1843039
Static routing configuration commands under Linux