HOWTOlabs  
 Services     Software     Commentary     Design     Astral Musings   
Networking
Dual Route Tips
Elsewhere Food for thought ...

For highly redundant server/network setups, need a way to route traffic sensibly when there are two or more equally cabably network interfaces connected to the Internet.  Typically such a setup would include a load-balancer upstream of the server which has dual network adaptors.

Enter special service multi-home-route to setup and remove routes and rules to accomplish this.

# ip route 

  192.168.221.0/24 dev eth0  proto kernel  scope link  src 192.168.221.100 
  default via 192.168.221.254 dev eth0 

# ip rule

  0:      from all lookup 255 
  32766:  from all lookup main 
  32767:  from all lookup default 

# cat /etc/sysconfig/network

  NETWORKING=yes
  NETWORKING_IPV6=no
  HOSTNAME=morbo.mdstage.com
  # GATEWAY=192.168.221.254   <- remove this

# cat /etc/sysconfig/network-scripts/ifcfg-eth0

  # Broadcom Corporation NetXtreme II BCM5708 Gigabit Ethernet
  DEVICE=eth0
  BOOTPROTO=static
  BROADCAST=192.168.221.255
  HWADDR=00:1A:A0:38:5F:3E
  IPADDR=192.168.221.100
  NETMASK=255.255.255.0
  NETWORK=192.168.221.0
  GATEWAY=192.168.221.254  <- add this
  ONBOOT=yes

# cat /etc/sysconfig/network-scripts/ifcfg-eth1

  # Broadcom Corporation NetXtreme II BCM5708 Gigabit Ethernet
  DEVICE=eth1
  BOOTPROTO=static
  BROADCAST=192.168.222.255
  HWADDR=00:1A:A0:38:5F:40
  IPADDR=192.168.222.100
  NETMASK=255.255.255.0
  NETWORK=192.168.222.0
  GATEWAY=192.168.222.254  <- add this
  ONBOOT=yes

# cat /etc/iproute2/rt_tables 

  #
  # reserved values
  #
  255	local
  254	main
  253	default
  0	unspec
  #
  # local
  #
  #1	inr.ruhep
  21	connection1  <- add this
  22	connection2  <- add this

# who -r

  run-level 3  2009-10-06 16:28    last=S 
# cd /etc/rc.d

# grep -R multi- *

  init.d/multi-home-route:# multi-home-route ... 
  init.d/multi-home-route:# description: ...
  rc3.d/S11multi-home-route:# multi-home-route ...
  rc3.d/S11multi-home-route:# description: ...
  rc5.d/S11multi-home-route:# multi-home-route ... 
  rc5.d/S11multi-home-route:# description: ...

$ ls -lh /etc/rc.d/rc3.d/*multi-home*

  lrwxrwxrwx 1 root root 26 Oct  7 16:37
  /etc/rc.d/rc3.d/S11multi-home-route -> ../init.d/multi-home-route

$ ls -lh /etc/rc.d/rc5.d/*multi-home*

  lrwxrwxrwx 1 root root 26 Oct  7 16:38
  /etc/rc.d/rc5.d/S11multi-home-route -> ../init.d/multi-home-route

# ip route

  192.168.221.0/24 dev eth0  proto kernel  scope link  src 192.168.221.100 
  192.168.222.0/24 dev eth1  proto kernel  scope link  src 192.168.222.100 
  169.254.0.0/16 dev eth1  scope link 
  default via 192.168.222.254 dev eth1 

# ip rule

  0:	from all lookup 255 
  10:	from 192.168.221.0/24 lookup connection1 
  20:	from 192.168.222.0/24 lookup connection2 
  32766:	from all lookup main 
  32767:	from all lookup default
zap technologies
tablet | printable