0

I have a raspberry pi running Arch Linux ARM connected on two interfaces. It uses systemd-networkd.

  • eth0 is connected on a DMZ. It has a static ip and it's behind a router with a public ip and port forwarding.
  • wlan0 is connected on a wifi network (LAN). It has a local ip.

I can ssh into the pi through both the public ip and the local ip. There is a webserver running on the pi, and I can access ip via the public ip.

However, for security reasons, I now want to prevent the pi to connect to the local network. But whenever I disconnect from the wifi, I lose all connectivity to the pi on the public ip (and local ip as well as expected).

This is the command I tried to disconnect from the wifi:

systemctl stop wpa_supplicant@wlan0.service

ip link set wlan0

I would like to find out why shutting down the wlan0 interface would also block any connection on a public ip that is supposed to be routed through the eth0 interface. There is probably a routing problem and I would be glad if you could help pinpoint it.

Please the result of a few commands that might be of interest:

$ ip route show
default via 172.16.16.16 dev wlan0 proto dhcp src 172.16.16.25 metric 1024 
10.0.0.0/29 dev eth0 proto kernel scope link src 10.0.0.2 
172.16.16.0/24 dev wlan0 proto kernel scope link src 172.16.16.25 
172.16.16.16 dev wlan0 proto dhcp scope link src 172.16.16.25 metric 1024 

$ ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether dc:a6:32:1c:2b:b1 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.2/29 brd 10.0.0.7 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::dea6:32ff:fe1c:2bb1/64 scope link 
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether dc:a6:32:1c:2b:b2 brd ff:ff:ff:ff:ff:ff
    inet 172.16.16.25/24 brd 172.16.16.255 scope global dynamic wlan0
       valid_lft 80544sec preferred_lft 80544sec
    inet6 fe80::dea6:32ff:fe1c:2bb2/64 scope link 
       valid_lft forever preferred_lft forever
....
.... other docker related interface
0

The problem was with the route to the gateway.

ip route add default via gateway_ip dev eth0 solved my problem.

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.