Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium



Posted on 2003-03-05
Medium Priority
Last Modified: 2010-03-18
hai all,
   i am a beginner to  networking. i am just testing .... i have three computers at home. PC2 system has 2 NIC.


the ipaddress are,
PC2 eth0-
PC2 eth1-

this may look weird. but i am testing.  i should be able to connect to PC3 from PC1 through PC2. i am running a proxy in PC3. can anyone suggest what are all the things to be configured.

thank you.
Question by:tamilselvi
  • 2
  • 2

Accepted Solution

Jaem earned 60 total points
ID: 8070940
There is 3 things to configure:
1) PC2: You want it to forward packets between the two "networks" PC1-PC2 and PC2-PC3.
2) PC1: You want to tell him how to access PC3.
3) PC3: You want to tell him how to access PC1.

There is a little problem with your initial configuration. The IP addresses are somewhat mischosen. Each links PC1-PC2, PC2-PC3, should be considered as different networks. I am going to treat 24-bit prefix network. In this case an IP address x.y.z.t carries the following information:
* x.y.z (the first 24 bits) is the network part of the address.
* t is the address of the host on the network.
* x.y.z.0 is the IP address of the network.
* x.y.z.255 is the broadcast address of the network.

Trouble is with your configuration, is that probably every IP address assigned has the default (same) 24-bit prefix network. Hence you tell PC2, eth0 is on network and eth1 is on network, which will probably confuse it.

So first thing is to correctly configure the IP addresses:
1) PC1 (eth0 host 1 on first network (<- 24-bit prefix network))
ifconfig eth0 netmask broadcast
2) PC2 (eth0 host 2 on first network
ifconfig eth0 netmask broadcast
3) PC2 (eth1 host 1 on second network
ifconfig eth1 netmask broadcast
4) PC3 (eth0 host 2 on second network
ifconfig eth0 netmask broadcast

Now by default each PC knows which interface to send packet to, for the network they are connected to: PC1 knows that any packet for 192.168.1.x should go out eth0. But it does not know where to send packet for the second network 192.168.2.x . So you use the route command:
On PC1
route add -net gw
(send packet for second network, to ip (which is on first network))
On PC3
route add -net gw

(type "route" to have a look at the routing tables)

Finally you need to tell PC2 to forward the packets inbetween the two networks:
On PC2
echo 1 > /proc/sys/net/ipv4/ip_forward

That's all. Have a look at
1) How your distribution configures network interfaces, easier than to do it by hand.
2) google CIDR: for example http://support.wrq.com/tutorials/tutorial.html

Author Comment

ID: 8077564

    thanks. but i wanted them to be on the same network on purpose. i connect PC3 with PC1 through direct cabling . i wonder  why PC3 doesnt send the packet  to PC2 eth1 when it is in the same network. (i am  a 0 in networking) . what 'll u do in case of bridge(PC2) it wont have ipaddress.
please help.

Expert Comment

ID: 8079529
this may work
your problem is that pc2 has no idea which interface to send the packets out on

on pc1
route add gw netmask

on pc2 enable ip forward
route add gw netmask
route add gw netmask

on pc3
route add gw netmask


Expert Comment

ID: 8082385
Just a minor question: Shouldn't
route add gw netmask
route add -host gw netmask

or is the -host option the default? (neat solution, BTW)

Else tamilselvi, what do you mean you have got PC1 and PC3 connected through direct cabling? Could you describe exactly your network hardware configuration?

Author Comment

ID: 8086032
no spl configuration. i want to capture the data from PC3 and does something with that data an then pass it on to PC1 which requested for that.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

569 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question