LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   [ASK] - How to add IP Route using Channel Bonding in RHEL6 (http://www.linuxquestions.org/questions/linux-networking-3/%5Bask%5D-how-to-add-ip-route-using-channel-bonding-in-rhel6-4175444142/)

rahardj 01-04-2013 09:46 AM

[ASK] - How to add IP Route using Channel Bonding in RHEL6
 
Hi All,

I have question about IP Route using Channel Bonding in RHEL6.

For example I have 1 machine with 4 Ethernet and I will create 2 channel bonding that connect to 2 different switches in different VLAN with following details:
  1. eth0 to switch A (VLAN1, gateway: 10.1.0.1/28)
  2. eth1 to switch B (VLAN1, gateway: 10.1.0.2/28)
  3. eth2 to switch A (VLAN2, gateway: 10.1.0.10/28)
  4. eth3 to switch B (VLAN2, gateway: 10.1.0.11/28)


Current Config:
Code:

cat etc/modprobe.d/bonding.conf
alias bond0 bonding
alias bond1 bonding

cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
NM_CONTROLLED="no"
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
BONDING_OPTS="mode=1 miimon=100 primary=eth0"
IPADDR=10.1.0.4
NETMASK=255.255.255.240
GATEWAY=10.1.0.1

cat /etc/sysconfig/network-scripts/ifcfg-bond1
DEVICE=bond1
NM_CONTROLLED="no"
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
BONDING_OPTS="mode=1 miimon=100 primary=eth2"
IPADDR=10.1.0.13
NETMASK=255.255.255.240
GATEWAY=10.1.0.10

cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="no"
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
USERCTL=no
DEFROUTE=no
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
PEERDNS=yes

cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE="eth1"
NM_CONTROLLED="no"
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
USERCTL=no
DEFROUTE=no
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth1"
PEERDNS=yes

cat /etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE="eth2"
NM_CONTROLLED="no"
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=none
MASTER=bond1
SLAVE=yes
USERCTL=no
DEFROUTE=no
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth2"
PEERDNS=yes

cat /etc/sysconfig/network-scripts/ifcfg-eth3
DEVICE="eth3"
NM_CONTROLLED="no"
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=none
MASTER=bond1
SLAVE=yes
USERCTL=no
DEFROUTE=no
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth3"
PEERDNS=yes

QUESTIONS:
  1. Is that configuration above correct for channel bonding? If not please help to made correction
  2. How to configure to add route to made the server unable to ping/access from the computer with IP: 10.2.0.17/24 Gateway: 10.2.0.1 and IP: 10.2.2.10/24 Gateway: 10.2.2.1?

Many thanks for help

acid_kewpie 01-04-2013 10:28 AM

1. it looks correct apart from having 2 gateways for each ethX, what's that about? It makes no sense.

2. routing and bonding have nothing in common. You just need to add routes to bond0 instead of eth0 and such like. If you want to add routes to load on boot on a rhel box, you'd create a file /etc/sysconfig/network-scripts/route-bond0:

http://www.centos.org/docs/5/html/5....ic-routes.html

rahardj 01-04-2013 10:51 AM

so, for routing I just need to create 2 file ?
Quote:

/etc/sysconfig/network-scripts/route-bond0
/etc/sysconfig/network-scripts/route-bond1
Is possible I use duplicate/double default route? Cause from for eth0 and eth1 have different gateway

acid_kewpie 01-04-2013 10:54 AM

yes. With the right contents of course.


All times are GMT -5. The time now is 09:43 PM.