Uploaded by met met

bonding

advertisement
If you are looking for network card redundancy you can start by confguring network bonding on
your Ubuntu Server 12.04 machine. Network cards with network bonding can be joined in multiple
configuration options (active/active, active/backup,…). We will configure our network cards in
“active/backup” configuration. This is a network bonding fallback configuration which means if
one of your network cards fails all of the traffic will be instantly switched to the other, still working
network card.
Configuring network bonding is quick and simple, just follow the steps in this guide!
Network bonding
Requirements:
o
Two network cards available for network bonding
Let’s Configure Network Bonding on
Ubuntu Server 12.04!
1. Install required packages
root@foo1:~# apt-get update
root@foo1:~# apt-get install ifenslave
2. Edit /etc/modules file
Edit /etc/modules file and add “bonding” at the end of it.
root@foo1:~# cat /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
loop
lp
bonding
3. Stop networking
root@foo1:~# /etc/init.d/networking stop
4. Edit /etc/network/interfaces file
Edit /etc/network/interfaces file and configure bonding interface bond0. You also need to change
existing eth interfaces to be known as slaves of bond interface by adding “bond-master bond0” to
their configuration. There are a couple of bond interface options explained below. Mind the bold
text!
root@foo1:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet manual
bond-master bond0
bond-primary eth0
# The secondary network interface
auto eth1
iface eth1 inet manual
bond-master bond0
# Bonding interface configuration
auto bond0
iface bond0 inet static
address 192.168.1.150
netmask 255.255.255.0
gateway 192.168.1.1
bond-slaves eth0 eth1
bond-miimon 100
bond-mode active-backup
5. Modprobe bonding
root@foo1:~# modprobe bonding
6. Start networking
root@foo1:~# /etc/init.d/networking start
7. Check the status of network bonding
As we can see below, bonding was successfully configured in active-backup mode. Slave
interfaces are eth0 and eth1.
root@foo1:~# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: eth0 (primary_reselect always)
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 08:00:27:a8:ab:ab
Slave queue ID: 0
Slave Interface: eth1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 08:00:27:de:fd:85
Slave queue ID: 0
7. Check ifconfig
Again we see that all interfaces are up and running and bond0 interface has the assigned IP address.
Network bonding on Ubuntu Server 12.04 is working as expected.
root@foo1:~# ifconfig
bond0
Link encap:Ethernet HWaddr 08:00:27:a8:ab:ab
inet addr:192.168.61.164 Bcast:192.168.61.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fea8:abab/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:2279 errors:0 dropped:3 overruns:0 frame:0
TX packets:1127 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2557592 (2.5 MB) TX bytes:217603 (217.6 KB)
eth0
Link encap:Ethernet HWaddr 08:00:27:a8:ab:ab
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:2272 errors:0 dropped:0 overruns:0 frame:0
TX packets:1127 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2556425 (2.5 MB) TX bytes:217603 (217.6 KB)
eth1
Link encap:Ethernet HWaddr 08:00:27:a8:ab:ab
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:7 errors:0 dropped:3 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1167 (1.1 KB) TX bytes:0 (0.0 B)
lo
Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:156 errors:0 dropped:0 overruns:0 frame:0
TX packets:156 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:12688 (12.6 KB) TX bytes:12688 (12.6 KB)
How to restart network on Ubuntu 18.04 Bionic
Beaver Linux
Lubos Rendek
Ubuntu 18.04
22 May 2018
Contents

o
o
o
o
1. Objective
2. Operating System and Software Versions
3. Requirements
4. Difficulty
o
o
5. Conventions
6. Instructions
 6.1. Graphical User Interface
 6.2. Command Line
 6.3. netplan
 6.4. systemctl
 6.5. service
 6.6. nmcli
 6.7. System V init
 6.8. ifup/ifdown
Objective
The following article will describe various ways how to restart network from command line as
well as from Graphical User Interface (GUI) on Ubuntu 18.04 Bionic Beaver Linux
Operating System and Software Versions


Operating System: - Ubuntu 18.04 Bionic
Software: - GNOME Desktop
Requirements
Privileged access to is required for GUI network restart
Difficulty
EASY
Conventions


# - requires given linux commands to be executed with root privileges either directly as a root
user or by use of sudo command
$ - requires given linux commands to be executed as a regular non-privileged user
Instructions
Graphical User Interface
Bring up network management window by right-click on the top right corner network icon and
locate the network connection you wish to restart then click on Turn Off .
The Network Icon will disappear. To turn on the network again, left click on the top right corner
arrow down, locate your network interface and click Connect .
Command Line
To restart network from the command line you have the following options:
netplan
$ sudo netplan apply
systemctl
The first command line network restart uses the systemctl command to perform the restart of
network manager.
$ sudo
systemctl restart NetworkManager.service
service
Same as the above can be accomplished with the service command:
$ sudo service network-manager restart
SUBSCRIBE TO NEWSLETTER
Subscribe to Linux Career NEWSLETTER and receive latest Linux news, jobs, career advice and
tutorials.
nmcli
Controlling the Network Manager with the nmcli command will restart the Network Manager
directly:
$ sudo nmcli networking off
$ sudo nmcli networking on
System V init
The old fashioned and now obsolete way using System V init scripts directly is still available on
Ubuntu 18.04 Bionic Beaver Linux:
$ sudo /etc/init.d/networking restart
OR
$ sudo /etc/init.d/network-manager restart
ifup/ifdown
In this last example we will restart the network interface directly using the ifup and ifdown
commands. Note the the -a option will tell the ifup and ifdown commands to restart all
available network interfaces marked as "auto":
$ sudo ifdown -a
$ sudo ifup -a
Download