====== Ubuntu Network Config ======
Ubuntu uses ''/etc/network/interfaces'' for all the network definitions.
This is valid for Ubuntu prior to Ubuntu 18.04, for networking in 18.04, see page on [[linux:ubuntu1804netplan|Ubuntu 18.04 Netplan]]
===== Static =====
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.110.16
netmask 255.255.255.0
network 192.168.110.0
broadcast 192.168.110.255
gateway 192.168.110.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 192.168.1.10 192.168.1.11
dns-search example.com
===== DHCP =====
# The primary network interface
auto eth1
iface eth1 inet dhcp
===== Bonding =====
Needs ifenslave package.
# The primary network interface
auto bond0
iface bond0 inet static
bond-mode active-backup
Also
bond-mode broadcast
bond-miimon 100
bond-slaves none
bond-primary eth0
address 192.168.20.11
gateway 192.168.20.1
netmask 255.255.255.0
dns-nameservers 192.168.20.5 192.168.1.10 192.168.110.11
dns-search subnet1.example.com subnet2.example.com
auto eth0
iface eth0 inet manual
bond-master bond0
auto eth1
iface eth1 inet manual
bond-master bond0
==== Monitoring ====
/proc contains data about the state of the bond and the slaves, most useful is probably to see which slave is avtive in an active/passive setup.
[root@server01 ~]# cat /proc/net/bonding/bond0
Primary Slave: None
Currently Active Slave: eth1
==== Changing active interface ====
[root@server01 ~]# ifenslave –change-active bond0 eth0
===== VLAN driver =====
This requires the 802.1q module to talk to the Cisco switch but does not require special switch config and works across switches (unlike LCAP):-
# modprobe 8021q
auto eth1
iface eth1 inet static
address 1.1.1.10
netmask 255.255.255.0
auto eth1.2
iface eth1.2 inet static
address 2.2.2.10
netmask 255.255.255.0
auto eth1.3
iface eth1.3 inet static
address 3.3.3.10
netmask 255.255.255.0
auto eth1.100
iface eth1.100 inet static
address 100.100.100.10
netmask 255.255.255.0
auto eth1.220
iface eth1.220 inet static
address 220.220.220.10
netmask 255.255.255.0
Setting trunk mode on IOS
interface GigabitEthernet0/24
switchport trunk encapsulation dot1q
switchport mode trunk
speed 1000
duplex full
===== Bonding with VLAN driver and bridging =====
No specific switch config is required for this, but the switch ports need to be trunks not access ports.
auto bond0
iface bond0 inet manual
bond-mode active-backup
# bond-mode broadcast
# bond-mode balance-rr
bond-miimon 100
bond-slaves none
auto eth1
iface eth1 inet manual
bond-master bond0
auto eth3
iface eth3 inet manual
bond-master bond0
#auto bond0
#iface bond0 inet static
#address 1.1.1.10
#netmask 255.255.255.0
auto bond0.2
iface bond0.2 inet static
address 2.2.2.10
netmask 255.255.255.0
auto bond0.3
iface bond0.3 inet static
address 3.3.3.10
netmask 255.255.255.0
auto bond0.100
iface bond0.100 inet static
address 100.100.100.10
netmask 255.255.255.0
auto bond0.220
iface bond0.220 inet manual
auto br220
iface br220 inet static
bridge-ports bond0.220
address 220.220.220.10
netmask 255.255.255.0
Add new bridge with
# brctl addbr br220
# brctl show
bridge name bridge id STP enabled interfaces
br220 8000.0025909243d5 no bond0.220
#
On new server:
apt-get update
# it was failing to download some packages, then)
# rm -rf /var/lib/apt/lists/*
apt-get update
apt-get install vlan