Static Routes

From Leo's Notes
Revision as of 17:31, 14 January 2016 by Leo (talk | contribs) (Created page with " == Temporary Route == {{highlight|lang=terminal|code= # ip route add 136.159.9.1 dev eth1 # ip route add 10.0.0.0/8 via 136.159.9.1 }} This will be wiped if the network gets...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
This page was last edited on 14 January 2016, at 17:31.

Temporary Route

# ip route add 136.159.9.1 dev eth1
# ip route add 10.0.0.0/8 via 136.159.9.1

This will be wiped if the network gets restarted or if the machine reboots.

Persistent

To make your route survive a reboot, ensure that there is a gateway set in /etc/sysconfig/network-scripts/ifcfg-eth1. Eg:

DEVICE="eth1"
BOOTPROTO="static"
ONBOOT="yes"
TYPE="Ethernet"
IPADDR=136.159.9.9
GATEWAY=136.159.9.1
NETMASK=255.255.255.0

Then, define the static routes in /etc/sysconfig/network-scripts/route-eth1:

default 136.159.9.1 dev eth1
10.0.0.0/8 via 136.159.9.1 dev eth1