0

I've VPS on WEDOS serverhosting, Gentoo there. 5.4.38 kernel. I've a network interface eth0, I need to bridge it with another one (from openvpn). Starting with adding only one interface:

brctl addbr br0
brctl addif br0 eth0

Here the system hangs, nothing suspicious in dmesg. Maybe someone knows what can be the reason? Or at least what to try. When I'm adding tap0 to the bridge, it works.

aikipooh
  • 103
  • 6
  • What means "system hangs"? It ceased to react to the keyboard, etc.? Tried to switch to another console (Alt+F2 etc.)? // Also notice that **`brctl` from `bridge-utils` is a long time obsolete and should not be used anymore**. Use something like `ip link add ... type bridge` to create bridge and `ip link set ... master BRNAME` to enslave devices into it. – Nikita Kipriyanov Apr 26 '23 at 06:55
  • @NikitaKipriyanov: sorry, I've forgotten what was the problem, but yes, it wasn't reacting to anything I could imagine. I believe I've tried ip link as well. But nevermind, it's all obsolete and forgotten. – aikipooh Apr 26 '23 at 11:06

2 Answers2

0

I assume your current connection is also over eth0 When eth0 is added to br0 you should assume that IP over eth0 directly stops working. But just making sure br0 is up might in some cases allow for traffic to flow.

Sequence is something like: brctl addbr br0; ip link set br0 up; remove ip frometh0;add that ip to br0; add brctl addif br0 eth0

If ip is from DHCP things might become messy. in that case, make sure br0 is up, then stop dhcp client for eth0, add to br0 and start dhcp client on br0

NiKiZe
  • 1,246
  • 8
  • 20
  • That's what I was doing, removing IP, bringing it all up and down in every possible way:) The result is not that I lose connectivity, it's about system hanging:( – aikipooh Jul 06 '22 at 17:22
  • Does a `ip link set eth0; sleep 5; ip link set eth0` hang the machine as well? have you taken stp into account when waiting for it to come back up? Setting the net correctly in `/etc/conf.d/net` does not work? – NiKiZe Jul 06 '22 at 17:53
  • No, this command completes just fine. How to take STP into account? I've never seen a host hanging temporarily, it's either hangs completely or not. Here it's totally unresponsive. In /etc/conf.d/net the config is simple, only static addresses. It works when I configure eth0, the problem I'm experiencing is with the bridge. – aikipooh Jul 06 '22 at 18:00
  • Configure the bridge in `/etc/conf.d/net` use `config_eth0="null"` `brctl_br0="setfd 0 stp off" bridge_br0="eth0"` see net.example – NiKiZe Jul 06 '22 at 18:02
  • Thank you! Will try tomorrow, it's live server, shouldn't hang it unprepared:) – aikipooh Jul 06 '22 at 18:10
  • Of course set up a dev/test server, or even run a local vm to verify setup – NiKiZe Jul 06 '22 at 22:41
0

This is how I set up an ethernet bridge configured on my vm host. (Gentoo with openrc, so I'm using a /etc/conf.d/net to configure the network.) Note that the IP address needs to be assigned to the bridge, not the ethernet device. Otherwise things don't work.

/etc/conf.d/net:

config_eth0="null"

bridge_br0="eth0"
config_br0="10.0.0.100/24"
routes_br0="default via 10.0.0.1"
dns_servers_br0="10.0.0.2"

bridge_forward_delay_br0=0
bridge_stp_state_br0=0

Note: those last two lines are because there's only one physical interface and each VM only has one ethernet interface. In anything more complicated where there's any chance of forming a cycle you should have spanning tree protocol enabled!)

tim1724
  • 1
  • 1