nginx dedicated v4 AND v6 ip

This is what I've just done to set it up on my debian server:

Code:
root@debian:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 4c:72:b9:7b:b2:75 
          inet addr:5.135.187.99  Bcast:5.135.187.255  Mask:255.255.255.0
          inet6 addr: fe80::4e72:b9ff:fe7b:b275/64 Scope:Link
          inet6 addr: 2001:41d0:8:c463::1/128 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:54461556 errors:0 dropped:0 overruns:0 frame:0
          TX packets:30068205 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:79657650551 (74.1 GiB)  TX bytes:6712301618 (6.2 GiB)
          Interrupt:20 Memory:fe500000-fe520000

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:18560 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18560 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:9410524 (8.9 MiB)  TX bytes:9410524 (8.9 MiB)

root@debian:~# /sbin/ip -6 addr add 2001:41d0:8:c463::2/128 dev eth0
root@debian:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 4c:72:b9:7b:b2:75 
          inet addr:5.135.187.99  Bcast:5.135.187.255  Mask:255.255.255.0
          inet6 addr: fe80::4e72:b9ff:fe7b:b275/64 Scope:Link
          inet6 addr: 2001:41d0:8:c463::2/128 Scope:Global
          inet6 addr: 2001:41d0:8:c463::1/128 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:54461676 errors:0 dropped:0 overruns:0 frame:0
          TX packets:30068295 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:79657665595 (74.1 GiB)  TX bytes:6712314066 (6.2 GiB)
          Interrupt:20 Memory:fe500000-fe520000

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:18560 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18560 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:9410524 (8.9 MiB)  TX bytes:9410524 (8.9 MiB)

different server:
Code:
root@ny1:~# ping6 2001:41d0:8:c463::2
PING 2001:41d0:8:c463::2(2001:41d0:8:c463::2) 56 data bytes
64 bytes from 2001:41d0:8:c463::2: icmp_seq=1 ttl=53 time=1022 ms
64 bytes from 2001:41d0:8:c463::2: icmp_seq=2 ttl=53 time=79.9 ms
64 bytes from 2001:41d0:8:c463::2: icmp_seq=3 ttl=53 time=79.9 ms
64 bytes from 2001:41d0:8:c463::2: icmp_seq=4 ttl=53 time=79.9 ms
64 bytes from 2001:41d0:8:c463::2: icmp_seq=5 ttl=53 time=79.9 ms
^C
--- 2001:41d0:8:c463::2 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4004ms
rtt min/avg/max/mdev = 79.913/268.496/1022.757/377.130 ms, pipe 2

