Help Center> Elastic Cloud Server> FAQs> Network Configurations> Routing> How Can I Add a Static Route to a CentOS 6.5 OS?
Updated on 2022-08-14 GMT+08:00

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

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

Routing FAQs

more