Bridge wan and lan ports

Sorry if this isn’t the right place for this question, but I’ve been struggling for a few days with trying to connect to the devices at the lan ports of a bpi-r3 from devices connected to another router that is connected to the bpi via wan port.

Is it possible to have the wan port in the same bridge as the lan ports? What would be the easiest/simplest way to do so? I’m using the bpi-r3 trixie image from this link: automatic-images - Google Drive

To give more details, I want to have the bpi connected to a router and be accessible via ssh, while at a static ip, while each device connected to lan ports receiving an ip at the same network as the wan, being accessible from the router as well. Is it possible?

1 Like

Yes you can use wan as lan too. I guess you use my debian/ubuntu image in R3?

Take a look in /etc/systemd/network. You will find a bunch of files like these

Delete the 15-wan.network and add wan to 21-lanbr-bind.network. should be enough after reboot…maybe restarting systemd-networkd works too,but such changes mostly need reboot

Thank you. I followed the described procedure, and it now works, but the devices connected to lan won’t get an ip when connected. Maybe I’m missing something?

Yes, I’m using the debian trixie image

I did those changes, only adding a static ip to 25-lanbr.network. Here are my files currently:

contents in /etc/systemd/network (I also backuped and deleted the wlan files, because I’m not using wireless at the moment):

01-ifnames.link  10-wan.link	  21-lanbr-bind.network  80-he-tunnel.netdev
05-eth0.network  20-lanbr.netdev  25-lanbr.network	 81-he-tunnel.network

contents of 21-lanbr-bind.network:

[Match]
Name=lan0 lan1 lan2 lan3 wan

[Network]
Bridge=lanbr0

contents of 25-lanbr.network:

[Match]
Name=lanbr0

#[Link]
# Override MAC address (spoof MAC address)
#MACAddress=08:22:33:44:55:66

[Network]
BindCarrier=eth0
#ConfigureWithoutCarrier=true

#DHCP=ipv4

#static setup
Address=192.168.18.253/24
Gateway=192.168.18.1
DNS=192.168.18.1

#VLAN=vlan500
#VLAN=vlan600

IPForward=yes
#needs iptables to be installed
#IPMasquerade=yes

Tunnel=he-ipv6

DHCPServer=yes
#IPv6SendRA=yes
#DHCPv6PrefixDelegation=yes

[DHCPServer]
PoolOffset=100
PoolSize=150

#[IPv6SendRA]
#Managed=true

#[IPv6Prefix]
#Prefix=fd00:A::/64

#[Route]
#Gateway=192.168.0.10
#Destination=10.0.3.0/24
#GatewayOnLink=yes

My router ip address is 192.168.18.1, So I added a static ip in that subnet and used it as the gateway and dns. Is this a correct procedure? Everything else was left at the defaults.

Currently, The devices seem to only be acessible via ipv6, and won’t properly work even if I configure ipv4 manually

So, is there a way to have the devices connected to lan receive an ip via dhcp and be fully acessible from my router?

I’m not sure you can use 2 dhcp aervers in same subnet and also gateway should not be in same subnet. This sounds like broken design. When you bridge ports your clients get ip address from your main router.

I do not use systemd dhcp in my setup because i have dnsmasq for this,but added basic config without installing dnsmasq in this base image. Maybe networkd misses additional package or service needs to be started separately.

Sorry for being clumsy and not properly explaining myself. I’m still a newbie to this.

I don’t want to have 2 dhcp servers. I want exactly that bridge behavior you described. By removing the static ip that I added to lanbr, The bpi works exactly like I wanted, any device connecter to the lan ports will get an ip automatically from my router’s dhcp. The only problem is that this way the bpi itself apparently doesn’t get an ip and I can’t access it via ssh. Is there a way to have the functional bridge with the bpi board also being accessible via ssh?

I will post the contents of all network files I have, to be more clear

Just disable the dhcp server should be enough.static ip is ok when in same subnet

That worked, thank you very much!! Sorry for taking your time