Linux Networking – Interface Bonding / Teaming

Linux bonding driver provides a method to aggregate multiple network interface cards into a single logical / teamed / bonded interface. The behaviour depends on the mode of the bonding that we choose, but generally speaking the modes provide either hot standby or load balancing.

Bond Interfaces can be very useful if you want to divide the entire network using VLANs and allow per VLAN traffic with the view to have reliable and redundant network connectivity. Here, I am trying to provide a procedure to create a bonded interface under CentOS 6.4. This is not a new concept but it provides a tested procedure that I have used to create my setup which is named as “The Matrix” – The Matrix

CREATING A BONDED INTERFACE

  • In order for us to have a reliable network and have the ability to use VLAN’s a bonded interface is created so that the load can be split on both the interfaces with the flexibility of using more than one network
  • To separate the traffic the use VLANs and bridge interfaces is common. For the separation, we used VLANs and the bridge interfaces that would be connecting to the virtual hosts would not be connected to the physical interfaces, but instead would be connected to the virtual interfaces that we would be configuring as part of the Linux VLAN configuration
  • Based on the article at the following location, I decided to put together the following configuration which will be used for the Controller and the Compute Nodes
  • Setting up the /etc/sysconfig/network configuration file
    • #vi  /etc/sysconfig/network
    • Add / Change the following information
      • HOSTNAME=<hostname_of_the_controller>
      • NETWORKING=yes
      • #IPV4
      • NOZEROCONFIG=yes
      • #IPV6
      • NETWORKING_IPV6=yes
      • IPV6INIT=yes
  • Go to /etc/sysconfig/network-scripts
  • Create interface – bond0
      • DEVICE=bond0
      • IPV6INIT=no
      • NM_CONTROLLED=no
      • USERCTL=no
      • BOOTPROTO=none
      • ONBOOT=yes
      • NOZEROCONF=yes
      • TYPE=unknown
  • Change interface – eth0
      • DEVICE=eth0
      • HWADDR=00:25:90:1A:E9:76
      • TYPE=Ethernet
      • UUID=f48b72fb-ae8f-4202-b707-23c88b79ef31
      • ONBOOT=yes
      • NM_CONTROLLED=yes
      • BOOTPROTO=none
      • MASTER=bond0
      • SLAVE=yes
      • NOZEROCONF=yes
  • Change Interface – eth1
      • DEVICE=eth1
      • HWADDR=00:25:90:1A:E9:77
      • TYPE=Ethernet
      • UUID=13c7c9ec-0bdc-432f-a898-f4e5cd3c0358
      • ONBOOT=yes
      • BOOTPROTO=none
      • USERCTL=no
      • MASTER=bond0
      • SLAVE=yes
      • NOZEROCONF=yes
  • Modify the file – /etc/modprobe.d/bonding.conf
      • alias bond0 bonding
      • options bond0 mode=5 miimon=100 arp_interval=100
      • #modprobe  bonding
  • Since I was using VLANs, I will now create the VLAN interface on top of bond0, bond0.140 and bond0.180 pointing to the appropriate bridge interfaces
    • #vi  /etc/sysconfig/network-scripts/ifcfg-bond0.140
      • DEVICE=bond0.140
      • VLAN=yes
      • BOOTPROTO=static
      • ONBOOT=yes
      • TYPE=Ethernet
      • IPADDR=<ipaddress>
      • NETMASK=255.255.255.0
      • GATEWAY=<gateway_ipaddress>
  • #vi  /etc/sysconfig/network-scripts/ifcfg-bond0.180
      • DEVICE=bond0.180
      • VLAN=yes
      • BOOTPROTO=static
      • ONBOOT=yes
      • TYPE=Ethernet
      • IPADDR=<ipaddress>
      • NETMASK=255.255.255.0
      • GATEWAY=<gateway_ipaddress>
  • Once the networking was configured, applied static routes to the interfaces did not work and I was unable to ping both the bonded interfaces. The interface that I was able to ping was the one that came up first. Following was the output of the routing table
    • router_output
  • After doing some research, I concluded that I can use the Linux kernel as routers and as many routers do they can route packets from one network to the other.
  • In my network I am using two VLAN <vlan_id> and <vlan_id>, so the following changes were made in order to ping both the networks
      • #cd /etc/
      • #vi sysctl.conf
      • Look for – net.ipv4.conf.default.rp_filter
      • Change the value from 1 to 2. And if this value is not available then add the value.
      • Reload sysctl
      • #sysctl  -p
  • Finally I got this working and all the tests for redundancy is finally completed.
Advertisements

INSTALLING APACHE ON CENTOS 6.4 – PART 2

IS THE SERVICE LISTENING?

  • Run the command lsof –i to see open ports; look for processes listening to port 80 (http)
    • #lsof  –i | grep http
  • Browse to http://localhost to see the default page
  • Examine the error log for clue
    • #/var/log/httpd/error_log
  • Verify no other process is listening on port 80
  • If SELinux is enabled, try disabling it

TESTING THE INSTALLATION

INSTALLATION FAILURES

  • Examine the error log for clue
    • #/var/log/httpd/error_log
  • Verify no other process is listening on port 80
  • If SELinux is enabled, try disabling it

INSTALLING APACHE ON CENTOS 6.4 – PART 1

 

PROCESS TO INSTALL APACHE

  • Install Apache on a standard linux installation
  • Serve a single site
  • Serve multiple sites with virtual hosts
  • Perform user authentication and access control
  • Setup a secure site (https)
  • Serve multiple sites with virtual hosts
  • Control logging and status reporting
  • Apache is in the CentOS repositories and is easy to install
    • #yum install httpd
  • The # prompt indicates that you need to do this as root
  • A number of dependencies will also be installed
    • #service httpd start
    • #chkconfig httpd on
  • This command ensures that the service will be started at boot time
  • This command starts the service immediately

INSTALLING APACHE

  • Apache is in the CentOS repositories and is easy to install
    • #yum install httpd
  • The # prompt indicates that you need to do this as root
  • A number of dependencies will also be installed

STARTING THE SERVICE

    • #service httpd start
    • #chkconfig httpd on
  • This command ensures that the service will be started at boot time
  • This command starts the service immediately