Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 03-26-2006, 04:38 PM   #1
Registered: Mar 2004
Location: Boston, MA
Distribution: SuSE Linux Open/Enterprise, Red Hat, Ubuntu
Posts: 147

Rep: Reputation: 17
Can't forward port to internal linux box

I have a test environment where I have one linux box acting as the NAT box. From the NAT box I am able to access port 222 (The "internal" linux box) with no problem.

If I try to access port 222 via the "WAN" IP address of the NAT box I cannot get through.

NAT box:
eth0 (connected to internal machine network)
eth1 ("WAN" IP address)

Internal box:

I have tried using the following commands which do not work for me:

iptables -t nat -A PREROUTING -p TCP -i eth1 -d --dport 222 -j DNAT --to-destination
iptables -A POSTROUTING -t nat -o eth1 -j MASQUERADE
This command reports 1
cat /proc/sys/net/ipv4/ip_forward
I am using SuSE 10 and have the firewall shut off for now. Can anybody tell me what I'm doing wrong?
Old 03-26-2006, 06:50 PM   #2
Registered: Jan 2004
Location: Manitoba, Canada
Distribution: Debian
Posts: 454

Rep: Reputation: 32
iptables -L

might show something unexpected. Also, check logs and give any warnings or error messages from iptables.
Old 03-26-2006, 07:20 PM   #3
Registered: Mar 2004
Location: Boston, MA
Distribution: SuSE Linux Open/Enterprise, Red Hat, Ubuntu
Posts: 147

Original Poster
Rep: Reputation: 17
I figure it out. I used the wrong interface for POSTROUTING.

iptables -A POSTROUTING -t nat -o eth0 -j MASQUERADE


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help! Port Forward Linksys firewall to Linux Webserver ryant Linux - Networking 3 09-20-2004 02:06 PM
iptables - change port and forward to a internal server leandrok Linux - Networking 0 01-16-2004 09:52 AM
Port forward blocking internal lan clients dulaus Linux - Security 1 06-06-2003 06:38 PM
Forward port port 80 to lan web server dulaus Linux - Networking 9 10-04-2002 03:45 AM
apache, port-forward and router on same box quickbeam Linux - Networking 2 05-14-2002 08:54 AM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:41 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration