I have wireless router, with one external and one internal network interface.
external interface - ra0 - 10.31.6.31
internal interface - eth0 - 10.31.31.1
clients in internal network use IP's 10.31.31.2-40 with default gateway 10.31.31.1
I have NAT setup with:
iptables -t nat -A POSTROUTING -s 10.31.31.0/24 -o ra0 -j MASQUERADE
is it possible to make one new client (10.31.31.39) have a different external IP (10.31.6.41) ?
I tried adding virtual interface:
ifconfig ra0:1 10.31.6.41 netmask 255.255.255.0
and adding more NAT rules:
iptables -t nat -A PREROUTING -d 10.31.6.41 -j DNAT --to-destination=10.31.31.39
iptables -t nat -A POSTROUTING -s 10.31.31.39 -j SNAT --to-source=10.31.6.41
but that doesn't work, it seams that first NAT rule overwrites all other.
So how can I setup TWO independent external IP adresses in my internal network?
I would like this:
10.31.31.1-10 to have external IP of 10.31.6.31 and
10.31.31.39 to have external IP of 10.31.6.41
Thank you in advance.