Skip to content

Instantly share code, notes, and snippets.

@busterswt
Created May 11, 2016 22:40
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save busterswt/01e706086c6bc6108e66e06fc992d1c0 to your computer and use it in GitHub Desktop.
Save busterswt/01e706086c6bc6108e66e06fc992d1c0 to your computer and use it in GitHub Desktop.
auto eth0
iface eth0 inet manual
auto eth0.40
iface eth0.40 inet static
address 10.240.0.11
netmask 255.255.252.0
vlan-raw-device eth0
gateway 10.240.0.1
dns-nameserver 8.8.8.8
post-up ip a a 10.240.0.10/32 dev eth0.40
# Container management VLAN interface
auto eth0.41
iface eth0.41 inet manual
vlan-raw-device eth0
# OpenStack Networking VXLAN (tunnel/overlay) VLAN interface
auto eth0.42
iface eth0.42 inet manual
vlan-raw-device eth0
# Storage network VLAN interface (optional)
auto eth0.43
iface eth0.43 inet manual
vlan-raw-device eth0
# Container management bridge
auto br-mgmt
iface br-mgmt inet static
bridge_stp off
bridge_waitport 0
bridge_fd 0
# Bridge port references tagged interface
bridge_ports eth0.41
address 172.29.236.11
netmask 255.255.252.0
dns-nameservers 8.8.8.8
post-up ip a a 172.29.236.10/32 dev br-mgmt
# OpenStack Networking VXLAN (tunnel/overlay) bridge
auto br-vxlan
iface br-vxlan inet static
bridge_stp off
bridge_waitport 0
bridge_fd 0
# Bridge port references tagged interface
bridge_ports eth0.42
address 172.29.240.11
netmask 255.255.252.0
# OpenStack Networking VLAN bridge
auto br-vlan
iface br-vlan inet manual
bridge_stp off
bridge_waitport 0
bridge_fd 0
# Bridge port references untagged interface
bridge_ports eth0
# Storage bridge (optional)
auto br-storage
iface br-storage inet static
bridge_stp off
bridge_waitport 0
bridge_fd 0
# Bridge port reference tagged interface
bridge_ports eth0.43
address 172.29.244.11
netmask 255.255.252.0
@jerrycaimin
Copy link

Thanks for share, this is for 172.29.236.11 right, can I use this to config 172.29.236.12~15 with only ip address replaced?

@busterswt
Copy link
Author

Note to readers:

  1. The post-up lines configure the external/internal VIPs on the respective interfaces, and are only needed when using haproxy on the same node.
  2. On a clean Ubuntu install, you may need to load the 8021q module in /etc/modules and install the 'vlan' package before this configuration will work. That may mean you need to configure a vlan-tagged interface using iproute2, download the package, enable the module, lay down the config, and reboot.

The create and bring up the interface, use the following:
# ip link set eth0 up
# ip link add link eth0 name eth0.40 type vlan id 40
# ip link set eth0.40 up
# ip addr add 10.240.0.11/24 dev eth0.40
# ip route add 0.0.0.0/0 via 10.240.0.1

Edit the /etc/resolv.conf file and add a 'nameserver' directive:
Example: nameserver 8.8.8.8

Then download the package:
# apt-get update
# apt-get install vlan

Then enable the module:
# echo '8021q' >> /etc/modules

Lay down the config in /etc/network/interfaces.d/eth0.cfg or /etc/network/interfaces, and reboot:
# reboot

The system should bring up all of the interfaces automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment