ubuntu 18.04 server network bonding

ubuntu 18.04 server network bonding

ubuntu 18.04 hw2018 server network

This is the third post in the server series, since backup and snapshots are working, we can now play safely whith the configuration.

My server is in the same rack as my network switch (see my current hardware list), and since my server has 2 network interfaces and the switch supports 802.3ad link aggregation, it’s possible to double the bandwidth at the cost of a cat5e cable.

Ubuntu 18.04 uses netplan for the network configuration.

As a special bonus, an internal bridge will be configured for the hosting of future virtual machines.

Finding the available network interfaces

Use lshw -class network or ip ip link show to find the network interfaces:

cli@server:~$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:29:6b:da brd ff:ff:ff:ff:ff:ff
3: ens14: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 52:54:00:fc:95:ac brd ff:ff:ff:ff:ff:ff

Here we can see my two network interfaces are named ens3 and ens14

Identifying network interfaces

(Some) Network interfaces can be identified by blinking the leds, using this command :

cli@server:~$ sudo ethtool -p ens3

Leds from the network interface should blink until you press CTRL+C.

bonding configuration

  • 802.3ad bridging may require the network switch to be configured. On my switch I have configured port 23-24 to be in the
  • I use a pseudo-fixed IP addressing scheme, the router is configured to always give a predefined IP address to all fixed network equipement, but there are exceptions, (my router IP is XXX.XXX.XXX.1):
    • The network switch fixed IP: XXX.XXX.XXX.2
    • The server fixed IP: XXX.XXX.XXX.40

Modify /etc/netplan/01-netcfg.yaml:

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
  version: 2
  renderer: networkd
  ethernets:
    bond-ports:
      dhcp4: no
      match:
        name: ens*
  bonds:
    bond0:
      dhcp4: no
      interfaces: [bond-ports]
      parameters:
        mode: 802.3ad
  bridges:
    br0:
      addresses: [XXX.XXX.XXX.40/24]
      gateway4: XXX.XXX.XXX.1
       nameservers:
            addresses: [XXX.XXX.XXX.1]
      interfaces:
        - bond0

Apply

cli@server:~$ sudo netplan apply

Verify #1

cli@server:~$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc fq_codel master bond0 state UP group default qlen 1000
    link/ether 56:ad:d1:ea:20:b4 brd ff:ff:ff:ff:ff:ff
4: ens14: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc fq_codel master bond0 state UP group default qlen 1000
    link/ether 56:ad:d1:ea:20:b4 brd ff:ff:ff:ff:ff:ff
5: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 52:27:fc:79:1f:97 brd ff:ff:ff:ff:ff:ff
    inet XXX.XXX.XXX.40/24 brd XXX.XXX.XXX.255 scope global dynamic br0
       valid_lft 826sec preferred_lft 826sec
    inet6 fe80::5027:fcff:fe79:1f97/64 scope link 
       valid_lft forever preferred_lft forever
6: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue master br0 state UP group default qlen 1000
    link/ether 56:ad:d1:ea:20:b4 brd ff:ff:ff:ff:ff:ff

ens3, ens14, bond0 and br0 are UP, only br0 has got an IP address, perfect.

Verify #2

cli@server:~$ sudo apt-get update
Hit:1 http://ch.archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://security.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB]
Hit:3 http://ch.archive.ubuntu.com/ubuntu bionic-updates InRelease                 
Hit:4 http://ch.archive.ubuntu.com/ubuntu bionic-backports InRelease                
Fetched 83.2 kB in 0s (267 kB/s)                                                    
Reading package lists... Done

Updating packages works, so DNS and internet connectivity are working fine.

The next post will be about playing with RAID.

~~~

Question, remark, bug? Don't hesitate to contact me or report a bug.