Static routing configuration commands under Linux

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.