How to addif to bridge automatically

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

How to addif to bridge automatically

2,163 Views
stevenyu
Contributor III

Hi,

We have verify below commands and it works ok.

brctl addbr br0

brctl addif br0 eth0

brctl addif br0 usb0

ifconfig br0 192.168.20.1

Then, we want to bring the bridge interface br0 up automatically, so we add some lines to /etc/network/interfaces file as below, but system does not add eth0 and usb0 interface into bridge. Do you know what we miss or where is the point to interpret the content of /etc/network/interfaces, and then we can printf there to see the problem.

auto br0

bridge_ports eth0 usb0

iface br0 inet static
address 192.168.20.1
netmask 255.255.255.0
network 192.168.20.0
gateway 192.168.20.100

root@imx6ull14x14evk:~# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.000000000000 no


root@imx6ull14x14evk:~# ifconfig br0
br0 Link encap:Ethernet HWaddr 46:D4:97:C3:26:B0
inet addr:192.168.20.1 Bcast:192.168.20.255 Mask:255.255.255.0
inet6 addr: fe80::44d4:97ff:fec3:26b0%2129824624/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:37 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:6708 (6.5 KiB)

root@imx6ull14x14evk:~#

Regards,

Steven Yu

Labels (1)
0 Kudos
Reply
3 Replies

1,418 Views
b36401
NXP Employee
NXP Employee

Please note that ethernet bridge should be configured when no IP addresses are assigned to ethernet interfaces.
So you can add ethernet bridge configuration into system init scripts prior to IP configuration.

Have a great day,
Victor

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

1,418 Views
stevenyu
Contributor III

Hi Victor,

The bridge interface br0 is up already, but there are no interfaces like eth0 or usb0.

Some network document mention bridge_ports can be used to add interface as below, but it looks like not work in yocto. Any problem in my configuration?

auto br0
iface br0 inet static
bridge_ports eth0 usb0
address 192.168.20.1
netmask 255.255.255.0
gateway 192.168.20.100

root@imx6ull14x14evk:~# ifconfig br0
br0 Link encap:Ethernet HWaddr 96:2A:05:11:59:93
inet addr:192.168.20.1 Bcast:192.168.20.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:2459 (2.4 KiB)

root@imx6ull14x14evk:~# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.000000000000 no

If we add interface manually, it can be added to bridge successfully. We don't know why bridge_ports not work correctly?
root@imx6ull14x14evk:~# brctl addif br0 eth0
device eth0 entered promiscuous mode
root@imx6ull14x14evk:~# brctl addif br0 usb0
device usb0 entered promiscuous mode
br0: port 2(usb0) entered forwarding state
br0: port 2(usb0) entered forwarding state
root@imx6ull14x14evk:~# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.00049f04b69f no eth0
                                           usb0
root@imx6ull14x14evk:~#

Regards,

Steven Yu

0 Kudos
Reply

337 Views
Ypi
Contributor III

Have you solved this issue?

0 Kudos
Reply