?
Solved

routing

Posted on 2003-03-05
5
Medium Priority
?
199 Views
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.

PC1--->PC2eth0-PC2eth1------>PC3

the ipaddress are,
PC1-192.168.2.201
PC2 eth0-192.168.2.202
PC2 eth1-192.168.2.203
PC3-192.168.2.204

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.
0
Comment
Question by:tamilselvi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 1

Accepted Solution

by:
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 192.168.2.0 and eth1 is on network 192.168.2.0, which will probably confuse it.

So first thing is to correctly configure the IP addresses:
1) PC1 (eth0 host 1 on first network 192.168.1.0/24 (<- 24-bit prefix network))
ifconfig eth0 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255
2) PC2 (eth0 host 2 on first network 192.168.1.0/24)
ifconfig eth0 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255
3) PC2 (eth1 host 1 on second network 192.168.2.0/24)
ifconfig eth1 192.168.2.1 netmask 255.255.255.0 broadcast 192.168.2.255
4) PC3 (eth0 host 2 on second network 192.168.2.0/24)
ifconfig eth0 192.168.2.2 netmask 255.255.255.0 broadcast 192.168.2.255

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 192.168.2.0/24 gw 192.168.1.2
(send packet for second network, to ip 192.168.1.2 (which is on first network))
On PC3
route add -net 192.168.1.0/24 gw 192.168.2.1

(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
0
 

Author Comment

by:tamilselvi
ID: 8077564
hai,

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

Expert Comment

by:eishv
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 192.168.2.204 gw 192.168.2.203 netmask 255.255.255.255

on pc2 enable ip forward
route add 192.168.2.204 gw 192.168.2.203 netmask 255.255.255.255
route add 192.168.2.201 gw 192.18.2.202 netmask 255.255.255.255

on pc3
route add 192.168.2.201 gw 192.18.2.202 netmask 255.255.255.255

0
 
LVL 1

Expert Comment

by:Jaem
ID: 8082385
Just a minor question: Shouldn't
route add 192.168.2.204 gw 192.168.2.203 netmask 255.255.255.255
be
route add -host 192.168.2.204 gw 192.168.2.203 netmask 255.255.255.255

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?
0
 

Author Comment

by:tamilselvi
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.
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

764 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