Create Bonding, Vlan, Bridge Interface in Ubuntu 18 Using Netplan and networkd
2 min readJul 19, 2020
Recently, my client has requested to make a host setup with network bonding, vlan, and bridge interface configurations. In the host the KVM / QEMU hypervisor is planned to be installed.
The following are some sample configurations that can be applied to netplan using networkd as its renderer. I also included several configurations from the netplan website.
Of course, the configuration below can be adjusted to the desired needs or conditions, hopefully it can help.
Bonding
network:
version: 2
renderer: networkd
bonds:
bond0:
dhcp4: yes
interfaces:
- enp3s0
- enp4s0
parameters:
mode: active-backup
primary: enp3s0network:
version: 2
renderer: networkd
ethernets:
enp1s0:
dhcp4: no
enp2s0:
dhcp4: no
enp3s0:
dhcp4: no
optional: true
enp4s0:
dhcp4: no
optional: true
enp5s0:
dhcp4: no
optional: true
enp6s0:
dhcp4: no
optional: true
bonds:
bond-lan:
interfaces: [enp2s0, enp3s0]
addresses: [192.168.93.2/24]
parameters:
mode: 802.3ad
mii-monitor-interval: 1
bond-wan:
interfaces: [enp1s0, enp4s0]
addresses: [192.168.1.252/24]
gateway4: 192.168.1.1
nameservers:
search: [local]
addresses: [8.8.8.8, 8.8.4.4]
parameters:
mode: active-backup
mii-monitor-interval: 1
gratuitious-arp: 5
bond-conntrack:
interfaces: [enp5s0, enp6s0]
addresses: [192.168.254.2/24]
parameters:
mode: balance-rr
mii-monitor-interval: 1
Vlan
network:
version: 2
renderer: networkd
ethernets:
mainif:
match:
macaddress: "de:ad:be:ef:ca:fe"
set-name: mainif
addresses: [ "10.3.0.5/23" ]
gateway4: 10.3.0.1
nameservers:
addresses: [ "8.8.8.8", "8.8.4.4" ]
search: [ example.com ]
vlans:
vlan15:
id: 15
link: mainif
addresses: [ "10.3.99.5/24" ]
vlan10:
id: 10
link: mainif
addresses: [ "10.3.98.5/24" ]
nameservers:
addresses: [ "127.0.0.1" ]
search: [ domain1.example.com, domain2.example.com ]
Bridge
network:
version: 2
renderer: networkd
ethernets:
enp3s0:
dhcp4: no
bridges:
br0:
dhcp4: yes
interfaces:
- enp3s0network:
version: 2
renderer: networkd
ethernets:
enp0s25:
dhcp4: true
bridges:
br0:
addresses: [ 10.3.99.25/24 ]
interfaces: [ vlan15 ]
vlans:
vlan15:
accept-ra: no
id: 15
link: enp0s25
Bond and Vlan
network:
version: 2
renderer: networkd
bonds:
bond0:
dhcp4: no
addresses: [192.168.254.2/24]
interfaces: [enp0s25, enp0s26]
parameters:
lacp-rate: fast
mode: 802.3ad
transmit-hash-policy: layer2
mii-monitor-interval: 100
routes:
- to: 192.168.254.0/24
via: 192.168.254.1
ethernets:
enp0s25: {}
enp0s26: {}
vlans:
bond0.15:
dhcp4: no
addresses: [10.3.99.25/24]
gateway4: 10.3.99.1
id: 15
link: bond0
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
Bonding, Vlan, Bridge
network:
version: 2
renderer: networkd
bonds:
bond0:
dhcp4: no
interfaces: [enp0s25, enp0s26]
parameters:
lacp-rate: fast
mode: 802.3ad
transmit-hash-policy: layer2
mii-monitor-interval: 100
ethernets:
enp0s25: {}
enp0s26: {}
vlans:
bond0.15:
dhcp4: no
id: 15
link: bond0
bridges:
br0:
addresses: [10.3.99.25/24]
gateway4: 10.3.99.1
interfaces: [bond0.15]
parameters:
stp: false
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
br1:
addresses: [192.168.254.2/24]
interfaces: [bond0]
parameters:
stp: false
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
routes:
- to: 0.0.0.0/0
via: 192.168.254.1
- to: 0.0.0.0/0
via: 10.3.99.1
If you have questions or want to discuss, please leave a comment in the comments column below, see you later.
source :