Redhat – SciLinux6 (RHEL6) how to specify network setup and routing the redhat way

networkingredhatroute

I've got a SciLinux 6 box with 5 nic's in it. I'm not getting the network configuration I want (particularly the routing). While I can certain put a bunch of route statements at the end of rc.local, I'd rather do it the 'redhat' way.

What I'd like is some guidance on is how to:

  1. Correct the routing as indicated below.
  2. Correct the default route as indicated below.
  3. I would love to make that 169.254 silliness go away, so some direction on how to do that would be much appreciated.

So there's 5 nics, eth0-eth4. Note that eth4 plugs into an RSPAN port on a cisco switch, and is included only for completeness.

# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 14:DA:E9:1F:C3:F4  
          inet addr:172.17.21.185  Bcast:172.17.21.255  Mask:255.255.255.0
          inet6 addr: fe80::16da:e9ff:fe1f:c3f4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:138237 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16628 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:14693874 (14.0 MiB)  TX bytes:2744136 (2.6 MiB)
          Interrupt:18 Memory:fb700000-fb720000 

eth1      Link encap:Ethernet  HWaddr 00:15:17:BC:09:FC  
          inet addr:172.19.21.185  Bcast:172.19.21.255  Mask:255.255.255.0
          inet6 addr: fe80::215:17ff:febc:9fc/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:310208 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1252 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:30318084 (28.9 MiB)  TX bytes:173742 (169.6 KiB)
          Interrupt:17 Memory:fb2a0000-fb2c0000 

eth2      Link encap:Ethernet  HWaddr 00:15:17:BC:09:FD  
          inet addr:172.22.21.185  Bcast:172.22.21.255  Mask:255.255.255.0
          inet6 addr: fe80::215:17ff:febc:9fd/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:60431 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10028 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3717284 (3.5 MiB)  TX bytes:2221656 (2.1 MiB)
          Interrupt:18 Memory:fb240000-fb260000 

eth3      Link encap:Ethernet  HWaddr 00:15:17:BC:09:FE  
          inet addr:172.21.21.185  Bcast:172.21.21.255  Mask:255.255.255.0
          inet6 addr: fe80::215:17ff:febc:9fe/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2181043 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3531189 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:626303081 (597.2 MiB)  TX bytes:5131547226 (4.7 GiB)
          Interrupt:18 Memory:fb1a0000-fb1c0000 

eth4      Link encap:Ethernet  HWaddr 00:15:17:BC:09:FF  
          inet addr:1.1.1.1  Bcast:1.255.255.255  Mask:255.255.255.255
          inet6 addr: fe80::215:17ff:febc:9ff/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:57507 errors:0 dropped:0 overruns:0 frame:0
          TX packets:100 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3556510 (3.3 MiB)  TX bytes:20238 (19.7 KiB)
          Interrupt:19 Memory:fb140000-fb160000

Here's the current routing:

# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.22.21.0     0.0.0.0         255.255.255.0   U     0      0        0 eth2
172.21.21.0     0.0.0.0         255.255.255.0   U     0      0        0 eth3
172.17.21.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
172.19.21.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1003   0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U     1004   0        0 eth2
169.254.0.0     0.0.0.0         255.255.0.0     U     1005   0        0 eth3
169.254.0.0     0.0.0.0         255.255.0.0     U     1006   0        0 eth4
0.0.0.0         172.22.21.3     0.0.0.0         UG    0      0        0 eth2

Here's the routing I want:

# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.22.21.0     172.22.21.3     255.255.255.0   U     0      0        0 eth2
172.21.21.0     172.21.21.3   255.255.255.0   U     0      0        0 eth3
172.17.21.0     172.17.21.3     255.255.255.0   U     0      0        0 eth0
172.19.21.0     172.19.21.3     255.255.255.0   U     0      0        0 eth1
0.0.0.0         172.17.21.3     0.0.0.0         UG    0      0        0 eth2

Here are the config files (that I know about)

$ cat /etc/sysconfig/network-scripts/ifcfg-zEM
DEVICE="eth0"
HWADDR=14:DA:E9:1F:C3:F4
NM_CONTROLLED="no"
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
IPADDR=172.17.21.185
BROADCAST=172.17.21.255
PREFIX=24
GATEWAY=172.17.21.3
DNS1=172.17.21.20
DNS2=172.17.21.21
DOMAIN=em.local
DEFROUTE=no
IPV4_FAILURE_FATAL=yes
PEERDNS=yes
IPV6INIT=no
IPV6_AUTOCONF=no
USERCTL=no
NAME=EM
UUID=3a73717e-65ab-93e8-b518-24f5af32dc0d

$ cat /etc/sysconfig/network-scripts/ifcfg-FEP
DEVICE=eth1
HWADDR=00:15:17:BC:09:FC
NM_CONTROLLED="no"
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
IPADDR=172.19.21.185
BROADCAST=172.19.21.255
PREFIX=24
BROADCAST=172.19.21.255
GATEWAY=172.19.21.3
#DNS1=172.17.21.20
#DNS2=172.17.21.21
DOMAIN=em.local
DEFROUTE=no
IPV4_FAILURE_FATAL=yes
PEERDNS=yes
IPV6INIT=no
IPV6_AUTOCONF=no
USERCTL=no
NAME=FEP

$ cat /etc/sysconfig/network-scripts/ifcfg-QA
DEVICE=eth2
HWADDR=00:15:17:BC:09:FD
NM_CONTROLLED="no"
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
IPADDR=172.22.21.185
PREFIX=24
BROADCAST=172.22.21.255
GATEWAY=172.22.21.3
DNS1=172.17.21.20
DNS2=172.17.21.21
DOMAIN=em.local
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
PEERDNS=yes
IPV6INIT=no
IPV6_AUTOCONF=no
USERCTL=no
NAME=QA

$ cat /etc/sysconfig/network-scripts/ifcfg-PD
DEVICE=eth3
HWADDR=00:15:17:BC:09:FE
NM_CONTROLLED="no"
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
IPADDR=172.21.21.185
PREFIX=24
BROADCAST=172.21.21.255
GATEWAY=172.21.21.3
DNS1=172.17.21.20
DNS2=172.17.21.21
DOMAIN=em.local
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
PEERDNS=yes
IPV6INIT=no
IPV6_AUTOCONF=no
USERCTL=no
NAME=PD
# UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03

$ cat /etc/sysconfig/network-scripts/ifcfg-RSPAN
DEVICE="eth4"
NM_CONTROLLED="no"
ONBOOT="yes"
HWADDR="00:15:17:BC:09:FF"
TYPE=Ethernet
BOOTPROTO=none
IPADDR=1.1.1.1
PREFIX=32
DEFROUTE=no
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME=RSPAN
IPV6_AUTOCONF=no
# UUID=d9ced338-a402-60eb-c131-0fd3ab4b5ab7

$ cat /etc/networks 
default 0.0.0.0
loopback 127.0.0.0
link-local 169.254.0.0

$ cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=bigbox.em.local
NTPSERVERARGS=iburst

Best Answer

You need to create a file called route-ethX (where X is the interface that you want the route attached to) in the /etc/sysconfig/network-scripts directory.

for example i need to route our public office out the internet and not the vpn due to the way chat checks who you are. So i have a files called route-eth0 in our office router that looks like:

64.34.119.10 via 74.101.14.1 dev eth0

You can read up on RHEL network configuration here