LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 01-08-2007, 12:08 AM   #1
culin
Member
 
Registered: Sep 2006
Distribution: Fedora Core 10
Posts: 254

Rep: Reputation: 32
IP forwarding


Hi all,
can anyone tell what is IP forwarding and gimme some tutorials or guides related to that...
thanks...
 
Old 01-08-2007, 02:46 AM   #2
avallach
Member
 
Registered: Sep 2006
Location: Silesia
Distribution: Debian GNU/Linux 4.0, ArchLinux, OpenBSD
Posts: 190
Blog Entries: 2

Rep: Reputation: 31
IP forwarding can forward network traffic from one computer to another. You can read man iptables to achieve it.
 
Old 01-08-2007, 03:05 AM   #3
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
ip forwarding with iptables : http://amitsharma.linuxbloggers.com/portforwarding.htm

Last edited by amitsharma_26; 01-08-2007 at 03:08 AM.
 
Old 01-08-2007, 09:30 PM   #4
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Rep: Reputation: 31
Quote:
Originally Posted by culin
can anyone tell what is IP forwarding
When you forward port P of host H to port Q of host I, you actually listen on H:P and send (forward) any packets to I:Q, and you also send any response packets you get from I back to the client (whoever initiated the connection). It follows that port P on H must be free, and if P<1024, you need to be(come) root on H.
Quote:
and gimme some tutorials or guides related to that...
Others provided tutorials.

The easiest way to temporarily forward ports is using the -L or -R option of ssh. For a trivial example,
Code:
ssh -L 8000:google.com:80 localhost
And then http://localhost:8000 will give you the same as http://google.com

If the client is not local on H, you must use -g with -L (not -R). The forwarding will only last as long as the ssh session. man ssh
 
Old 01-08-2007, 10:59 PM   #5
culin
Member
 
Registered: Sep 2006
Distribution: Fedora Core 10
Posts: 254

Original Poster
Rep: Reputation: 32
Thanks Quigi,
Quote:
Originally Posted by Quigi
listen on H:P and send (forward) any packets to I:Q
what does this syntax means... H:P and I:Q...port P on host H and port Q on host I ?? or does it have any other meaning...and say i am in LAN and i want to send packets from my port say "x" to my friends PC port say "y"... how to achieve this.....is this also IP forwarding...
 
Old 01-09-2007, 10:18 AM   #6
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Rep: Reputation: 31
Quote:
Originally Posted by culin
H:P and I:Q...port P on host H and port Q on host I ??
Yes, exactly. For example, the HTTP port (port 80) of host google.com (72.14.207.99 among others) is often denoted "google.com:80" or "2.14.207.99:80". It's just a convention/shorthand.

Quote:
and say i am in LAN and i want to send packets from my port say "x" to my friends PC port say "y"... how to achieve this...
Answer A: You have to tell us (much) more. What are you trying to achieve? Are you sure you need to think at the packet level, or could you describe your goal in terms of a "connection"?

Answer B: nc

Hint: the originating port (x) hardly ever matters.
Quote:
is this also IP forwarding...
If I understand you right, it isn't -- it's just some packets (and maybe a connection) between you and your friend. The machine doing IP forwarding (H in my example) in a way acts as a proxy between a client and a server (I).

I neglected to mention that with ssh, the listening side and the forwarding/initiating side can be on different computers, which lets you tunnel through firewalls. That's a bit different from "plain" forwarding.

BTW, there's a fairly simple perl script out on the web for connection forwarding.
 
Old 01-09-2007, 10:41 PM   #7
culin
Member
 
Registered: Sep 2006
Distribution: Fedora Core 10
Posts: 254

Original Poster
Rep: Reputation: 32
Thanks Quigi,
what i had thought from your explanation in the first reply is the host itself is the client ...now i got your point... u mean to say IP forwarding is same as IP masquerading ??
Quote:
ssh -L 8000:google.com:80 localhost
what exactly this does.. i didnt get.. sorry...
Quote:
The machine doing IP forwarding (H in my example) in a way acts as a proxy between a client and a server (I).
can u please gimme an example considering 3 machines with conditions... to understand IP forwarding better...
thanks again....
 
Old 01-10-2007, 03:12 PM   #8
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Rep: Reputation: 31
Hi Culin,

Please disregard everything I said about port forwarding, because you had asked about IP forwarding. I tried http://en.wikipedia.org/wiki/Special.../IP_forwarding (their search failed temporarily, but Google got me some hits.)

Quote:
can u please gimme an example considering 3 machines with conditions... to understand IP forwarding better...
Say you browse to www.google.com; let's look in minute detail what goes on.

Host A (your computer) wants to send a packet to host B (say, www.google.com). As route -n reveals, A doesn't have a direct wire to B, so it sends the packet to the appropriate gateway C (marked with a G in the "Flags" column, probably your default gateway). Now machine C acts as a router and forwards the packet to another machine, which is one hop closer to B. Here, C does IP forwarding. Note that this is just the beginning -- there are many more steps till your packet gets to B, and a response packet makes its way back to A (probably again through C), and then many more packet roundtrips till (a fraction of a second later) your browser displays the google page.

Again, what are you trying to accomplish?
 
Old 01-10-2007, 10:25 PM   #9
culin
Member
 
Registered: Sep 2006
Distribution: Fedora Core 10
Posts: 254

Original Poster
Rep: Reputation: 32
Thanks Quigi,
i am just trying to get a clear picture and understand between IP forwarding IP masquerading and port forwarding...

Quote:
A doesn't have a direct wire to B, so it sends the packet to the appropriate gateway C
...
u r telling something about packets... i think this is regarding connections right ??
here what is the meaning of sending packets ?? because when establishing any conneciton packets will obviously come into picture right ?? what is special here ??
Quote:
Here, C does IP forwarding.
IT DOES IP FORWARDING... how it does ???

sorry if i am bugging u tooo much....i am really trying to understand the things better....
 
Old 01-11-2007, 08:45 AM   #10
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Rep: Reputation: 31
For getting an overall picture, keep reading the web. I found the articles in Wikipedia particularly helpful and well-written.

When establishing, using, and tearing down a connection, packets are exchanged. (But you may also send around packets (e.g., UDP datagrams) without establishing a connection.) Packets and connections are talking at different levels of the ISO/OSI model.
 
Old 01-11-2007, 11:04 PM   #11
culin
Member
 
Registered: Sep 2006
Distribution: Fedora Core 10
Posts: 254

Original Poster
Rep: Reputation: 32
ok. thanks for the info....
 
  


Reply



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
Mail Forwarding in postfix/maildrop/redhat (like yahoo mail forwarding) topcat Linux - Software 1 08-31-2007 12:10 PM
IPCHAINS port forwarding and IPTABLES port forwarding ediestajr Linux - Networking 26 01-14-2007 07:35 PM
Simple Port Forwarding Firewall - not forwarding MadTurki Linux - Security 14 04-09-2006 12:08 PM
ip forwarding slack66 *BSD 4 11-03-2004 11:42 AM
port forwarding and packet forwarding syrtsardo Linux - Newbie 2 07-03-2003 10:37 AM

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

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