Home >Operation and Maintenance >Linux Operation and Maintenance >How to add static routing in linux system

How to add static routing in linux system

王林
王林Original
2020-05-26 15:17:408030browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn