Static routes can be added usually through “route add” or “ip route” command. However, “route add” command configures routing on the runtime and doesn’t persist the configuration after a reboot.
To make it persistent across reboots, you have to add it to /etc/sysconfig/network/route file for SUSE .
For example, static routes for the eth0 interface would be stored in the /etc/sysconfig/network/route
file. Here are the Steps to configure static routing in Linux.
To see the current routes:
1
|
# route
|
To add static route using “route add” in command line:
1
|
# route add -net 192.168.100.0 netmask 255.255.255.0 gw 192.168.10.1 dev eth0
|
To add static route using “ip route” command:
1
|
# ip route add 192.168.100.0/24 via 192.168.10.1 dev eth1
|