1

I am trying to setup a gateway server in my cloud network so all my servers(some who do not have an external IP) can access the internet via this gateway server.

To achieve this, my first task is to configure the network interfaces on my servers manually and set the gateway property.

So this first server I am trying to configure is a ubuntu 16.04 web server that has both a public and a private network interface. I went ahead and updated /etc/network/interfaces as follows:

auto lo
iface lo inet loopback

# public interface - to be used only for inbound access
auto eth0
iface eth0 inet static
address 94.237.40.154
netmask 255.255.252.0

# internal interface - this is where it will get internet
auto eth1
iface eth1 inet static
address 10.5.0.155
netmask 255.255.252.0
gateway 10.5.2.135 # my gateway server
dns-nameservers 8.8.8.8

# unused interface - this was there from before
auto eth2
iface eth2 inet6 auto

So as soon as I save this and reboot the server, any inbound connection to the server on the external IP stops working. Currently I have port 80 and port 22 open on this server and both these just stop working.

I got to the server using a cloud console, and it manages to get internet access perfectly fine via my gateway server (tried doing traceroute and all works well). Both my interfaces are up and show the correct ip config on "ifconfig". But no inbound access at all. If I revert my settings to use DHCP again, all works fine.

I have had this issue in the past on a local server as well but never managed to figure out what I'm missing. Help appreciated.

EDIT: One more observation. If I set a default gateway on eth0 and remove the one from eth1 then inbound access starts working.

Yashvit
  • 111
  • 3
  • Is there any GUI installed? I've personally found that Ubuntu 16 and later the GUI tends to "steal" control from the /etc/network/interfaces file for some odd reason. So if you don't need GUI start by making sure Network Manager and other GNOME tools aren't installed. I don't take you for new at all but I've made two servers use the same IP before- they do not like that one bit lmao. Using DHCP works fine = manual address being assigned twice maybe. Doesn't sound like a firewall issue. – Tmanok Mar 09 '18 at 19:06
  • 1
    Nope. No GUI. This is ubuntu server. Definitely no other server with the same IP. Its something to do with the default gateway. See my EDIT. – Yashvit Mar 09 '18 at 19:08
  • Ah I see, very strange. So if you set the same DG on Eth0 as Eth1 but only one at a time, your network begins to function. Is there a problem with setting it up like that? (Mind my ignorance). – Tmanok Mar 09 '18 at 19:13
  • Can’t have the same default gateway on eth0. Have to set the one that my public network allows. This will defy the purpose of having the default gateway point to one of my server on the internal network. – Yashvit Mar 09 '18 at 19:20

0 Answers0