Code:
server {
    listen       5.135.187.99:80;
    listen       [2001:41d0:8:c463::2]:80;
    server_name  test.mattwservices.co.uk;

AAAA record added
upload_2014-5-28_10-28-7.webp

Code:
root@ny1:/etc/nginx/conf.d# ping6 test.mattwservices.co.uk
PING test.mattwservices.co.uk(2001:41d0:8:c463::2) 56 data bytes
64 bytes from 2001:41d0:8:c463::2: icmp_seq=1 ttl=53 time=79.8 ms
64 bytes from 2001:41d0:8:c463::2: icmp_seq=2 ttl=53 time=79.9 ms
64 bytes from 2001:41d0:8:c463::2: icmp_seq=3 ttl=53 time=80.0 ms

upload_2014-5-28_10-29-10.webp
 
Mine did say nginx/1.6.0 - but now it's nginx/1.7.1.
Found the official nginx mainline repository. :D
Screen Shot 2014-05-28 at 5.17.12 AM.webp

Now it's time to see how well it works and if no problems I'll kick the other sites over to mainline.
 
Adam, you don't need individual IPs for SSL anymore. Nginx supports SNI which means you can have multiple sites running SSL on the same address.
For logging and other reasons, I would prefer to have dedicated IP's for each domain.

I have both .com and .eu working. It's only .net that is an issue at the moment and I don't know exactly why....
 
For logging and other reasons, I would prefer to have dedicated IP's for each domain.

I have both .com and .eu working. It's only .net that is an issue at the moment and I don't know exactly why....
Want me to take a quick look?
 
Want me to take a quick look?
I'm likely going to regret turning down your offer, but I really want to learn this.

Your post gave me some clues and it got the .com working.

I have no errors and everything seems to be working, but when I type in the IP for the .net I go nowhere. So I'm a little puzzled, but not given up just yet
 
I'm likely going to regret turning down your offer, but I really want to learn this.

Your post gave me some clues and it got the .com working.

I have no errors and everything seems to be working, but when I type in the IP for the .net I go nowhere. So I'm a little puzzled, but not given up just yet
You do know the .net has the IPv6 commented out?

Code:
server {
         listen       xxx.xxx.xxx.xxx:80;
         #listen       [::]:80 ipv6only=off;
         server_name  sociallyuncensored.net;
 
You do know the .net has the IPv6 commented out?

Code:
server {
         listen       xxx.xxx.xxx.xxx:80;
         #listen       [::]:80 ipv6only=off;
         server_name  sociallyuncensored.net;
:eek: o_O :ROFLMAO::coffee::coffee: :eek: :ROFLMAO:

The greatest error is still the one between user and keyboard. It plagues even the best of us.

Odd... I was editing this manually on my local PC and my FTP program even asked me, did I want to upload the new version (it ask me that anytime I save) and I said, yes. :confused: Clearly I need to not trust that feature and should manually upload it. o_O

Everything is working now. :)
 
:eek: o_O :ROFLMAO::coffee::coffee: :eek: :ROFLMAO:

The greatest error is still the one between user and keyboard. It plagues even the best of us.

Odd... I was editing this manually on my local PC and my FTP program even asked me, did I want to upload the new version (it ask me that anytime I save) and I said, yes. :confused: Clearly I need to not trust that feature and should manually upload it. o_O

Everything is working now. :)
Or edit it directly on the server ;)
 
