User Tools

Site Tools


ubuntu_network_configuration

Ubuntu Network Configuration

Examples for configuring network interfaces on Ubuntu server.

Ubuntu 14.04 LTS and 16.04 LTS

Bridged configs need bridge-utils installed, bonded configs need ifenslave. Ubuntu 16.04 uses a single config file for each network interface in /etc/network/interfaces.d/.

DHCP

 auto eth0
 iface eth0 inet dhcp

STATIC

auto eth0
iface eth0 inet static
        address 128.111.84.100
        netmask 255.255.255.128
        network 128.111.84.0
        broadcast 128.111.84.127
        gateway 128.111.84.1
        dns-nameservers 128.111.84.18 128.111.84.19 128.111.1.2
        dns-search nceas.ucsb.edu

Bridged

Eth0 bridged for use with KVM.

auto br0
iface br0 inet static
        address 128.111.84.100
        netmask 255.255.255.128
        network 128.111.84.0
        broadcast 128.111.84.127
        gateway 128.111.84.1
        dns-nameservers 128.111.84.18 128.111.84.19 128.111.1.2
        dns-search nceas.ucsb.edu
        bridge_ports eth0
        bridge_fd 9
        bridge_hello 2
        bridge_maxage 12
        bridge_stp off

Bonded

# The primary network interface
auto bond0
iface bond0 inet static
        address 128.111.84.11
        netmask 255.255.255.128
        network 128.111.84.0
        broadcast 128.111.84.127
        gateway 128.111.84.1
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 128.111.84.18 128.111.84.19 128.111.1.2
        dns-search nceas.ucsb.edu
        bond-mode 802.3ad
        bond-miimon 100
        bond-lacp-rate 1
        bond-slaves p1p1 p1p2

auto p1p1
iface p1p1 inet manual
        bond-master bond0

auto p1p2
iface p1p2 inet manual
        bond-master bond0

Bridged and Bonded

auto bond0
iface bond0 inet manual
        bond-mode 802.3ad
        bond-miimon 100
        bond-lacp-rate 1
        bond-slaves p1p1 p1p2

auto p1p1
iface p1p1 inet manual
        bond-master bond0

auto p1p2
iface p1p2 inet manual
        bond-master bond0

auto br0
iface br0 inet static
        address 128.111.84.12
        netmask 255.255.255.128
        network 128.111.84.0
        broadcast 128.111.84.127
        gateway 128.111.84.1
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 128.111.84.18 128.111.84.19 128.111.1.2
        dns-search nceas.ucsb.edu
        bridge_ports bond0
        bridge_fd 9
        bridge_hello 2
        bridge_maxage 12
        bridge_stp off

Ubuntu 12.04 LTS

Bridged configs need bridge-utils installed, bonded configs need ifenslave.

DHCP

 auto eth0
 iface eth0 inet dhcp

STATIC

auto eth0
iface eth0 inet static
        address 128.111.220.100
        netmask 255.255.255.0
        network 128.111.220.0
        broadcast 128.111.220.255
        gateway 128.111.220.1
        dns-nameservers 128.111.220.18 128.111.220.16 128.111.1.2
        dns-search nceas.ucsb.edu

Bridged

Eth0 bridged for use with KVM.

auto br0
iface br0 inet static
        address 128.111.220.100
        netmask 255.255.255.0
        network 128.111.220.0
        broadcast 128.111.220.255
        gateway 128.111.220.1
        dns-nameservers 128.111.220.18 128.111.220.16 128.111.1.2
        dns-search nceas.ucsb.edu
        bridge_ports eth0
        bridge_fd 9
        bridge_hello 2
        bridge_maxage 12
        bridge_stp off

Bonded

Two NICs (eth0 and eth3) bonded with LACP. Switch ports must be configured with LACP.

auto bond0
iface bond0 inet static
        address 128.111.220.100
        netmask 255.255.255.0
        network 128.111.220.0
        broadcast 128.111.220.255
        gateway 128.111.220.1
        dns-nameservers 128.111.220.18 128.111.220.16 128.111.1.2
        dns-search nceas.ucsb.edu
        bond-slaves none
        bond-mode 4
        bond-miimon 100

auto eth0
iface eth0 inet manual
        bond-master bond0
        bond-primary eth0 eth3

auto eth3
iface eth3 inet manual
        bond-master bond0
        bond-primary eth0 eth3

Bonded and Bridged

Four interfaces (eth0, 1, 4, 5) bonded with LACP, then bridged for KVM. Switch must be configured with LACP.

auto bond0
iface bond0 inet manual
        bond-slaves none
        bond-mode 4
        bond-miimon 100

auto eth0
iface eth0 inet manual
        bond-master bond0
        bond-primary eth0 eth1 eth4 eth5

auto eth1
iface eth1 inet manual
        bond-master bond0
        bond-primary eth0 eth1 eth4 eth5

auto eth4
iface eth4 inet manual
        bond-master bond0
        bond-primary eth0 eth1 eth4 eth5

auto eth5
iface eth5 inet manual
        bond-master bond0
        bond-primary eth0 eth1 eth4 eth5

auto br0
iface br0 inet static
        address 128.111.220.100
        netmask 255.255.255.0
        network 128.111.220.0
        gateway 128.111.220.1
        broadcast 128.111.220.255
        dns-nameservers 128.111.220.18 128.111.220.16 128.111.1.2
        dns-search nceas.ucsb.edu
        bridge_ports bond0
        bridge_fd 0
        bridge_maxwait 0
ubuntu_network_configuration.txt ยท Last modified: 2016/03/23 10:30 by brand