Addresses are not properly routed on my laptop

Here's my situation.

At home, I am using an OpenWrt device on 192.168.1.1. All other devices on this network are on the 192.168.1.0/24 subnet.

I created a Wireguard VPN on the same device, using address 192.168.9.1.

I am able to connect properly to the VPN on another network also using the 192.168.1.0 subnet, but there's a difference:

  • On my phone, 192.168.1.0/24 addresses are routed to the home network via the VPN. This is the desired behaviour.
  • On my laptop, running Ubuntu, 192.168.1.0/24 addresses are routed to the laptop's network. This is not what I want.

How can I force my laptop to use the Wireguard VPN for 192.168.1.0/24 addresses?

/etc/config/network snippet:

config interface 'VPN'
	option proto 'wireguard'
	option private_key 'wKu+6C4x6wbm/QpY34ZNJkJ5vxaQTQqKiX19NbRk3Vo='
	option listen_port '51820'
	list addresses '192.168.9.1/24'

config wireguard_VPN
	option description 'phone'
	option public_key 'redacted'
	option private_key 'redacted'
	option preshared_key 'redacted'
	list allowed_ips '192.168.9.2/32'
	option route_allowed_ips '1'

config wireguard_VPN
	option description 'laptop'
	option public_key 'redacted'
	option private_key 'redacted'
	option preshared_key 'redacted'
	option route_allowed_ips '1'
	list allowed_ips '192.168.9.3/32'

Change your openwrt lan subnet to something that is unique relative to where your Ubuntu machine is being used. It’s imperative that your local and remote subnets are non-overlapping.

2 Likes

Another way to fix it:

On Ubuntu:

Network Connections > VPN > IPv4 settings > Routes > Add:

Address 192.168.1.0, Netmask 255.255.255.0, Gateway 192.168.9.1

1 Like

Or...You can make a route (with lower metric) on the Ubuntu so that it overrides its kernel route 192.168.1.0/24 created when the interface was addressed.

I see you posted that already. The thread reloaded after I typed.

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