I have 4 pc´s and another pc, which will act as a proxy, all being in the same network: . I can ping between each other. But, I want to separate them into two groups. That is:

pc1 is directly connected to pc2
pc3 is directly connected to pc4

But, all traffic from pc1 or pc2 to pc3 or pc4 has to go through proxy and all traffic from pc3 or pc4 to pc1 or pc2 has to go through proxy. Something like:

pc1          pc3
 |   -proxy-  |
pc2          pc4

pc1 IP: 
pc3 IP:
proxy IP:

To do that on pc1 I added:

ip route add via

But, when I do traceroute, does not appear as a hop..I am not sure if it should..

On proxy the routing table looks like:

default via dev eth0 dev eth0  proto kernel  scope link src  

Because of the last line, I think I should add another source that is pc1 And to be able to forward the traffic received from pc1 ( to its destination(either pc3 or pc4), I used this:

ip route add via src

Error: RTNETLINK answers: No such device

ip route add dev eth0:0 via src

Error: RTNETLINK answers: Invalid argument


ip route add src

Error: RTNETLINK answers: No such device

I am not sure if I am going on the right path to do this configuration. Please tell me if not. Thank you!


You need to divide your IP networks to smaller sections if you want to perform IP routing using the proxy.

Your pc1/pc2/pc3/pc4 all have a network mask of, which means that all those IP addresses are in the same IP subnet. Therefore they will communicate directly with each other and don't route packets via routers.

A working routing configuration could be something like this:

pc1: IP
pc2: IP
pc3: IP
pc4: IP

Proxy: IP,

And then you would add routing table entries in PC1/2:

ip route add via

And in PC3/4 respectively

ip route add via

So, you would have two separate IP subnetworks.

  • Hello! Thank you for your answer! Putting them in different subnets would be a good idea, but I am not sure yet if I am allowed to change the existing configuration. Until now I managed to do it like this: stackoverflow.com/questions/31435640/… What do you think about this approach? When I trouceroute I can see that the traffic passes through proxy..But from time to time, it doesn´t..it´s like it realises that it has a shorter route. Maybe there is a way to set priorities. – Roxana Roman Jul 16 '15 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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