I have system with two interface like

eth0 -> 88.198.x.x

eth1 ->

I need this server to be accessible from internet throw eth0 but server uses eht1 for it's own internet needs (download, update, etc).

*There is a VPN server behind eth1 to hide my servers location

I tried to remove gateway from eth0 and add one to eth1 but i lost asscess to internet and even ping to eth0 I add getaway to both eth* and then delete default route and then add route to eth1 gateway by

route del default
route add gw

but that failed too! how can i fix it?

OS ubuntu 18.04

  • 1
    Hi, your title is misleading, you got one public IP and one private IP. Why the update via your LAN if the server is on the WAN directly ? – yagmoth555 Apr 13 at 13:45
  • @yagmoth555 you may say that but public or private doesn't matter and my point still stands. Right? – Kian Ostad Apr 13 at 13:56
  • @yagmoth555 I changed the title – Kian Ostad Apr 13 at 13:58

The route add gw tells your system to route only trafic with destination through gateway It does not seem to be what you want to achieve.

You want to route all trafic (with any destination) through gateway and through dev eth1

Try this one: route add default gw dev eth1

You will probably face an other issue when people will try to reach your server through 88.198.x.x. Your server will try to respond back through its default route, eth0, and your local IP is probably "natted" (by your router or your VPN) to a different public IP. People who will try to reach 88.198.x.x would get packets from a different IP as a response. That will not work. You must enforce responses to requests coming through eth0 to be sent through eth0. Check this thread: https://unix.stackexchange.com/questions/4420/reply-on-same-interface-as-incoming

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.