I want to route public IPs from server A and use them on server B. I created the GRE tunnel and it works. I then setup a route on server A in the following way:

(public IP not actual IP) via dev tun2

On server B I binded IP to dev eth0 and added route:

(public IP not actual IP) dev eth0 scope link

Issue i'm having is when I test using netcat I have no connectivity. IP MASquerading wouldn't solve my problem since it doesn't use the IP from server A. any help would be greatly appreciated.

  • thanks tero, sorry is not the google DNS server its the public IP i'm trying to route to server B. – Jason Sep 25 '16 at 6:56
  • The same principle still applies. You need NAT on the server that has public IP to forward ports to server B's tunnel IP address. – Tero Kilkanen Sep 25 '16 at 13:34

You are getting asymmetric routing with your setup. Packets from your end are routed via the tunnel to the with source IP address in the network. I think that Google's external firewalls drop packets with private network addresses, so will never receive the packet.

If you want to route the packets back via the tunnel, you have to use NAT on the other end of the tunnel, which changes source IP address to other end's IP address.

It can also be that the client end of the tunnel uses its Internet facing IP address for the packets sent to the tunnel. In that case, the result is asymmetric routing. Packets from the client are sent via the tunnel to, but sends packets directly to the client's own IP address, which might also cause issues.


I totally hate to tell you, but you have serious problems with your setup.

(public IP) via dev tun2

Your so called public IP - is private and not routed over the internet. It is part of the RFC 1918 address space. On BOTH ends. Which means that the setup needs reverse NAT on both ends and the real public ip addresses to work.

  • hi - that is not the actual IP - don't wanna mention the real public IP – Jason Sep 25 '16 at 23:41

the issue was with server B. I tested this on other server and it worked. Not sure why this particular server doesn't work with gre tunnels. thanks for your time and comments.

  • This doesn't answer the question. It tells what the solution was, in a very broad, non-helpful sense, but it does not answer the question you asked. – EEAA Sep 28 '16 at 15:48

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.