I'm trying to work out how to connect an inbound IPv4 connection to a port listening on a IPv6 port on a CentOS box.
To demonstrate on a vanilla CentOS 7 server:
$ cat /proc/sys/net/ipv6/bindv6only 0
- Run netcat listening on a IPv6 port
nc -lvn6p 80
- On another shell, attempt to telnet to the port via IPv4
telnet 127.0.0.1 80
Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused
- Trying to connect via IPv6 works as expected. e.g. telnet ::1 80
- However everything I'm reading suggests that Linux-based IPv6 sockets should accept IPv4 connections too if net.ipv6.bindv6only is disabled in sysctl, which it is.
- I've tried Socket CAT, it works but isn't an elegant solution and requires a separate service to be configured. e.g.
socat TCP4-LISTEN:80,reuseaddr,fork TCP6:[::1]:80