Computing.Net > Forums > Linux > IPTABLES & Port forwarding

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

IPTABLES & Port forwarding

Reply to Message Icon

Name: Josh
Date: August 16, 2002 at 14:20:03 Pacific
Comment:

Im trying to get port forwarding to work with iptables v1.2.3, the firewall sits behind a dsl router which has been setup to forward certain ports(25,113) to the internal network, in my rc.firewall I have the following lines to try to get the smtp server working

$IPTABLES -A INPUT -p tcp --dport 25 -j ACCEPT
$IPTABLES -t nat -A PREROUTING -j DNAT -p tcp --dport 25 --to 10.0.0.247
however I still can not connect to port 25 from the outside world, what do I need to change?

I have already verified that the email server has granted access to all and ipchains has been disabled...



Sponsored Link
Ads by Google

Response Number 1
Name: junky_toof
Date: August 16, 2002 at 14:39:54 Pacific
Reply:

You have
---dslrouter---
---firewall(linux)---
---internal network---
is this correct?


Something like
iptables -A FORWARD -i eth? -d 10.0.0.247 \
-p tcp --dport 25 -j ACCEPT

iptables -t nat -A PREROUTING -i eth? \
-d $firewall -p tcp --dport 25 -j DNAT \
--to-destination 10.0.0.247

iptables -t nat -A OUTPUT -i eth? \
-d $firewall -p tcp --dport 25 -j DNAT \
--to-destination 10.0.0.247

The tshoot with iptables -L -v -n.


0

Response Number 2
Name: Josh
Date: August 19, 2002 at 09:28:49 Pacific
Reply:

how does troubleshooting with -L -v -n work?
I put the following lines in my firewall script
iptables -A FORWARD -i eth0 -d 10.0.0.120 -p tcp --dport 113 -j ACCEPT

iptables -t nat -A PREROUTING -i eth0 -d $firewall -p tcp --dport 113 -j DNAT --to-destination 10.0.0.120

iptables -t nat -A OUTPUT -i eth0 -d $firewall -p tcp --dport 113 -j DNAT --to-destination 10.0.0.120
and got the error
creating rules...
Bad argument `tcp'
Try `iptables -h' or 'iptables --help' for more information.
Bad argument `tcp'
Try `iptables -h' or 'iptables --help' for more information.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Know any good POP/SMTP pr... AMD motherboard and ps2 m...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: IPTABLES & Port forwarding

Iptables Port Forwarding www.computing.net/answers/linux/iptables-port-forwarding/27126.html

iptables port forwarding www.computing.net/answers/linux/iptables-port-forwarding/18478.html

Port forwarding www.computing.net/answers/linux/port-forwarding/18291.html