VLAN + Network Binding and bonding

Fra SemarkIT
Skift til: Navigation, Søgning

modprobe 8021q
apt-get install vlan ifenslave-2.6 ifmetric bridge-utils
vconfig set_name_type VLAN_PLUS_VID_NO_PAD
vconfig add ethXX XXX

Hvor XXX er det VLANID som vlanet skal have

nu kan man i /etc/networks/interfaces sætte VLAN "kortet" op som man plejer.

eg:

auto vlanXXX
iface vlanXXX inet static
       address 10.10.10.12
       netmask 255.255.0.0
       network 10.10.0.0
       broadcast 10.10.255.255
       gateway 10.10.0.1
       dns-search example.local
       dns-nameservers 10.10.0.2
       vlan_raw_device ethXX

Man kan også binde netkort sammen på denne måde

auto bond0
iface bond0 inet static # manual kan blive brugt her, hvis eth0 og eth1 allerede er konfigureret, ellers bruges manual
       address 10.10.10.12
       netmask 255.255.0.0
       network 10.10.0.0
       broadcast 10.10.255.255
       gateway 10.10.0.1
       dns-search example.local
       dns-nameservers 10.10.0.2
       slaves eth1 eth0

LACP - also know as Link Aggregation can be done like this.

My server has 4x 10GB interfaces, called peth{0,1,2,3} they are all configured to "manual" now to set up LACP between them

# Setting up Link Aggregation
auto bond0
iface bond0 inet manual
        bond-mode 802.3ad
        bond-miimon 100
        bond-downdelay 200
        bond-updelay 200
        bond-lacp-rate 1
        bond-xmit-hash-policy layer2+3
        bond-slaves peth0 peth1 peth2 peth3

Here I set the bond to manual, because I want to use it for a bridge later on to run KVM clients to, but if you don't need that, just set it to static or dhcp and do as you normally would.

Now it's time to setup the bridge.

# Setting up bridge for KVM to connect to
auto br0

iface br0 inet dhcp
    bridge_ports bond0
    bridge_stp on
    bridge_waitport 0
    bridge_fd 0


You can even create VLAN's to both the bridge and bond if you want

auto vlanXXX
iface vlanXXX inet static
       address 10.10.10.12
       netmask 255.255.0.0
       network 10.10.0.0
       broadcast 10.10.255.255
       gateway 10.10.0.1
       dns-search example.local
       dns-nameservers 10.10.0.2
       vlan_raw_device bond0
       #vlan_raw_device br0

The ifmetric package

The ifmeric package enables us to manipulate metrics of routes a posteriori even for DHCP.

The following sets the eth0 interface to be preferred over the wlan0 interface.

  • Install the ifmetric package.
  • Add an option line with "metric 0" just below the "iface eth0 inet dhcp" line.
  • Add an option line with "metric 1" just below the "iface wlan0 inet dhcp" line.

The metric 0 means the highest priority route and is the default one. The larger metric value means lower priority routes. The IP address of the active interface with the lowest metric value becomes the originating one. See ifmetric(8).

Personlige værktøjer
Navnerum

Varianter
Handlinger
Navigation
Værktøjer