0

I have to make a configuration like following:

PC1 ---- PC2 ---- PC3

The point of this is that I want to send data from PC1 to PC3 but doing something with the data in PC2.

I have 3 ubuntu computers. I have already configurated the end-points with:

sudo ifconfig eth0 *IPofPC1or2* netmask *netmask*
sudo route add default gw *IPofPC2* eth0

For the PC2 I think I have to assign an IP address to eth0 (in the same subnet of PC1) and eth1 (in the same subnet of PC3) but then, how can I connect the gateway? I am not sure. I tryed to make the default gateway to the PC1 (in eth0) and to PC3 (in eth1), but if I make ping from PC1 to PC3 it's not working.

I hope someone can help me! :)

Thanks so much!!

2
  • How are you connecting the PC's together? End-to-end or using a switch?
    – user555
    Commented Jul 10, 2013 at 9:26
  • I connect them with an Ethernet wire. Like: eth0---eth0,eth1---eth0 from PC1, PC2 and PC3 respectively.
    – Stratford
    Commented Jul 10, 2013 at 10:41

2 Answers 2

0

You mean to assign gateway for PC2? you dont have to. For PC2 - PC1 subnet and PC3 subnet is a directly connected networks. Gateway is required only when you need to get to remote networks.

PC1

sudo ifconfig eth0 *IP12* netmask *netmask1*
sudo route add default gw *pc2ip_eth0* eth0

PC3

sudo ifconfig eth0 *IP32* netmask *netmask2*
sudo route add default gw *pc2ip_eth1* eth0

PC2

sudo ifconfig eth0 *IP21* netmask *netmask1*
sudo ifconfig eth1 *IP23* netmask *netmask2*
0

I already found the solution. I have to activate the ip_forward to "connect" eth0 and eth1 of PC2. Because If I ping from PC1 to PC3, it should be switch in PC2 from eth0 to eth1 to continue the path (be like a router).

To do that I do in PC2:

sudo sysctl -w net.ipv4.ip_forward=1

Thanks for the help! :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .