Share your knowledge at the LQ Wiki.
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 08-05-2003, 01:10 PM   #1
Registered: Sep 2002
Posts: 184

Rep: Reputation: 30
forwarding a specific port from eth0 to eth1

how can I do such a thing?

I have two network cards on a redhat9 computer and I want to forward ssh requests that comes to eth0 to a computer connected with eth1


so that I can ssh from PC1 to PC3

thx for any help
Old 08-05-2003, 01:47 PM   #2
Senior Member
Registered: Mar 2003
Location: Pittsburgh, PA
Distribution: Gentoo / NetBSD
Posts: 1,251

Rep: Reputation: 45
I think iptables can provide this type of redirecting
Old 05-02-2006, 11:01 PM   #3
Red Hat India
Registered: Nov 2004
Location: Kerala/Pune,india
Distribution: RedHat, Fedora
Posts: 260

Rep: Reputation: 34
Hello zovres,

You can do port forwarding using the NAT function in iptables. For this you need the 'iptables_nat' and 'ip_conntrack' modules loaded.

# iptables -t nat -A PREROUTING -d 'IP of eth0' -p tcp --dport 22 -j DNAT --to 'IP of eth1'.

After issuiong this command please restart iptables. I hope this simple redirection would work for you. Please reply if anything comes up.


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
x86 board PCM 6892 with dual ethernet port.eth1 doesnt ping if eth0 cable removed rani_162 Linux - Newbie 0 07-23-2005 01:29 PM
port forwarding from eth0 to eth1 ? overproof Linux - Networking 7 05-16-2005 03:48 AM
port forward from eth0 to eth1 ryanzietlow Linux - Networking 8 03-01-2005 11:08 AM
iptables: forwarding SSH connection: eth0 to eth1 hamish Linux - Networking 12 01-14-2005 04:07 PM
IP forwarding from eth0 to eth1 musicman_ace Linux - Networking 5 08-01-2004 05:39 AM

All times are GMT -5. The time now is 07:23 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