LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   port forwarding does not work on additional ip addresses (https://www.linuxquestions.org/questions/linux-networking-3/port-forwarding-does-not-work-on-additional-ip-addresses-144588/)

antken 02-10-2004 05:25 PM

port forwarding does not work on additional ip addresses
 
hi,

i am probably missing something really stupid but...

i have just added an additional ip address to my external interface ( yes my isp knows about the ip address and i have had another machine on it before ).

my system has assiged the interface name eth0 : 0

( the spaces are to prevent a smiley poping up )

for some reason, the port forwarding is not working at all on any virtual interface i used the following line to add in the port forwarding:
( i have changed the external ip address

Code:

iptables -t nat -A PREROUTING -p tcp -i 44.44.44.46 --dport 8080 -j DNAT --to-destination 192.168.0.201:80
now the above line works great on the default external ip address ( 44.44.44.41 ) but fails on the additional addresses. i have set this up before but cannot remember how, or what was changed at the time.
and it would be good to have it all written down too :)


does anyone have any ideas as to what is wrong?

i have only the basic stuff in my iptables ( set up for NAT )

g-rod 02-10-2004 06:51 PM

Don't create a virtual interface just bind additional address to the NIC with
ip add addr add <ip> dev <device>;
Are you SNAT the connection on the way out?
iptables -t nat -A POSTROUTING -p tcp -s 192.168.0.201 -J SNAT --to-source 44.44.44.46
or masquearing the connection is OK too
Your DNAT rule should be
iptables -t nat -A PREROUTING -p tcp -d 44.44.44.46 --dport 8080 -j DNAT --to-destination 192.168.0.201:80
Not
iptables -t nat -A PREROUTING -p tcp -i 44.44.44.46 --dport 8080 -j DNAT --to-destination 192.168.0.201:80
The -i is interface option.


All times are GMT -5. The time now is 07:33 AM.