From the course: Linux System Engineer: Network Bonding, IPv6, Routing, and Virtual Systems

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Create static routes manually

Create static routes manually

From the course: Linux System Engineer: Network Bonding, IPv6, Routing, and Virtual Systems

Start my 1-month free trial

Create static routes manually

- [Instructor] We can add static routes using the ip route command. We can also add static routes using the legacy route command, although it needs to be installed first. However, if you want your static routes to survive a reboot, you'll need to add them to configuration files in /etc/sysconfig/network-scripts. When we create a network interface configuration file, we name it ifcfg dash interface name such as ifcfg-eth0. For static routes, we name the configuration file route dash interface name. For instance, if we wanted to add a static route for the eth0 interface, we create a file called route-eth0. To add a route manually using the ip command, we type ip space route space add space 192.168.100.0 which is the network address /24 which is the subnet mask space 192.168.100.1 which is the gateway space dev space team 0 which is the interface. If you type in ip space route, you would see the results of this line. The legacy route version of this command line is a bit longer. We type…

Contents