Well this is NOT working like I thought it was. :(

I rebooted and noticed nginx did not start up. The reason being this;

PHP:
nginx: [emerg] bind() to [2604:4600:b01:6127:223:7dff:fe50:c515]:80 failed (99: Cannot assign requested address)
nginx: configuration file /etc/nginx/nginx.conf test failed

When I commented out that from the config the other site also had the same issue

PHP:
nginx: [emerg] bind() to [2604:4600:b01:6127:223:7dff:fe50:c516]:80 failed (99: Cannot assign requested address)
nginx: configuration file /etc/nginx/nginx.conf test failed

Seems this works ONLY on my .eu site. No idea why. Really hating niginx at the moment... I had no problem doing this with Apache.
 
You might need to specify the additional address in the /etc/network/interfaces to make it stick after a reboot

#IPV6 configuration
auto eth0:3
iface eth0:3 inet6 static
pre-up modprobe ipv6
address 2604:4600:b01:6127::10
netmask 64
gateway 2604:4600:b01:6127::1

add:
# Start IPv6 secondary additional IP configuration
up /sbin/ifconfig eth0 inet6 add 2604:4600:b01:6127:223:7dff:fe50:c515/64
up /sbin/ifconfig eth0 inet6 add 2604:4600:b01:6127:223:7dff:fe50:c516/64
 
I had to add this into my CentOS box eth0 config

Rich (BB code):
IPV6INIT=yes
IPV6_AUTOCONF=no
IPV6ADDR=2001:41D0:1:8B0f::1/64
IPV6ADDR_SECONDARIES="2001:41d0:1:8b0f::2/64 \
2001:41d0:1:8b0f::3/64 \
2001:41d0:1:8b0f::4/64"
 
You might need to specify the additional address in the /etc/network/interfaces to make it stick after a reboot

#IPV6 configuration
auto eth0:3
iface eth0:3 inet6 static
pre-up modprobe ipv6
address 2604:4600:b01:6127::10
netmask 64
gateway 2604:4600:b01:6127::1

add:
# Start IPv6 secondary additional IP configuration
up /sbin/ifconfig eth0 inet6 add 2604:4600:b01:6127:223:7dff:fe50:c515/64
up /sbin/ifconfig eth0 inet6 add 2604:4600:b01:6127:223:7dff:fe50:c516/64
Should I also add;

up /sbin/ifconfig eth0 inet6 add 2604:4600:b01:6127:223:7dff:fe50:c517/64

^ Strangely enough that one always works, even though I personally never listed it. But would it do any harm in adding it anyways?
 
You might need to specify the additional address in the /etc/network/interfaces to make it stick after a reboot

#IPV6 configuration
auto eth0:3
iface eth0:3 inet6 static
pre-up modprobe ipv6
address 2604:4600:b01:6127::10
netmask 64
gateway 2604:4600:b01:6127::1

add:
# Start IPv6 secondary additional IP configuration
up /sbin/ifconfig eth0 inet6 add 2604:4600:b01:6127:223:7dff:fe50:c515/64
up /sbin/ifconfig eth0 inet6 add 2604:4600:b01:6127:223:7dff:fe50:c516/64
added this, restarted the network, uncommented my config, and still get this

PHP:
nginx: [emerg] bind() to [2604:4600:b01:6127:223:7dff:fe50:c516]:80 failed (99: Cannot assign requested address)
nginx: configuration file /etc/nginx/nginx.conf test failed
 
PHP:
route -6
Kernel IPv6 routing table
Destination                    Next Hop                   Flag Met Ref Use If
2604:4600:b01:6127::/64        ::                         U    256 0     1 eth0
2604:4600:b01:6137::/64        ::                         UAe  256 0     0 eth0
fe80::/64                      ::                         U    256 0     0 eth0
::/0                           2604:4600:b01:6127::1      UG   1024 3     0 eth0
::/0                           ::                         !n   -1  1   332 lo
::1/128                        ::                         Un   0   1    11 lo
2604:4600:b01:6127::10/128     ::                         Un   0   1     0 lo
2604:4600:b01:6127:223:7dff:fe50:c517/128 ::                         Un   0   3   514 lo
2604:4600:b01:6137:223:7dff:fe50:c517/128 ::                         Un   0   1   135 lo
fe80::223:7dff:fe50:c517/128   ::                         Un   0   1   148 lo
ff00::/8                       ::                         U    256 0     0 eth0
::/0                           ::                         !n   -1  1   332 lo

PHP:
ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:23:7d:50:c5:17 
          inet addr:23.239.64.40  Bcast:23.239.64.63  Mask:255.255.255.192
          inet6 addr: 2604:4600:b01:6127::10/64 Scope:Global
          inet6 addr: 2604:4600:b01:6127:223:7dff:fe50:c517/64 Scope:Global
          inet6 addr: fe80::223:7dff:fe50:c517/64 Scope:Link
          inet6 addr: 2604:4600:b01:6137:223:7dff:fe50:c517/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:26094 errors:0 dropped:0 overruns:0 frame:0
          TX packets:24477 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5227489 (5.2 MB)  TX bytes:26903049 (26.9 MB)
          Interrupt:19 Memory:f0180000-f01a0000

PHP:
ip -6 neighbor show dev eth0
fe80::20c:cfff:fe9a:6000 lladdr 00:0c:cf:9a:60:00 router STALE
2604:4600:b01:6127::1 lladdr 00:0c:cf:9a:60:00 router REACHABLE

So the magic number seems to be
2604:4600:b01:6127:223:7dff:fe50:c517

Because no matter if that is in the configuration or not, it works.... Go figure....

At this point I would gladly abandon the idea of each site having a dedicated IP and have all my sites share that 1 IP, except nginx tells me this error if I do

PHP:
nginx: [emerg] duplicate listen options for [2604:4600:b01:6127:223:7dff:fe50:c517]:80 in /etc/nginx/conf.d/sociallyuncensored_net.conf:3
nginx: configuration file /etc/nginx/nginx.conf test failed

WTF?! :cry::mad::cry::coffee::coffee::coffee::coffee::coffee::rolleyes::cry:
 
I had to add this into my CentOS box eth0 config

Rich (BB code):
IPV6INIT=yes
IPV6_AUTOCONF=no
IPV6ADDR=2001:41D0:1:8B0f::1/64
IPV6ADDR_SECONDARIES="2001:41d0:1:8b0f::2/64 \
2001:41d0:1:8b0f::3/64 \
2001:41d0:1:8b0f::4/64"
Thanks, but this didn't work either :(
 
Back
Top Bottom