1

I have: [ Host A ] -- [ gateway ] -- [ Host B ], whereas A and B are in different subnets.

Gateway configuration:

ip -6 link set enp0s3 up
ip -6 link set enp0s9 up
ip -6 addr flush dev enp0s3
ip -6 addr flush dev enp0s9
ip -6 route flush dev enp0s3
ip -6 route flush dev enp0s9
ip -6 addr add ::ffff:5:7:1:1/126 dev enp0s3
ip -6 addr add ::ffff:5:7:2:1/126 dev enp0s9
echo 1 | tee /proc/sys/net/ipv6/conf/*/forwarding > /dev/null

Host A configuration:

  ip link set enp0s3 up
  ip -6 addr flush dev enp0s3
  ip -6 addr add ::ffff:5:7:1:2/126 dev enp0s3
  ip -6 route add default via ::ffff:5:7:1:1

Host B configuration:

  ip link set enp0s3 up
  ip -6 addr flush dev enp0s3
  ip -6 addr add ::ffff:5:7:2:2/126 dev enp0s3
  ip -6 route add default via ::ffff:5:7:2:1

I want IP to be a translated address from IPv4 (5.7.2.1 -> ::ffff:5:7:2:1).

The problem:
When I'm trying to ping host A from host B sometimes it pings sometimes it doesn't; from host A to host B the same behavior. When I'm trying to ncat -6 it doesn't work (gateway tcpdump says "Destination host is unreachable"). ping and ncat works only on and from gateway.

Route tables on the gateway:

::ffff:5:7:1:0/126 dev enp0s3 proto kernel metric 256 pref medium
::ffff:5:7:2:0/126 dev enp0s9 proto kernel metric 256 pref medium
fe80::/64 dev enp0s8 proto kernel metric 256 pref medium

The last fe80::/64 records are my ssh connections.

I suppose, the problem is in the route part, but the mystery for me is how to fix it.

EDIT:

I SOLVED my problem, which was in flushing addresses ip -6 addr flush dev enp0s3.

  • AFAIR it's recommended to use no smaller nets than /64 for routing. – rudimeier May 19 '17 at 8:06
  • @rudimeier, yes, it's no smaller than /64, it's 126. – marar May 19 '17 at 8:41
  • @marar In this case /126 is "smaller" than /64, because with /126 your network only has two usable addresses. – Johan Myréen May 19 '17 at 9:58
  • 1
    ::ffff:5:7:1:1/126 - shudder! Why don't you use decent addresses? I'd expect that your problems would go away by themselves... – countermode May 19 '17 at 11:37
3

IPv4-mapped IPv6 addresses (i.e. addresses of the format ::ffff:192.168.0.1) are not supposed to be used on the wire. They are intended to be used as internal identifiers for IPv4 addresses on dual stack sockets. When a dual stack (IPv6/IPv4) server process accepts a connection on an IPv6 socket from an IPv4 host, say 192.168.0.1, it is internally converted to ::ffff:192.168.0.1.

If a network interface receives a packet with an address of this format, it is a bug if it does not drop it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.