Visit Jeremy's Blog.
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 09-13-2011, 02:11 PM   #1
Registered: Feb 2004
Distribution: Fedora 19
Posts: 73

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, and the host has an IP of

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

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?


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

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...


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 > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:30 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration