epcim
8/8/2016 - 12:34 PM

configure vlan ubuntu (kvm,vlan)

configure vlan ubuntu (kvm,vlan)


# for KVM
# https://raymii.org/s/tutorials/KVM_with_bonding_and_VLAN_tagging_setup_on_Ubuntu_12.04.html
# https://forum.proxmox.com/threads/vlan-tagging-from-inside-kvm-guest-issues.16152/#post-83102
# http://www.ibm.com/support/knowledgecenter/linuxonibm/liaat/liaatkvmsecconfvlans.htm

sudo apt-get install -y vlan
sudo  sh -c 'grep -q 8021q /etc/modules || echo 8021q >> /etc/modules'
modprobe 8021q

VLAN=110
sudo vconfig add eth0 $VLAN

cat <<-EOF >> /etc/network/interfaces

auto eth0.$VLAN
iface eth0.$VLAN inet static
    vlan-raw-device eth0
    # address
    # netmask

EOF

sudo ip link set up eth0.$VLAN