My server is behind a DHCP-enabled router, and it has two network interfaces, wlan0 and bge0. I want to use them together, so I bind them, plus tap0 to bridge0. But bridge has a random MAC address for each time it was created, which makes me hard to reserve an IP for it (since I need to forward some ports to this server). So I set net.link.bridge.inherit_mac=1, which makes bridge0 to use bge0's MAC address, always. But this causes another problem: the packets sent to bridge0 is also sent to bge0, -- the packets are duplicated! The kernel have to drop half of them. So how can I bind a distinct MAC address to a bridge? -- Zhihao Yuan The best way to predict the future is to invent it.
On Fri, Feb 25, 2011 at 12:56:55AM -0600, Zhihao Yuan wrote:> My server is behind a DHCP-enabled router, and it has two network > interfaces, wlan0 and bge0. I want to use them together, so I bind > them, plus tap0 to bridge0. But bridge has a random MAC address for > each time it was created, which makes me hard to reserve an IP for it > (since I need to forward some ports to this server). So I set > net.link.bridge.inherit_mac=1, which makes bridge0 to use bge0's MAC > address, always. But this causes another problem: the packets sent to > bridge0 is also sent to bge0, -- the packets are duplicated! The > kernel have to drop half of them. So how can I bind a distinct MAC > address to a bridge?I'm not trying to divert you from what you're trying to solve, but can you accomplish what you need without use of bridge(4)? I ask this because I just set up a home NAT router of my own which has 3 interfaces on it: em0 (WAN/connects to cable modem), em1 (LAN), and ath0/wlan0 (for wireless). I *explicitly* chose not to use bridge(4) because of the MAC address complications, and instead use two separate private networks (192.168.1.0/24 for em1 and 192.168.200.0/24 for wlan0). This works without any hitches, no MAC issues, etc.. -- | Jeremy Chadwick jdc@parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, USA | | Making life hard for others since 1977. PGP 4BD6C0CB |
On 25/02/2011, at 17:26, Zhihao Yuan wrote:> (since I need to forward some ports to this server). So I set > net.link.bridge.inherit_mac=1, which makes bridge0 to use bge0's MAC > address, always. But this causes another problem: the packets sent to > bridge0 is also sent to bge0, -- the packets are duplicated! The > kernel have to drop half of them. So how can I bind a distinct MAC > address to a bridge?Does bge0 have an address? It shouldn't. You can set the MAC address of the bridge with.. ifconfig bridge0 lladdr aa:bb:dd:ee:ff:gg -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
Am 25.02.2011 um 07:56 schrieb Zhihao Yuan:> My server is behind a DHCP-enabled router, and it has two network > interfaces, wlan0 and bge0. I want to use them together, so I bind > them, plus tap0 to bridge0. But bridge has a random MAC address for > each time it was created, which makes me hard to reserve an IP for it > (since I need to forward some ports to this server). So I set > net.link.bridge.inherit_mac=1, which makes bridge0 to use bge0's MAC > address, always. But this causes another problem: the packets sent to > bridge0 is also sent to bge0, -- the packets are duplicated! The > kernel have to drop half of them. So how can I bind a distinct MAC > address to a bridge?This is in my router's rc.conf: ifconfig_bridge0="ether 02:00:00:00:00:01 addm tap0 addm vlan1" ifconfig_bridge0_alias0="inet 192.168.0.1/24" vlan1 is on em0; neither as an address assigned. And if you want to put IPv6 on there, you also have to add a link-local address to make rtadvd happy, something like: ipv6_network_interfaces="bridge0 gif0" ipv6_ifconfig_bridge0="fe80::21c:c0ff:fe7d:8c50%bridge0" ipv6_ifconfig_bridge0_alias0="2001:470:1f0b:xxxx::1 prefixlen 64" -- Stefan Bethke <stb@lassitu.de> Fon +49 151 14070811