LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-26-2006, 04:38 PM   #1
NetAX
Member
 
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 10.0.0.3 (connected to internal machine network)
eth1 172.17.64.202 ("WAN" IP address)

Internal box:
eth1 10.0.0.1


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

Code:
iptables -t nat -A PREROUTING -p TCP -i eth1 -d 172.17.64.202 --dport 222 -j DNAT --to-destination 10.0.0.1:222
Code:
iptables -A POSTROUTING -t nat -o eth1 -j MASQUERADE
This command reports 1
Code:
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
RobertP
Member
 
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
NetAX
Member
 
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.

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


Reply


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

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:20 AM.

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