I am trying to set up my raspberry pi to act as a router. The set up is the following:

  • The Raspi receives its connection to the internet through Ethernet, with a static IP address setting. The subnet mask for this connection is supposed to be, however on other devices it also works with
  • I have set up my Raspi to act as a wireless acce point by following this guide: Link
  • I have 4-5 devices that connect to the Wifi network generated by the Raspberry Pi.

Once set up, the WiFI access point works for maybe a minute or two. Then, devices connected lose access to the internet, and if they disconnect from the wifi, they cannot reconnect.

I would like to know if anyone has either a solution for this issue, or a method for me to understand what is going on. For example, are there system logs I can look at to understand what is going on? Thanks everyone for the help :D


interface eth0
static routers=
static domain_name_servers=
static domain_search=
static ip_address=

interface wlan0
static ip_address=
nohook wpa_supplicant
static routers=
static domain_name_servers=
static domain_search=




interface=wlan0 # Listening interface
                # Pool of IP addresses served via DHCP
domain=wlan     # Local wireless DNS domain
                # Alias for this router


  • https://www.raspberrypi.org/documentation/confi ... -routed.md isn't a valid link – Jaromanda X Jun 15 '20 at 23:01
  • Rather than letting us assume you followed the guide correctly, can you show, in the question the contents of the files you modified to try and get this to work – Jaromanda X Jun 15 '20 at 23:57
  • Assuming you are referencing the Foundation link you didn't follow it - a "subnet mask" and would give you 2 IP addresses. – Milliways Jun 16 '20 at 0:11
  • Thanks for your feedback - I edited the original post ! – Barth Jun 16 '20 at 12:30

You can try to use systemd-networkd that do not need additional helper programs which all must respect your uncommon network mask. You can set it in one configuration file and it should do. You can look at Setting up a Raspberry Pi as an access point - the easy way how to do it. You have to use section ♦ Setting up an access point and with eth0, with NAT (recommended). There you will find the configuration file for the wired ethernet uplink interface:

rpi ~# cat > /etc/systemd/network/04-eth0.network <<EOF

Just use instead this configuration for the example. Of course you have to use your own ip address settings:

rpi ~# cat > /etc/systemd/network/04-eth0.network <<EOF

The netmask is noted here with the equivalent bitmask /30 on the ip address This netmask/bitmask defines a subnet with only two ip addresses and You have to ensure that the internet router uses the other ip address.

In a comment you wrote that the ip address of your internet router is This is the public ip address of your router seen from the internet. It cannot be used with your private network. The RasPi is connected with an ethernet cable to your router. The port on the router where the cable is connected has also a private ip address. If you want to use a static ip address on the RasPi, you must know the private ip address of the router. It is very uncommon that an internet router does not serve DHCP. So you should really try to enable DHCP on the RasPi as shown in the first version of the configuration file.

  • Thank you ! Does the IP address have to be on the same network as the eth0 static IP configuration? – Barth Jun 16 '20 at 12:16
  • Just tried this set up - I am able to generate a network, connect devices to it, and ping the RaspPi, but still no access to the connection. I have changed only the eth0 settings and the Raspi can access the internet. I do not have access to the router, my connection comes directly by ethernet cable, so I'm not able to set a route on the router to the Raspi. – Barth Jun 16 '20 at 13:06
  • @Barth "Does the IP address have to be on the same network as the eth0 static IP configuration?" I do not understand the question. You have two subnets on the access point and with eth0 of the RasPi and the interface of the internet router. Routing is enabled between these two subnets. What ip address has your internet router? The simplest way to avoid problems is to use DHCP as shown in the first version of the config file. – Ingo Jun 16 '20 at 13:13
  • Ok, this clears it up ! The ip address of the router is I do not have access to the router and I believe it does not use DHCP - hence, I have to set up a static IP address for my ethernet connection. – Barth Jun 16 '20 at 13:17
  • @Barth I have updated the answer with the last paragraph. – Ingo Jun 16 '20 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.