1

On my VPS(CentOS 7), I was trying configure OpenVPN + PiHole. During the process I had to restart the networking. Afterwards the networking got broken and locked me out. Now I can only access my Droplet from the console in the Digital Ocean control panel.

Once I'm in, I can see that everything works as expected(Apache, SSH, Gitlab, etc.) but since my networking is down, nothing can be accessed from the outside.

I tracked down the root cause of the problem to broken eth0 settings. I don't believe it's a firewall issue. My IP and Netmask settings were broken. They were falsely changed by Pi-Hole. I tried fixing them but I still get the same error message I got before trying to fix my settings when I execute systemctl status network:

enter image description here

How should I proceed?

Update 1

ifcfg-eth0:

DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
IPADDR=104.248.31.98
PREFIX=24
GATEWAY=104.248.16.1
DNS1=208.67.222.222
DNS2=208.67.222.220
USERCTL=no

route -n:

enter image description here

Update 2

route -n after reboot:

enter image description here

ip a sh:

enter image description here

0

1 Answer 1

3

Your gateway is non-local, ie, it's on a different subnet to your ethernet interface. The whole point of a default gateway is that it should be a locally-accessible host that can route traffic to and from the rest of the world. Attempting to use a non-local gateway produces the network is unreachable error you're seeing, and without a gateway your traffic can't get to the internet.

(There are exceptions to this, but they're unusual, to do with point-to-point routes, and it's not normal to use a wide (eg /24) netmask with such.)

Check all three settings - your IP, your netmask, your default gateway - with DO, and correct the one (or ones) that are wrong.

10
  • I should just be editing the file ifcfg-eth0 under /etc/sysconfig/network-scripts, right? Also what do you mean by DI? Commented Nov 17, 2018 at 12:23
  • Yes. And I meant the provider of your VPS, who I'd assumed was Digital Island based on the IP address. Sorry about the confusion if it's not.
    – MadHatter
    Commented Nov 17, 2018 at 12:28
  • FYI, it's Digital Ocean. Commented Nov 17, 2018 at 12:31
  • Each field(IP, netmask, default gateway) on my ifcfg-eth0 file is as it's seen on my DO panel, under my Public Network settings. But it doesn't currently work. When you say check, do you mean I need some other data? Commented Nov 17, 2018 at 12:39
  • @CanSürmeli If you've set up ifcfg-eth0 as shown in your question right now, then restart the VPS. The routes shown don't correspond to that configuration. Commented Nov 17, 2018 at 14:05

You must log in to answer this question.

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