Urgent help needed - screwed up with Act as router

OS type and version Ubuntu 22.04
Webmin version 2

In webmin, under Network Configuration, I clicked “Act as router?” and saved. Now my server is no longer accessible from the internet.
By means of a KVM, I have access to the console.

In the file sysctl.conf, I already commented out the line
but this was not the solution.

Can anyone help me by telling what I need to change in which files?

Many thanks in advance!

Anything you changed in the networking configuration would have been applied when you clicked “Apply changes”. It probably wasn’t the router setting.

You’ll need to do some basic network assessment and troubleshooting to figure out what’s wrong.

Look at ip addr show and ip route show to make sure those look reasonable.

Then make sure you can ping the router IP.

Hi Joe,

Thank you very much for your reply.
I effectively did push “Apply”. There was even a warning stating that my host might be unreachable after doing so. Which, sadly enough, in my case was indeed so.

The IP address was still correct. However, when doing “ip r”, I get nothing back. When trying to set it using “ip route add default x.x.x.x”, I get an error “Nexthop has invalid gateway”, although I am 100% certain that the gateway address is correct.
Concerning this, maybe a little extra context. I rent two servers at Hetzner. On my first server, I can ping the gateway (so ping between servers and gateways is allowed). On my second server, I get no reply from my gateway. However, I can ping Google or any other host on the internet, suggesting that this gateway might be down. There was indeed also an outage of a router at Hetzner at the same time, but that is resolved.

I do notice a small difference in the config files of netplan (both servers are Ubuntu 22.04). On server one (the one that still works), the four last lines of the file 01-etcfg.yaml are:

          - on-link: true
            via: a.b.c.d

(a.b.c.d being the address of the gateway).
On server two, this part is like

          - to:
            via: a.b.c.d

I don’t know if that could be a problem?
I remains strange however that I cannot ping my gateway.

Again, I really would like to know what is changed in which files when applying “Act as router”, it would make my search easier I think.

It’s possible Webmin doesn’t know about the on-link option and just forgot about it. I’d be surprised if it makes the interface not come up, though.

You didn’t say what you get from ip ad, so I’m not convinced you have an interface to ping out of.

Hi Joe,

Next practical problem is that the KVM was only at my disposal for three hours. I will ask Hetzner tomorrow for another three hours of KVM and do the basic troubleshooting as per your suggestion.

On the other hand, my brain just had a short circuit. How can I ping Google, but not the gateway? Maybe ICMP is not allowed on the gateway? I realise that doesn’t make much sense. I just had the idea that maybe IPv6 was working, but also that is not the case. Anyways, hopefully more news tomorrow, thanks again for your reply.

Hi Joe,

ip ad shows me the loopback interface and:

2: enp0s31f6 … state UP
link/ether …
inet a.b.c.d/32 …
inet6 (address)
inet6 (address

a.b.c.d is the correct address. When I compare it the server that still works, this looks exactly the same (except for the addresses of course), so that seems okay.

ip route show doesn’t give me anything back.
Regarding the “I can ping Google”, please disregard, that is NOT true. I cannot ping to the outside.
I added the on-link option in the netplan config file, just to be sure, and there are two small differences now:

  1. when I ping Google, before I did not get any reply, now I get the message “Temporary failure in name resolution”.
  2. When I try to “ip route add default a.b.c.d”, I now get a different error:

Error: either “to” is duplicate, or “a.b.c.d” is a garbage.

Another thing to mention: ip route gives nothing back, the command “route” show an empty table.

My true problem lies in the fact that I don’t seem to have a gateway configured in my IP settings. And yet again, I do wonder what is being changed when you apply the “Act as router” option.

I am fairly sure that it only changes “net.ipv4.ip_forward=1” which simply allows the kernel to act as a router, forwarding IP packets between network interfaces.
Adding it or removing it should not cause any other issues.

What Joe was referring to is that if you had also made other changes to interfaces, routes etc, they all would have been implemented when you hit the Apply button.

Do you have a prior snapshot or backup that you can safely revert to?

If not, then the upside may be a good learning experience. Always take a snapshot or backup before fiddling especially if you are not 100% certain of the outcome.

hello there,
I am guessing you’re no longer able to get the IP from DHCP server which might be used by Hetzner Cloud to map to it’s public IP.

I do not have any experience with Hetzner Cloud I am just guessing it, if thats a case simply run


command manually from the KVM console to request the IP from DHCP server or

the 2nd option should be to contact support, they’ll definitely help you to restore internet access to your instance by either fixing it by themselves or providing instructions for their specific cloud.

Thanks for the suggestion, but I’m not on Hetzener Cloud, it’s a barebone server in thjeir datacenter.

BUT, I do have some exciting news: I am able to access my server over IPv6!
First things first: a full backup of the thing.

I can also access the “Routing and gateways” page. When I click on “Active configuration”, I see that on my working server there is a “Default Route” on top of the list. On my broken server, that line is not there. What would be the best way to add that Default gateway there?

Just for your information: my problem is solved. Believe it or not, thanks to ChatGPT …

The problem was the following:
When doing “ip ad”, it shows

My subnet mask is
This translates into

After changing the subnet, I was able to add a default gateway, problem solved!
By the way, I did find the same comment somewhere on another forum, I just didn’t pay attention.

Another idea that I am having now is that maybe “Act as router” not only changes the “net.ipv4.ip_forward=1”, but also the subnet of the IP address.

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.