Skip to contentSkip to conversation

DNAT not working

DISCUSSION Payal Rathod 3 participants 5 messages Apr 18, 2007 – Apr 19, 2007

lore
Share & tools
lore
#0 lore raw

Hi,
My gateway server is Ubuntu 6.06.1 LTS, iptables v1.3.3. By ifconfig I have added one more ip say 1.2.3.4 (eth0:1). iptables-save gives me the output at,
http://pastebin.ca/446625

# cat /proc/sys/net/ipv4/ip_forward
1

But when I connect to 1.2.3.4 port 25, instead of redirecting me to 10.10.200.2 it connects me to port 25 of the gateway machine. I am totally confused, can anyone help me out please?

With warm regards,
-Payal

#1 lore raw
Quoted 10 lines · Payal Rathod

Hi,
My gateway server is Ubuntu 6.06.1 LTS, iptables v1.3.3. By ifconfig I have added one more ip say 1.2.3.4 (eth0:1). iptables-save gives me the output at,
http://pastebin.ca/446625

# cat /proc/sys/net/ipv4/ip_forward
1

But when I connect to 1.2.3.4 port 25, instead of redirecting me to 10.10.200.2 it connects me to port 25 of the gateway machine. I am totally confused, can anyone help me out please?

Try -d 1.2.3.4 instead of -s.

HTH,
M4

#2 lore raw
Quoted 8 lines · Martijn Lievaart
Quoted 6 lines · Payal Rathod

Hi,
My gateway server is Ubuntu 6.06.1 LTS, iptables v1.3.3. By ifconfig I have added one more ip say 1.2.3.4 (eth0:1). iptables-save gives me the output at,
http://pastebin.ca/446625

Try -d 1.2.3.4 instead of -s.

But now it is timing out instead of connecting.
The new ruleset is at,

http://pastebin.ca/447539

Can someone tell what might be wrong?

With warm regards,
-Payal

#3 lore raw

Payal Rathod írta:

Quoted 5 lines · Martijn Lievaart
Quoted 4 lines
Quoted 1 line · Payal Rathod

...

Quoted 10 lines
Quoted 2 lines

Try -d 1.2.3.4 instead of -s.

But now it is timing out instead of connecting.
The new ruleset is at,

http://pastebin.ca/447539

Can someone tell what might be wrong?

...

1. Your FORWARD policy is ACCEPT... You do not need the lines 14 and 15. (AFAIK: If the target IP is on your computer then it fill not be FORWARDed but will be sent to a LOCAL process.)
2. You did not wrote but I assume you have a dynamically assigned IP connection. (Line 22.) If it is true then I would specify in this line the output interface: "-A POSTROUTING -s 10.10.0.0/255.255.255.0 -o ???ppp+??? -j MASQUERADE"
3. Line 23: ???? Why do you DNAT an outgoing connection back to you ??? Maybe you do not need that line at all...

Hope that helps.

Swifty

#4 lore raw
Quoted 4 lines · G?sp?r Lajos

2. You did not wrote but I assume you have a dynamically assigned IP connection. (Line 22.) If it is true then I would specify in this line the output interface: "-A POSTROUTING -s 10.10.0.0/255.255.255.0 -o ???ppp+??? -j MASQUERADE"

No it is a fixed ip.

Quoted 2 lines

3. Line 23: ???? Why do you DNAT an outgoing connection back to you ??? Maybe you do not need that line at all...

I removed that - but still does not work.

Any ideas?

With warm regards,
-Payal