Skip to content

Instantly share code, notes, and snippets.

@dmuth
Created June 2, 2013 22:38
Show Gist options
  • Save dmuth/5695205 to your computer and use it in GitHub Desktop.
Save dmuth/5695205 to your computer and use it in GitHub Desktop.
/etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
#
# The :1 address is just for testing and stuff
#
up /sbin/ip -6 addr add 2600:3c02:e000:d::1/64 dev eth0
down /sbin/ip -6 addr del 2600:3c02:e000:d::1/64 dev eth0
#
# My webservers start with ::100 and go up from there
#
up /sbin/ip -6 addr add 2600:3c02:e000:d::100/64 dev eth0
down /sbin/ip -6 addr del 2600:3c02:e000:d::100/64 dev eth0
up /sbin/ip -6 addr add 2600:3c02:e000:d::101/64 dev eth0
down /sbin/ip -6 addr del 2600:3c02:e000:d::101/64 dev eth0
up /sbin/ip -6 addr add 2600:3c02:e000:d::102/64 dev eth0
down /sbin/ip -6 addr del 2600:3c02:e000:d::102/64 dev eth0
up /sbin/ip -6 addr add 2600:3c02:e000:d::103/64 dev eth0
down /sbin/ip -6 addr del 2600:3c02:e000:d::103/64 dev eth0
up /sbin/ip -6 addr add 2600:3c02:e000:d::104/64 dev eth0
down /sbin/ip -6 addr del 2600:3c02:e000:d::105/64 dev eth0
up /sbin/ip -6 addr add 2600:3c02:e000:d::105/64 dev eth0
down /sbin/ip -6 addr del 2600:3c02:e000:d::105/64 dev eth0
up /sbin/ip -6 addr add 2600:3c02:e000:d::106/64 dev eth0
down /sbin/ip -6 addr del 2600:3c02:e000:d::106/64 dev eth0
up /sbin/ip -6 addr add 2600:3c02:e000:d::107/64 dev eth0
down /sbin/ip -6 addr del 2600:3c02:e000:d::107/64 dev eth0
up /sbin/ip -6 addr add 2600:3c02:e000:d::108/64 dev eth0
down /sbin/ip -6 addr del 2600:3c02:e000:d::108/64 dev eth0
up /sbin/ip -6 addr add 2600:3c02:e000:d::109/64 dev eth0
down /sbin/ip -6 addr del 2600:3c02:e000:d::109/64 dev eth0
#
# This is here because otherwise when nginx starts at boot, the IPv6
# interface is marked as "tentative" until it finishes initializing,
# which will cause Nginx to bomb with this error:
#
# nginx: [emerg] bind() to [2600:3c02:e000:d::104]:443 failed (99: Cannot assign requested address)
#
# Ooops!
#
# So what we're going to do instead is wait until the IPv6 interfaces
# finish coming up.
#
# More info at these URLs:
#
# http://serverfault.com/questions/421460/nginx-failed-to-start-cannot-assign-requested-address
# http://pyro.eu.org/how-to/micro/nginx-cannot-assign-requested-address-ipv6.txt
#
post-up while ip -6 addr show tentative | grep . > /dev/null ; do sleep 1 ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment