0

Setup

  • Router as Wireguard server on my network
  • Raspberry Pi
    • OS: Raspbian Buster
    • connected to a mobile hotspot via wifi (interface wlan0)
    • et0 set to static IP to control a device with static IP directly, without switch or router
    • wg0 configured to connect to the server on my router

Problem

The wireguard connection only works if I disable eth0 with ifconfig eth0 down.

What I want to do:

I need to update and test the update of a software on the Pi. The software uses the device connected on eth0, so I need that eth0 active.

What I tried

Nothing, besides google, but I could not find a anything to my specific problem.

I suspect that I need to change the rounting table but I am not sure who and I don't want to break the wifi connection.

Wireguard config on the Pi

[Interface]
PrivateKey = myPrivateKey
Address = 192.168.180.201/24
DNS = 192.168.180.1
DNS = fritz.box

[Peer]
PublicKey = myPublicKey
PresharedKey = Key
AllowedIPs = 192.168.180.0/24,0.0.0.0/0
Endpoint = myfritzdomain:59047
PersistentKeepalive = 25

eth0 config from /etch/dhcpcd.conf

# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
#duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# Most distributions have NTP support.
#option ntp_servers

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate SLAAC address using the Hardware Address of the interface
#slaac hwaddr
# OR generate Stable Private IPv6 Addresses based from the DUID
slaac private

interface eth0
static ip_address=192.168.1.45/16
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

5
  • You'll have to provide eth0 (especially) and wlan0 (just in case) configurations, else how can we know what kind of conflict is happening?
    – A.B
    Commented Aug 2, 2023 at 12:06
  • I added the eth0 config to the quesition. Maybe the static router and/or static domain_name_servers is the problem? It is there because when I programmed the software originally I used a local network
    – Marius
    Commented Aug 2, 2023 at 12:33
  • I commented out static router and static domain_name_servers and it seems to work
    – Marius
    Commented Aug 2, 2023 at 12:40
  • probably the /16 instead of /24 is the cause. But I wouldn't have a ready explanation (If somebody else has, please do).
    – A.B
    Commented Aug 2, 2023 at 13:27
  • It was the static router and/or static domain_name_servers. The /16 is needed because the IP of the mentioned device is 192.168.222.192.
    – Marius
    Commented Aug 3, 2023 at 6:43

1 Answer 1

0

The solution for me was to remove the lines for static routers and static domain_name_servers from /etch/dhcpcd.conf where I definded the static IP. I'm not sure if I had to remove both. I think removing the dns one should have been enough since the Pi was probably trying to find my wiregurad domain through the static dns which was not available.

Thanks A.B for the hint in the right direction.

You must log in to answer this question.

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