R
R
ReD2018-03-30 16:49:05
linux
ReD, 2018-03-30 16:49:05

Why do IPv6 connections happen?

Please help me understand why the server has IPv6 connections:

lsof -i 6              
apache2   473 www-data   17u  IPv6 3092520158 0t0  TCP 192.168.0.5:http->37-9-113-131.spider.yandex.com:60114 (ESTABLISHED)
apache2   571 www-data   17u  IPv6 3092515738  0t0  TCP 192.168.0.5:http->crawl-66-249-66-94.googlebot.com:46298 (ESTABLISHED)

While only a private IPv4 address is registered on the network interface and
the interface has only a link-local IPv6 address that is not routable to the Internet:
ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: [email protected]: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 7e:9a:d6:eb:5d:84 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.5/24 brd 192.168.0.255 scope global vlan9
       valid_lft forever preferred_lft forever
    inet6 fe80::7c9a:d6ff:feeb:5d84/64 scope link 
       valid_lft forever preferred_lft forever

In addition, the server itself is located in the DMZ, behind the firewall.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
jcmvbkbc, 2018-03-31
@jcmvbkbc

why does the server have IPv6 connections

most likely because the application, in this case Apache, is using an IPv4-mapped IPv6 address .
You can look in /proc/net/tcp6, where these addresses look like this:
sl  local_address                         remote_address                        st tx_queue rx_queue tr tm->when retrnsmt   uid  timeout inode
14: 0000000000000000FFFF00001F44CB0A:A5A2 0000000000000000FFFF00004B44CB0A:06B4 01 00000000:00000000 02:000000F6 00000000  1000        0 20787517 2 ffff8e7add433800 20 4 1 10 -1

those. The 96 most significant bits of the address are ::FFFF:0:0, the 32 least significant bits are the normal IPv4 address.
Here is a sample code that, when compiled and run, opens an ipv6 socket that can be connected to on both ipv4 and ipv6:
$ ./ipv6 &
$ nc 127.0.0.1 13330 &
$ lsof -i6
ipv6      18422 jcmvbkbc    3u  IPv6 21018438      0t0  TCP *:13330 (LISTEN)
ipv6      18422 jcmvbkbc    4u  IPv6 21018439      0t0  TCP localhost:13330->localhost:36196 (ESTABLISHED)

R
Ruslan Fedoseev, 2018-03-30
@martin74ua

Eee. Doesn't it bother you that the connection is established with the server's ipv4 address?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question