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

How to add static routing in linux system

王林
Release: 2020-05-26 15:17:40
Original
8022 people have browsed it

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
Copy after login

2. Delete routes

route del -net 192.168.0.0/24 gw 192.168.0.1
Copy after login

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
Copy after login

One default route is enough

4. View the routing table

route -n
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template