Network configuration

From wiki.techunit.org
Jump to: navigation, search

Debian/Ubuntu

DHCP

  • Edit /etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

Static IP

allow-hotplug eth0
iface eth0 inet static
        address 192.168.0.1
        network 192.168.0.0
        netmask 255.255.255.0
        broadcast 192.168.0.255
        gateway 192.168.0.254
        dns-namesevers 192.168.0.254 192.168.4.1 
        dns-search example.com

NetworkManager

  • Edit /etc/NetworkManager/NetworkManager.conf

Disable dnsmasq

  • Comment the line : #dns=dnsmasq

Allow networking to handle configuration

  • Replace as follow
[ifupdown]
#managed=false
managed=true

Bridge

  • Install bridge-utils
aptitude install bridge-utils -y

Bridge on physical interface

  • Configure a bridge on eth0, edit /etc/network/interfaces
allow-hotplug eth0
auto eth0
iface eth0 inet manual

auto eth1
iface eth1 inet manual

auto br0
iface br0 inet static
        address 192.168.0.1
        network 192.168.0.0
        netmask 255.255.255.0
        broadcast 192.168.0.255
        gateway 192.168.0.254
        bridge_ports eth0
        #Possible to bridge multiple interfaces
        #bridge_ports eth1
        bridge_fd 9
        bridge_fd 0
        bridge_maxwait 0
        bridge_hello 2
        bridge_maxage 12
        bridge_stp off

Bridge on dummy interface

  • Enable dummy
modprobe dummy
  • Edit /etc/network/interfaces
auto dummy0
iface dummy0 inet manual

auto lab0
iface lab0 inet static
        bridge_ports dummy0
        address 10.2.0.254
        netmask 255.255.255.0
        broadcast 10.2.0.255
        bridge_stp off
        bridge_fd 0
        bridge_maxwait 0
        bridge_hello 2
        bridge_maxage 12

#----------------------------
#Also possible to create multiple interface
auto lab1
iface lab1 inet static
        bridge_ports dummy0
        address 10.2.1.254
        netmask 255.255.255.0
        broadcast 10.2.1.255
        bridge_stp off
        bridge_fd 0
        bridge_maxwait 0
        bridge_hello 2
       	bridge_maxage 12

Bonding

  • Install packages ifenslave and vlan
  • Edit /etc/network/interfaces
auto eth0
iface eth0 inet manual

auto eth1
iface eth1 inet manual

auto bond0
iface bond0 inet manual
        bond_mode 802.3ad
        slaves eth0 eth1

#VLAN 100
auto bond0.100
iface bond0.100 inet static
        vlan-raw-device bond0
        address 10.0.0.1
        netmask 255.255.255.0
        gateway 10.0.0.254

Elliot
techUnit's cofounder