adding_routes
This is an old revision of the document!
Adding Routes
CentOS 6.x
To add a route, you can use the following command and replacing <destination>, <gateway>, <interface>:
1 |
ip route add <destination> /32 via <gateway> dev <interface> |
Once you have confirmed the route is working, you will need to add it to configuration file to make sure the route survives a reboot. Replace <interface> with the interface name
1 |
vim /etc/sysconfig/network-scripts/route- <interface> |
Once you are in the file, add the route like you did above without the commands:
1 |
<destination> /32 via <gateway> dev <interface> |
You could instead, add the route straight into the configuration file and then run the following command to test the file:
1 |
/etc/sysconfig/network-scripts/ifup-routes <interface name> |
Testing the interface
1 |
ip route get <destination> |
adding_routes.1499156278.txt.gz · Last modified: 2024/05/23 07:26 (external edit)