Use iptables to forward ipv6 to ipv4?

Eli asked:

Currently I have a setup where, due to configuration that would take forever to fix, I have a server that can only be accessed by ipv4. I also, however, have a server that can be accessed by ipv6.
I was wondering if I could use iptables to forward ipv6 traffic on a certain port from one of the servers to another server using ipv4 traffic.

My answer:


Recent versions of xinetd can also listen on IPv6 and then forward the connection to an IPv4 address.

A sample configuration which listens for IPv6 connections on port 3389 and forwards them to port 3389 of an internal IPv4 address:

service rdp_port_forward
{
    flags           = IPv6
    disable         = no
    type            = UNLISTED
    socket_type     = stream
    protocol        = tcp
    user            = nobody
    wait            = no
    redirect        = 10.187.20.42 3389
    port            = 3389
}

This may be useful in more restricted environments since xinetd is likely to be installed with your base system or available in approved vendor repositories.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.