December 14, 2017, 01:14:04 PM

News : LinuxSolved.com Linux Help Community Forum..


Author Topic: Forwarding IP packets  (Read 3703 times)

Offline n_karthy

  • Linux Noob !
  • *
  • Posts: 6
Forwarding IP packets
« on: March 31, 2006, 01:52:19 PM »
Hi,
I have 2 ethernet cards and i have enabled IP Forwarding. I have 2 PCs connected with these ethernet cards. i am able to ping between the PCs. But when i try a TCP connection, the connection is not getting forwarded and it says destination host unreachable.
What could be the problem be? is there any config file to enable TCP forwarding?

Thanks
Karthik

Offline Ricky

  • LST CareTaker
  • Specially Skilled
  • *****
  • Posts: 2381
Forwarding IP packets
« Reply #1 on: March 31, 2006, 06:24:38 PM »
Do all are on same network .. ie. same ip pool ?

Offline gauravbajaj

  • LST CareTaker
  • Experienced
  • *****
  • Posts: 658
Forwarding IP packets
« Reply #2 on: April 01, 2006, 08:13:52 PM »
Yup

You have to apply Iptables Rule for that ,

Just Follow this tutorial  , written by  Ricky:

http://www.linuxsolved.com/forums/ftopic115.html

In above post , the iptables rule is written i.e related to MASQUARDING

Just follow that

Gaurav

Offline n_karthy

  • Linux Noob !
  • *
  • Posts: 6
Forwarding TCP Connection
« Reply #3 on: April 03, 2006, 05:49:57 AM »
I tried the iptables byt still i was not able to get the connection forwarded.
I will explain my problem in detail:

I have 3 PCs : A, B and X
X has two ethernet cards  with IP address 172.20.38.31(eth0) and 192.168.0.1(eth1)
A has ip address 192.168.0.2 and is connected to eth1 of X
B has ip address 172.20.38.30 and is connected to eth0 of X

I have enabled IP forwarding in X

I am able to ping A from B and vice versa.
Also i am able to send UDP packets from A to B.

But when i try to connect(TCP) from B to A, it fails.
When i see the packets in ethereal it shows "Destination Unreachable"

I am new to Linux. Kindly help me out.

Thanks & Regards
Karthik

Offline Ricky

  • LST CareTaker
  • Specially Skilled
  • *****
  • Posts: 2381
Forwarding IP packets
« Reply #4 on: April 03, 2006, 12:17:05 PM »
Both are on separate IP pools so they can't have direct communication untill they are not bridged.

Offline n_karthy

  • Linux Noob !
  • *
  • Posts: 6
Forwarding IP packets
« Reply #5 on: April 03, 2006, 12:52:54 PM »
Basically what i want is that i should be able to communicate from B to A through X.(using TCP)
So how should i go about with this?

Thanks & Regards
Karthik

Offline gauravbajaj

  • LST CareTaker
  • Experienced
  • *****
  • Posts: 658
Forwarding IP packets
« Reply #6 on: April 03, 2006, 05:37:55 PM »
ok

Have u given correct Gateway at both client machines?

I thk that u have to chk entry at client B Gateway ..It should be 172.20.38.31..Just recheck


Gaurav

Offline n_karthy

  • Linux Noob !
  • *
  • Posts: 6
Forwarding IP packets
« Reply #7 on: April 04, 2006, 04:30:14 AM »
i have checked the gateways at both clients. They are set properly.

Karthik

Offline n_karthy

  • Linux Noob !
  • *
  • Posts: 6
Forwarding IP packets
« Reply #8 on: April 04, 2006, 01:37:38 PM »
Thanks guys!!!
I got it working. The iptables tutorial helped a lot.
I made the Intermediate PC as a NAT box using the command given in this link :
http://www.dur.ac.uk/a.d.stribblehill/linux-nat.html

But still i don't know why IP Forward doesn't work for TCP. it works fine with UDP and ping.

Can someone explain this?

Thanks & Regards
Karthik