Home >Operation and Maintenance >Linux Operation and Maintenance >How to add static routing in linux system
You can add static routes through the route add command. The specific commands are as follows:
1. Add routes
route add -net 192.168.0.0/24 gw 192.168.0.1 route add -host 192.168.1.1 dev 192.168.0.1
2. Delete routes
route del -net 192.168.0.0/24 gw 192.168.0.1
Parameter introduction:
add Add route
del Delete route
-net Set the route to a certain network segment
-host Set the route to a certain host
gw Exit gateway IP address
dev Exit gateway physical device name
3. Add default route
route add default gw 192.168.0.1
One default route is enough
4. View the routing table
route -n
Recommended tutorial: linux tutorial
The above is the detailed content of How to add static routing in linux system. For more information, please follow other related articles on the PHP Chinese website!