Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!!

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

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.


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


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


sudo ifconfig eth0 *IP21* netmask *netmask1*
sudo ifconfig eth1 *IP23* netmask *netmask2*
share|improve this answer
up vote 0 down vote accepted

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! :)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.