{"id":6499,"date":"2017-02-27T09:00:15","date_gmt":"2017-02-27T01:00:15","guid":{"rendered":"http:\/\/rmohan.com\/?p=6499"},"modified":"2017-02-27T09:00:15","modified_gmt":"2017-02-27T01:00:15","slug":"bonding-network-interfaces-in-centos-6","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6499","title":{"rendered":"Bonding Network Interfaces in CentOS 6"},"content":{"rendered":"<h2>Overview<\/h2>\n<p>Bonding is the ability to take two or more network interfaces and present them as one to a client. Depending on the method you use, the bond can create different types of connections. You can, for example, create an aggregate channel to double or even triple your total bandwidth; create a fault tolerant connections to improve server reliability; or load balance connections to handle more requests and to improve response times.<\/p>\n<p>Some of the more advanced bonding methods, like channel aggregation, require switches that support IEEE 802.3ad dynamic link aggregation policy. However, simple load balancing and fault tolerance can be done without.<\/p>\n<h3>Server Configuration<\/h3>\n<p>To make it easier for you to follow along, the following configuration will be used in this tutorial.<\/p>\n<table>\n<caption><strong>TABLE1<\/strong> \u2013 <em>Lab server configuration<\/em><\/caption>\n<tbody>\n<tr>\n<th>Hostname<\/th>\n<th>Network Interface<\/th>\n<th>MAC Address<\/th>\n<th>IP Address<\/th>\n<th>Netmask<\/th>\n<th>Gateway<\/th>\n<\/tr>\n<tr>\n<td rowspan=\"2\">SERVER01<\/td>\n<td>ETH0<\/td>\n<td>00:1F:29:E6:EB:2A<\/td>\n<td rowspan=\"2\">172.30.0.34<\/td>\n<td rowspan=\"2\">255.255.255.0<\/td>\n<td rowspan=\"2\">172.30.0.1<\/td>\n<\/tr>\n<tr>\n<td>ETH1<\/td>\n<td>00:26:55:35:24:FE<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>It\u2019s important that you record the MAC address (hardware address) of every interface. Although not required, it is best practice to assign a MAC address to each bond slave. Without doing so, you cannot confidently unplug an interface and know which slave will be offline, potentially causing a service outage.<\/p>\n<h2>Prepare the Interfaces<\/h2>\n<p>Before we configure the type of bond we\u2019ll be using, we need to prepare the interfaces first. This envolves creating the bond0 configuration file, and then modifying the existing configurations files for each of your physical network interfaces. In this lab, there are only two.<\/p>\n<p>The steps for configuring the different bond types can be found after this section. Choose one and then follow the instructions.<\/p>\n<h3>Create the Bonded Interface<\/h3>\n<p>This is the interface your clients will be connecting to.<\/p>\n<ol>\n<li>Create the configuration file for the first bond, bond0.\n<pre class=\"bash\">touch \/etc\/sysconfig\/network-scripts\/ifcfg-bond0<\/pre>\n<\/li>\n<li>Open the file in a text editor.\n<pre class=\"bash\">nano \/etc\/sysconfig\/network-scripts\/ifcfg-bond0<\/pre>\n<\/li>\n<li>Add the following lines to the file.\n<div class=\"line\">DEVICE=bond0<\/div>\n<div class=\"line\">\u00a0IPADDR=172.30.0.34<\/div>\n<div class=\"line\">\u00a0NETMASK=255.255.255.0<\/div>\n<div class=\"line\">\u00a0GATEWAY=172.30.0.1<\/div>\n<div class=\"line\">\u00a0ONBOOT=yes<\/div>\n<div class=\"line\">\u00a0BOOTPROTO=none<\/div>\n<div class=\"line\">\u00a0USERCTL=no<\/div>\n<\/li>\n<li>Save your changes and exit the text editor.<\/li>\n<\/ol>\n<h3>Configure Slave 1<\/h3>\n<ol>\n<li>Open the configuration file for the first interface, eth0, into a text editor.\n<pre class=\"bash\">nano \/etc\/sysconfig\/network-scripts\/ifcfg-eth0<\/pre>\n<\/li>\n<li>Modify the configuration file to look like the following, replacing the highlighted parts to match your environment.\n<div class=\"line\">DEVICE=eth0<\/div>\n<div class=\"line\">\u00a0ONBOOT=yes<\/div>\n<div class=\"line\">\u00a0BOOTPROTO=none<\/div>\n<div class=\"line\">\u00a0HWADDR=<strong>00:1F:29:E6:EB:2A<\/strong><\/div>\n<div class=\"line\">\u00a0USERCTL=no<\/div>\n<div class=\"line\">\u00a0MASTER=bond0<\/div>\n<div class=\"line\">\u00a0SLAVE=yes<\/div>\n<\/li>\n<\/ol>\n<h3>Configure Slave 2<\/h3>\n<ol>\n<li>Open the configuration file for the second interface, eth1, into a text editor.\n<pre class=\"bash\">nano \/etc\/sysconfig\/network-scripts\/ifcfg-eth1<\/pre>\n<\/li>\n<li>Modify the configuration file to look like the following, replacing the highlighted parts to match your environment.\n<div class=\"line\">DEVICE=eth1<\/div>\n<div class=\"line\">\u00a0ONBOOT=yes<\/div>\n<div class=\"line\">\u00a0BOOTPROTO=none<\/div>\n<div class=\"line\">\u00a0HWADDR=<strong>00:26:55:35:24:FE<\/strong><\/div>\n<div class=\"line\">\u00a0USERCTL=no<\/div>\n<div class=\"line\">\u00a0MASTER=bond0<\/div>\n<div class=\"line\">\u00a0SLAVE=yes<\/div>\n<\/li>\n<\/ol>\n<h2>Configure a Fault Tolerant Bond<\/h2>\n<p>Also called an Active-Passive connection, this bond type will protect you from a failed physical network interface and, depending on your Ethernet configuration, a failure on your physical network.<\/p>\n<ol>\n<li>If it doesn\u2019t already exist, create a new file called bonding.conf in \/etc\/modprobe.d\n<pre class=\"bash\">touch \/etc\/modprobe.d\/bonding.conf<\/pre>\n<\/li>\n<li>Open the file in a text editor.\n<pre class=\"bash\">nano \/etc\/modprobe.d\/bonding.conf<\/pre>\n<\/li>\n<li>Add the following lines to the file.\n<div class=\"line\">alias bond0 bonding<\/div>\n<div class=\"line\">\u00a0options bond0 miimon=80 mode=1<\/div>\n<table class=\"list\">\n<caption><strong>TABLE2<\/strong> \u2013 <em>Bonding.conf options<\/em><\/caption>\n<tbody>\n<tr>\n<th>bond0<\/th>\n<td>Name of the bonded interface being created.<\/td>\n<\/tr>\n<tr>\n<th>miimon<\/th>\n<td>Defines how often, in milli-seconds, the interface is checked to see if it is still active.<\/td>\n<\/tr>\n<tr>\n<th>mode<\/th>\n<td>Type of bond being created.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/li>\n<li>Save your changes and exit the text editor.<\/li>\n<\/ol>\n<h2>Create Round-Robin Bond<\/h2>\n<p>Robin-Robin load balancing splits the connections between the two slaves evenly. The incoming connections alternate between the active slaves, taking the load off of each other, to improve request time.<\/p>\n<ol>\n<li>If it doesn\u2019t already exist, create a new file called bonding.conf in \/etc\/modprobe.d\n<pre class=\"bash\">touch \/etc\/modprobe.d\/bonding.conf<\/pre>\n<\/li>\n<li>Open the file in a text editor.\n<pre class=\"bash\">nano \/etc\/modprobe.d\/bonding.conf<\/pre>\n<\/li>\n<li>Add the following lines to the file.\n<div class=\"line\">alias bond0 bonding<\/div>\n<div class=\"line\">\u00a0options bond0 miimon=80 mode=0<\/div>\n<table class=\"list\">\n<caption><strong>TABLE3<\/strong> \u2013 <em>bonding.conf options<\/em><\/caption>\n<tbody>\n<tr>\n<th>bond0<\/th>\n<td>Name of the bonded interface being created.<\/td>\n<\/tr>\n<tr>\n<th>miimon<\/th>\n<td>Defines how often, in milli-seconds, the interface is checked to see if it is still active.<\/td>\n<\/tr>\n<tr>\n<th>mode<\/th>\n<td>Type of bond being created.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/li>\n<li>Save your changes and exit the text editor.<\/li>\n<\/ol>\n<h2>Create Aggregate Bond<\/h2>\n<p>Network aggregation combines the target network interfaces to create one large network interface. This will multiple the available bandwidth of the server\u2019s network connection by the of NICs installed.<\/p>\n<p>For this bond to work, you need your interfaces to be connected to a switch that supports IEEE 802.3ad dynamic link aggregation policy. Also, the ports have the feature enabled.<\/p>\n<ol>\n<li>If it doesn\u2019t already exist, create a new file called bonding.conf in \/etc\/modprobe.d\n<pre class=\"bash\">touch \/etc\/modprobe.d\/bonding.conf<\/pre>\n<\/li>\n<li>Open the file in a text editor.\n<pre class=\"bash\">nano \/etc\/modprobe.d\/bonding.conf<\/pre>\n<\/li>\n<li>Add the following lines to the file.\n<div class=\"line\">alias bond0 bonding<\/div>\n<div class=\"line\">\u00a0options bond0 miimon=80 mode=4<\/div>\n<table class=\"list\">\n<caption><strong>TABLE4<\/strong>\u00a0\u2013 <em>bonding.conf options<\/em><\/caption>\n<tbody>\n<tr>\n<th>bond0<\/th>\n<td>Name of the bonded interface being created.<\/td>\n<\/tr>\n<tr>\n<th>miimon<\/th>\n<td>Defines how often, in milli-seconds, the interface is checked to see if it is still active.<\/td>\n<\/tr>\n<tr>\n<th>mode<\/th>\n<td>Type of bond being created.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/li>\n<li>Save your changes and exit the text editor.<\/li>\n<\/ol>\n<h2>Restart the Network Services<\/h2>\n<p>Our bond is created. It\u2019s time to restart the network services to apply our configuration.<\/p>\n<ol>\n<li>Restart the sevices\n<pre class=\"bash\">services network restart<\/pre>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Overview <\/p>\n<p>Bonding is the ability to take two or more network interfaces and present them as one to a client. Depending on the method you use, the bond can create different types of connections. You can, for example, create an aggregate channel to double or even triple your total bandwidth; create a fault tolerant connections [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6499"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6499"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6499\/revisions"}],"predecessor-version":[{"id":6500,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6499\/revisions\/6500"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6499"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}