LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 09-13-2011, 02:11 PM   #1
Gangrif
Member
 
Registered: Feb 2004
Distribution: Fedora 19
Posts: 64

Rep: Reputation: 15
iptables nat port forwarding..


I have a VM running on CentOS6, and i'm attempting to forward port 222 on the host, to 22 on the guest. The guest has an IP of 196.168.122.200, and the host has an IP of 10.1.1.6.


I've added the following to the nat table.
-A PREROUTING -p tcp -m tcp -i eth0 -d 10.1.1.6 --dport 222 -j DNAT --to-destination 192.168.122.200:22

And the following to the filter table
-A INPUT -p tcp --dport 222 -j ACCEPT

But i get a connection refused error when i attempt to conenct to port 222 on the host.

This should work.. what the heck am i doing wrong?

Thanks.

Last edited by Gangrif; 09-13-2011 at 04:26 PM.
 
Old 09-13-2011, 04:49 PM   #2
Gangrif
Member
 
Registered: Feb 2004
Distribution: Fedora 19
Posts: 64

Original Poster
Rep: Reputation: 15
I'm not certain what yet, but the problem must have been some other rule in iptables. I flushed, and added back in the forwarding rule, and its working...
 
  


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
iptables nat port forwarding rule set crowhurst01 Linux - Networking 2 02-13-2012 04:39 AM
iptables - port forwarding through nat issues web_janitor Linux - Networking 2 01-23-2009 07:16 PM
Iptables putting a nat (port forwarding) procfs Linux - Newbie 8 02-19-2008 01:15 AM
NAT and Port Forwarding aq_mishu Linux - Networking 2 09-16-2005 08:58 AM
iptables + NAT + Port forwarding problem SirGertrude Linux - Networking 9 05-14-2004 05:02 AM


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

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration