{"id":974,"date":"2020-06-02T20:10:13","date_gmt":"2020-06-02T20:10:13","guid":{"rendered":"https:\/\/www.nicktailor.com\/?p=974"},"modified":"2022-10-21T11:32:56","modified_gmt":"2022-10-21T11:32:56","slug":"how-to-change-currently-active-slave-interface-of-bonding-online","status":"publish","type":"post","link":"https:\/\/nicktailor.com\/tech-blog\/how-to-change-currently-active-slave-interface-of-bonding-online\/","title":{"rendered":"How to change the currently active slave of a bonded interface"},"content":{"rendered":"<header class=\"entry-header\">\n<h1 class=\"entry-title\">RedHat \/ CentOS :<\/h1>\n<\/header>\n<div class=\"entry-content\">\n<p>Interface Bonding as we all know is very useful in providing the fault tolerance and increased bandwidth. We can change the active slave interface of bonding without interrupting the production work. In the example below we have the interface bonding bond0 with 2 slaves em0 and em1 (em1 being the active slave). We will be replacing slave em0 with new slave em2.<\/p>\n<div class=\"codeme\">\n<pre># cat \/proc\/net\/bonding\/bond0\nEthernet Channel Bonding Driver: v3.7.1 (April 27, 2011)\n\nBonding Mode: fault-tolerance (active-backup)\nPrimary Slave: None\n<strong>Currently Active Slave: em0<\/strong>\nMII Status: up\nMII Polling Interval (ms): 100\nUp Delay (ms): 5000\nDown Delay (ms): 5000\n\nSlave Interface: em0\nMII Status: up\nSpeed: 1000 Mbps\nDuplex: full\nLink Failure Count: 0\nPermanent HW addr: 00:21:28:b2:65:26\nSlave queue ID: 0\n\nSlave Interface: em1\nMII Status: up\nSpeed: 1000 Mbps\nDuplex: full\nLink Failure Count: 0\nPermanent HW addr: 00:21:28:b2:65:27\nSlave queue ID: 0<\/pre>\n<\/div>\n<h2>1. Change the active slave to em1<\/h2>\n<p><strong>ifenslave<\/strong>&nbsp;command can be used to attach or detach or change the currently active slave interface from the bonding. Now, Change the active slave interface to em1.<\/p>\n<div class=\"codeme\">\n<pre># ifenslave -c bond0 em1<\/pre>\n<\/div>\n<p>Check the bonding status again to ensure that em1 is the new active slave :<\/p>\n<div class=\"codeme\">\n<pre># cat \/proc\/net\/bonding\/bond0\nEthernet Channel Bonding Driver: v3.7.1 (April 27, 2011)\n\nBonding Mode: fault-tolerance (active-backup)\nPrimary Slave: None\n<strong>Currently Active Slave: em1<\/strong>\nMII Status: up\nMII Polling Interval (ms): 100\nUp Delay (ms): 5000\nDown Delay (ms): 5000\n\nSlave Interface: em0\nMII Status: up\nSpeed: 1000 Mbps\nDuplex: full\nLink Failure Count: 0\nPermanent HW addr: 00:3b:26:b2:68:26\nSlave queue ID: 0\n\nSlave Interface: em1\nMII Status: up\nSpeed: 1000 Mbps\nDuplex: full\nLink Failure Count: 0\nPermanent HW addr: 00:3b:26:b2:68:27\nSlave queue ID: 0<\/pre>\n<\/div>\n<div class=\"content-box-green\">The switch of active slave should get effective immediately, but on critical production systems, please schedule maintenance window or make some test in an identical test environment first.<\/div>\n<h2>2. Attach the new slave interface<\/h2>\n<p>We can now attach the new slave interface em2 to the bonding.<\/p>\n<div class=\"codeme\">\n<pre># ifenslave bond0 em2<\/pre>\n<\/div>\n<h2>3. Unattach the old slave interface<\/h2>\n<p>Once we have attached a new slave interface, we can unattach the old slave and remove it from the bonding.<\/p>\n<div class=\"codeme\">\n<pre># ifenslave -d bond0 em0<\/pre>\n<\/div>\n<h2>4. Verify<\/h2>\n<p>Confirm that the new slave is now the standby interface in the bonding.<\/p>\n<div class=\"codeme\">\n<pre># cat \/proc\/net\/bonding\/bond0\nEthernet Channel Bonding Driver: v3.7.1 (April 27, 2011)\n\nBonding Mode: fault-tolerance (active-backup)\nPrimary Slave: None\nCurrently Active Slave: em1\nMII Status: up\nMII Polling Interval (ms): 100\nUp Delay (ms): 5000\nDown Delay (ms): 5000\n\nSlave Interface: em1\nMII Status: up\nSpeed: 1000 Mbps\nDuplex: full\nLink Failure Count: 0\nPermanent HW addr: 00:21:29:bf:55:30\nSlave queue ID: 0\n\nSlave Interface: em2\nMII Status: up\nSpeed: 1000 Mbps\nDuplex: full\nLink Failure Count: 0\nPermanent HW addr: 00:19:1a:d1:43:61\nSlave queue ID: 0<\/pre>\n<\/div>\n<h2>If you want to make the changes more permanent<\/h2>\n<p>The changes we just made, are temporary and will be cleared after a reboot of the server. To make these changes permanent we will have to make few changes.<\/p>\n<p>Make sure you delete the file&nbsp;<strong>\/etc\/sysconfig\/network-scripts\/ifcfg-em0<\/strong>&nbsp;as we are no longer are using this interface in bonding. Create a new file for the new slave interface in the bonding :<\/p>\n<div class=\"codeme\">\n<pre># rm \/etc\/sysconfig\/network-scripts\/ifcfg-em0<\/pre>\n<\/div>\n<div class=\"codeme\">\n<pre># vi \/etc\/sysconfig\/network-scripts\/ifcfg-em2\nDEVICE=em2\nBOOTPROTO=none\nONBOOT=yes\nMASTER=bond0\nSLAVE=yes<\/pre>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>RedHat \/ CentOS : Interface Bonding as we all know is very useful in providing the fault tolerance and increased bandwidth. We can change the active slave interface of bonding without interrupting the production work. In the example below we have the interface bonding bond0 with 2 slaves em0 and em1 (em1 being the active slave). We will be replacing<a href=\"https:\/\/nicktailor.com\/tech-blog\/how-to-change-currently-active-slave-interface-of-bonding-online\/\" class=\"read-more\">Read More &#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[58,138,124],"tags":[],"class_list":["post-974","post","type-post","status-publish","format-standard","hentry","category-centos","category-linux","category-network-stuff"],"_links":{"self":[{"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/posts\/974","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/comments?post=974"}],"version-history":[{"count":10,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/posts\/974\/revisions"}],"predecessor-version":[{"id":1598,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/posts\/974\/revisions\/1598"}],"wp:attachment":[{"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/media?parent=974"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/categories?post=974"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/tags?post=974"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}