How to add a static route on CentOS 7

Source: Internet
Author: User
1. add a temporary static route (that is, it expires after restart) iprouteadd172.22.2.0/24via172. 22.3.254deveno16777984 2. add permanent route editing or create a new/etc/sysconfig/network-scripts/route-interface file, such as vi/et

1. add a temporary static route (that is, it becomes invalid after restart)

Ip route add 172.22.2.0/24 via 172.22.3.254 dev eno16777984

 

2. add a permanent route

Edit or create a/etc/sysconfig/network-scripts/route-interface file, such

Vi/etc/sysconfig/network-scripts/route-eno16777984

Add two routes:

 

172.22.2.0/24 via 172.22.3.254 dev eno16777984

172.21.0.0/16 via 172.22.3.254 dev eno16777984

Restart the system or Nic after adding: nmcli dev connect eno16777984

Related Article

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.