DHCP not working on bridge interface

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DHCP not working on bridge interface

Jump to solution
1,813 Views
Phill231
Contributor III

Hello,
I have a IMX6ULL based custom board with Yocto, and I am currently facing some problems with DHCP on a bridge interface. The IMX6ULL is connected via RMII to a Marvell 88E6320 switch, which has two external Ethernet ports. Below is my device tree configuration:

&fec1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_enet1>;
	phy-mode = "rmii";
	status = "okay";
    fixed-link {
        speed = <100>;
        full-duplex;
    };
	mdio {
		#address-cells = <1>;
		#size-cells = <0>;
		switch@0 {
			compatible = "marvell,mv88e6085";
			reg = <0>;
			dsa,member = <0 0>;
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_marvell>;
			reset-gpios = <&gpio5 1 GPIO_ACTIVE_LOW>; 
			status = "okay";
			#address-cells = <1>;
			#size-cells = <0>;
			ports {
				#address-cells = <1>;
				#size-cells = <0>;
				port@3 {
					reg = <3>;
					label = "lan3";
				};
				port@4 {
					reg = <4>;
					label = "lan4";
				};
				port@6 {
					reg = <6>;
					label = "cpu";
					ethernet = <&fec1>;
					phy-mode = "rmii";

					fixed-link {
						speed = <100>;
						full-duplex;
					};
				};
			};
		};
	};
};



To create a bridge (with lan3 connected to my PC and lan4 connected to my home switch), I run the following commands:

ip link set lan3 up
ip link set lan4 up
ip link add br0 type bridge
ip link set br0 up
ip link set lan3 master br0
ip link set lan4 master br0


Then I try to request a DHCP lease and I get this output:

root@imx6ull-test:~# udhcpc -i br0
udhcpc: started, v1.36.1
Dropped protocol specifier '.udhcpc' from 'br0.udhcpc'. Using 'br0' (ifindex=6).
udhcpc: broadcasting discover
udhcpc: broadcasting discover
udhcpc: broadcasting discover
udhcpc: no lease, failing


However, if I restart the board and run DHCP directly on lan4:

ip link set lan4 up
udhcpc -i lan4


I do get an IP address from my home DHCP server as expected.

Is there something wrong with how I'm configuring the bridge?

Labels (4)
0 Kudos
Reply
1 Solution
1,540 Views
Phill231
Contributor III

I have resolved the issue by enabling the CONFIG_BRIDGE_VLAN_FILTERING option in the kernel menuconfig.

View solution in original post

0 Kudos
Reply
3 Replies
1,541 Views
Phill231
Contributor III

I have resolved the issue by enabling the CONFIG_BRIDGE_VLAN_FILTERING option in the kernel menuconfig.

0 Kudos
Reply
1,655 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi,

Please refer kernel document:

https://www.kernel.org/doc/html/v5.10/networking/dsa/configuration.html

# tag traffic on CPU port
ip link add link eth0 name eth0.1 type vlan id 1

# The master interface needs to be brought up before the slave ports.
ip link set eth0 up
ip link set eth0.1 up

# bring up the slave interfaces
ip link set lan1 up
ip link set lan2 up
ip link set lan3 up

# create bridge
ip link add name br0 type bridge

# activate VLAN filtering
ip link set dev br0 type bridge vlan_filtering 1

# add ports to bridge
ip link set dev lan1 master br0
ip link set dev lan2 master br0
ip link set dev lan3 master br0
ip link set eth0.1 master br0

# tag traffic on ports
bridge vlan add dev lan1 vid 1 pvid untagged
bridge vlan add dev lan2 vid 1 pvid untagged
bridge vlan add dev lan3 vid 1 pvid untagged

# configure the bridge
ip addr add 192.0.2.129/25 dev br0

# bring up the bridge
ip link set dev br0 up



Best Regards,
Zhiming

0 Kudos
Reply
1,556 Views
Phill231
Contributor III

Hello,
thank you for your reply.
I followed the documentation page you linked (https://www.kernel.org/doc/html/v5.10/networking/dsa/configuration.html#bridge), and the system works correctly with a static IP. However, if I try to use DHCP instead, I don't receive any response. These are the commands I used:

ip link set eth0 up  
ip link set lan3 up  
ip link set lan4 up  
ip link add name br0 type bridge  
ip link set dev lan3 master br0  
ip link set dev lan4 master br0  
ip link set dev br0 up

root@imx6ull:~# udhcpc -i br0
udhcpc: started, v1.36.1
Dropped protocol specifier '.udhcpc' from 'br0.udhcpc'. Using 'br0' (ifindex=6).
udhcpc: broadcasting discover
udhcpc: broadcasting discover
udhcpc: broadcasting discover
udhcpc: broadcasting discover
udhcpc: broadcasting discover
udhcpc: broadcasting discover
run-parts: /etc/udhcpc.d/99avahi-autoipd: exit status 1
udhcpc: broadcasting discover
udhcpc: broadcasting discover
udhcpc: broadcasting discover
run-parts: /etc/udhcpc.d/99avahi-autoipd: exit status 1
udhcpc: broadcasting discover
udhcpc: broadcasting discover
udhcpc: broadcasting discover
run-parts: /etc/udhcpc.d/99avahi-autoipd: exit status 1
udhcpc: broadcasting discover
udhcpc: broadcasting discover
udhcpc: broadcasting discover
run-parts: /etc/udhcpc.d/99avahi-autoipd: exit status 1


I also tried using the commands you suggested, but I get the following error on the first command:

root@imx6ull:~# ip link add link eth0 name eth0.1 type vlan id 1  
Error: dsa_core: DSA master cannot join unknown upper interfaces.

 

0 Kudos
Reply