I am struggling with a scenario. Suppose we have two systems in same subnet A:- and B:- where B is further connected with C:- through Openswan. B can ping C but A cant ping C.

I want to add a route in A that it route all traffic which is destined for to B.

I used route add -net netmask gw dev eth0 But it is not working. Checked with tcpdump and packets are not going to B.

Any ideas how this can be done ?

  • 1
    Please show the complete routing table on host A. Also, show the IP addresses of both ends of Openswan tunnel and their routing tables. – Tero Kilkanen Apr 15 '17 at 3:29
  • is in AWS and Openswan is connected to AWS VPC VPN. AWS side Security groups are open and there is no iptables on aws side. Route table of A is as below dev eth1 proto kernel scope link src via dev eth1 dev eth0 proto kernel scope link src – xs2rashid Apr 20 '17 at 8:50

In order to accomplish your goal, both ends must have respective routes to the other end.

So, in your case:

route add -net gw dev eth0 in Host A.

route add gw 172.22.1.N dev X in Host C. Here N is the address of Host B in the VPN subnet, and X is the device used for the VPN subnet in Host C.

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.