Help Center > > FAQs> Network Configurations> Routing> How Can I Add a Static Route to a CentOS 6.5 OS?

How Can I Add a Static Route to a CentOS 6.5 OS?

Updated at: Mar 17, 2020 GMT+08:00

Scenarios

After the system restarts, non-static routes are lost, affecting network availability. To prevent this issue from occurring, you must add static routes to the system.

Procedure

The following section uses a CentOS 6.5 OS as an example.
  1. Log in to the ECS.
  2. Create or modify the static route configuration file.

    If the static-routes configuration file is not in the /etc/sysconfig/ directory, create this file. If such a file is available, run the following command to add a static route into this file:

    any net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.34

    After the configuration, save and exit the file. The following figure shows the modified file content.

  3. Run the following command to restart the network service to make the static route take effect:

    service network restart

  4. Run the following command to view routes:

    route -n

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel