ipv6 on Debian with Nginx

ipv6 on Debian with Nginx

Matt

Owner
Matt submitted a new resource:

ipv6 on Debian with Nginx - Enable and set up IPv6 on Debian with Nginx

First, make sure nginx is built with IPv6 support
Code:
root@debian:~# nginx -V | grep -w ipv6
nginx version: nginx/1.7.1
built by gcc 4.7.2 (Debian 4.7.2-5)
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp...
Read more about this resource...
 
Last edited:
A

Akia

Guest
How do you get the ip's to stick after a reboot. While this works as soon as the server is rebooted they are gone again.
 

Matt

Owner
I've not actually rebooted mine since setting it up.
Code:
root@debian:/home/scripts# uptime
06:52:07 up 205 days, 12:33,  1 user,  load average: 0.04, 0.08, 0.19
root@debian:/home/scripts#
 
A

Akia

Guest
What do you have in your /etc/network/interfaces file?
Code:
# 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

auto eth0
iface eth0 inet static
    address 94.23.58.156
    netmask 255.255.255.0
    network 94.23.58.0
    broadcast 94.23.58.255
    gateway 94.23.58.254
post-up /sbin/ifconfig eth0:1 5.196.63.61 netmask 255.255.255.255 broadcast 5.196.63.61
pre-down /sbin/ifconfig eth0:1 down
post-up /sbin/ifconfig eth0:2 5.196.63.62 netmask 255.255.255.255 broadcast 5.196.63.62
pre-down /sbin/ifconfig eth0:2 down
post-up /sbin/ifconfig eth0:3 5.196.63.63 netmask 255.255.255.255 broadcast 5.196.63.63
pre-down /sbin/ifconfig eth0:3 down
post-up /sbin/ifconfig eth0:4 5.39.127.36 netmask 255.255.255.255 broadcast 5.39.127.36
pre-down /sbin/ifconfig eth0:4 down
post-up /sbin/ifconfig eth0:5 5.39.127.37 netmask 255.255.255.255 broadcast 5.39.127.37
pre-down /sbin/ifconfig eth0:5 down

iface eth0 inet6 static
    address 2001:41D0:2:3B9c::
    netmask 64
    post-up /sbin/ip -family inet6 route add 2001:41D0:2:3Bff:ff:ff:ff:ff dev eth0
    post-up /sbin/ip -family inet6 route add default via 2001:41D0:2:3Bff:ff:ff:ff:ff
    pre-down /sbin/ip -family inet6 route del default via 2001:41D0:2:3Bff:ff:ff:ff:ff
    pre-down /sbin/ip -family inet6 route del 2001:41D0:2:3Bff:ff:ff:ff:ff dev eth0
 

Matt

Owner
I've specifically added the IP addresses that I want to be available in the inet6 stanza

Code:
iface eth0 inet6 static
        address 2001:41D0:8:C463::1
        netmask 128
        post-up /sbin/ip -f inet6 route add 2001:41D0:8:C4ff:ff:ff:ff:ff dev eth0
        post-up /sbin/ip -f inet6 route add default via 2001:41D0:8:C4ff:ff:ff:ff:ff
        up ip addr add 2001:41d0:8:c463::2 dev eth0
        up ip addr add 2001:41d0:8:c463::3 dev eth0
        pre-down /sbin/ip -f inet6 route del default via 2001:41D0:8:C4ff:ff:ff:ff:ff
        pre-down /sbin/ip -f inet6 route del 2001:41D0:8:C4ff:ff:ff:ff:ff dev eth0
        down ip addr del 2001:41d0:8:c463::2 dev eth0
        down ip addr del 2001:41d0:8:c463::3 dev eth0
 
A

Akia

Guest
well I've tried it everywich way but can't get it to work.

I've tried how you've got it

like this
Code:
iface eth0 inet6 static
    address 2001:41D0:2:3B9c::
    netmask 64
    post-up /sbin/ip -family inet6 route add 2001:41D0:2:3Bff:ff:ff:ff:ff dev eth0
    post-up /sbin/ip -family inet6 route add default via 2001:41D0:2:3Bff:ff:ff:ff:ff
up ip -6 addr add 2001:41d0:2:3b9c::1/64 dev eth0
up ip -6 addr add 2001:41d0:2:3b9c::2/64 dev eth0
up ip -6 addr add 2001:41d0:2:3b9c::3/64 dev eth0
up ip -6 addr add 2001:41d0:2:3b9c::4/64 dev eth0
up ip -6 addr add 2001:41d0:2:3b9c::5/64 dev eth0
    pre-down /sbin/ip -family inet6 route del default via 2001:41D0:2:3Bff:ff:ff:ff:ff
    pre-down /sbin/ip -family inet6 route del 2001:41D0:2:3Bff:ff:ff:ff:ff dev eth0
down ip -6 addr del 2001:41d0:2:3b9c::1/64 dev eth0
down ip -6 addr del 2001:41d0:2:3b9c::2/64 dev eth0
down ip -6 addr del 2001:41d0:2:3b9c::3/64 dev eth0
down ip -6 addr del 2001:41d0:2:3b9c::4/64 dev eth0
down ip -6 addr del 2001:41d0:2:3b9c::5/64 dev eth0
but that still dosn't work
 
A

Akia

Guest
Hmm, I probably shouldn't reboot my debian server then :confused:
this seems to work:

Code:
iface eth0 inet6 static
    address 2001:41D0:2:3B9c::
    netmask 64
post-up ifconfig eth0 inet6 add 2001:41D0:2:3B9c::1/64
post-up ifconfig eth0 inet6 add 2001:41D0:2:3B9c::2/64
post-up ifconfig eth0 inet6 add 2001:41D0:2:3B9c::3/64
post-up ifconfig eth0 inet6 add 2001:41D0:2:3B9c::4/64
post-up ifconfig eth0 inet6 add 2001:41D0:2:3B9c::5/64
    post-up /sbin/ip -family inet6 route add 2001:41D0:2:3Bff:ff:ff:ff:ff dev eth0
    post-up /sbin/ip -family inet6 route add default via 2001:41D0:2:3Bff:ff:ff:ff:ff
    pre-down /sbin/ip -family inet6 route del default via 2001:41D0:2:3Bff:ff:ff:ff:ff
    pre-down /sbin/ip -family inet6 route del 2001:41D0:2:3Bff:ff:ff:ff:ff dev eth0
pre-down ifconfig eth0 inet6 del 2001:41D0:2:3B9c::1/64
pre-down ifconfig eth0 inet6 del 2001:41D0:2:3B9c::2/64
pre-down ifconfig eth0 inet6 del 2001:41D0:2:3B9c::3/64
pre-down ifconfig eth0 inet6 del 2001:41D0:2:3B9c::4/64
pre-down ifconfig eth0 inet6 del 2001:41D0:2:3B9c::5/64
not sure if its right, but it works.
 
Top