I have some kind of Debian server-gateway-zombie that has two network interfaces:
wlan0... I know.).
eth0 is connected to a internet cable modem that assigns an IPv6 address to it. Let's assume that this is a IPv6-only assignment. (Actually it uses DS Lite, but let's ignore this for now.)
wlan0 is connected to an IPv4-based local network with a main gateway that is yet another internet cable modem. This second cable modem only gets an IPv4 address from the provider and uses NAT to forward ports to local computers.
The important part of the server-zombie's
/etc/network/interfaces looks like this:
allow-hotplug eth0 iface eth0 inet static # Ignore the following IPv4 stuff... # I just added this to connect to the cable modem more conveniently address 192.168.0.22 netmask 255.255.255.0 gateway 192.168.0.1 auto wlan0 iface wlan0 inet static wpa-ssid [ssid] # only required for my wlan connection wpa-psk [key] # only required for my wlan connection address 192.168.1.22 netmask 255.255.255.0 # The following makes sure that the main IPv4 network # can be reached from this computer: #gateway 192.168.1.1 # can't use this because only one IPv4 gateway is allowed at a time post-up ip route add 192.168.1.0/24 dev wlan0 src 192.168.1.22 table rt2 post-up ip route add default via 192.168.1.1 dev wlan0 table rt2 post-up ip rule add from 192.168.1.22/24 table rt2 post-up ip rule add to 192.168.1.22/32 table rt2
I now want to use my server-gateway-zombie to accomplish the following: Connections coming from the IPv6
eth0 adapter on specific ports should be forwarded as IPv4 connections to computers in the
wlan0 network. How can I accomplish this?
Here are some additional information to give you some insight into why I want to do that:
Since I have two cable modems, an IPv4-only one and an IPv6-only one (at least concerning incoming connections), I'd like to perform some kind of IP-version-dependent load balancing.
That means that whenever a client can use IPv6 to connect to my network it will reach my IPv6 cable modem which then redirects the traffic to the server-gateway-zombie which then again redirects it to the server in the IPv4 network. On the other hand whenever a client can only use IPv4 to connect to my network, the IPv4-only cable modem's NAT will kick in and redirect the traffic accordingly.
This can be accomplished by adding creating two DNS entries for my hostname: one for the IPv4 address and one for the IPv6 address.