Add default gateway


I’m using the wlan0 connection (in hotspot mode) and some other device as internet gateway. In order for this to work I have to do
route add default gw (the ip of the gateway device)
This works perfectly but my application requires that this is made automatically while booting. So, my question is: How do I make this persistent over reboot?

Thanks in advance.
Best regards,



This type of stuff on Reach is handled by systemd-networkd. You have two options:

  • Create a systemd service, which will execute your command every boot
  • Or add a config file to /etc/systemd/network, some examples here.
1 Like


Would you mind sharing your solution?

Of course, my bad.
I created the file /etc/systemd/network/ with the following lines:

Name= wlan0


Note that my aplication needs the IP to be fixed, for DHCP the solution may vary.

Best regards,

1 Like

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