0

I have two servers (VPS at Linode) of which one (db) has only one static private IP, so I need to access it via the other one (web). Now that works fine, but I discovered that I cannot access anything on the Internet from the db server... and running some updates would by now be nice :)

config /etc/network/interfaces is

auto lo
iface lo inet loopback

auto eth0

iface eth0 inet static
 address (private IP)
 netmask (netmask)

Wouldn't the db server have Internet access because it is on the same private LAN? What do I need to change?

3 Answers 3

2

The database server needs a gateway, and that gateway needs to handle whatever NAT between the private IP address and the "real" IP address it uses to reach the internet.

On the database server side, for your configuration snippet there, you'd need to add

   gateway (gateway)

after address and netmask for eth0. If Linode doesn't provide gateways already set up for this, then you'll probably be using the internal address of your other server as the gateway, then setting up your other server for Masquerading, which allows it to share its connection with other computers.

1

You need to make sure that the router on your subnet is configured to run NAT(or masquerade) for your IP.

What is your default gateway on the 2nd server? Can you ping that IP? If you can ping the gateway, but not outside then it is a config problem on the gateway which you may need to talk to your provider for.

0

Linode provides a public address for each instance. For your DB instance, log into your Linode account and click the instance, then check the Network tab (I think, I am doing this from memory). If you want the db to have internet access, set the public address to eth0, and this entry will have a gateway listed as DerfK says. Set the private address on eth1. You then should still be able to access the db from your web server on the private network, and access the internet on the public network.

1
  • The original asker implied that he intentionally did not want the public address directly open on the server. If anyone follows these instructions please consider disabling the interface after updating, or adding firewall entries on that public address. (Also private since Linode's private address space is technically open to anyone else in the datacenter so you want to lock it down too.) Jul 2, 2016 at 8:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .