Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED]why doesn't bridging assign mac addresses correctly?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
razamatan
Apprentice
Apprentice


Joined: 28 Feb 2003
Posts: 160

PostPosted: Wed Nov 07, 2012 6:04 pm    Post subject: [SOLVED]why doesn't bridging assign mac addresses correctly? Reply with quote

i have a pretty stock conf.d/net

Code:

# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d.  To create a more complete configuration,
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).

#config_eth0="10.1.0.99/24"

#config_eth0="dhcp"
#dhcpcd_eth0="-O ntp_servers"

bridge_br0="eth0 tap0 tap1"
brctl_br0="setfd 0 sethello 0 stp off"
rc_need_br0="net.tap0 net.tap1"

config_br0="10.1.0.99/24"
routes_br0="default via 10.1.0.1"
dns_domain_br0="example.com"
dns_servers_br0="10.1.0.1"
dns_search_br0="example.com"

config_tap0="null"
tuntap_tap0="tap"
tunctl_tap0="-u me"
mac_tap0="00:00:00:00:01:00"

config_tap1="null"
tuntap_tap1="tap"
tunctl_tap1="-u me"
mac_tap1="00:00:00:00:01:01"

config_eth0="null"



but i end up w/ this ifconfig

Code:

br0       Link encap:Ethernet  HWaddr 00:00:00:00:01:00 
          inet addr:10.1.0.99  Bcast:10.1.0.255  Mask:255.255.255.0
          inet6 addr: fe80::200:ff:fe00:100/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:487584 errors:0 dropped:463 overruns:0 frame:0
          TX packets:442556 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:188960068 (180.2 MiB)  TX bytes:420948649 (401.4 MiB)

eth0      Link encap:Ethernet  HWaddr bc:5f:f4:3b:97:f3 
          inet6 addr: fe80::be5f:f4ff:fe3b:97f3/64 Scope:Link
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:39990746 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16723989 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:56738232789 (52.8 GiB)  TX bytes:3455104579 (3.2 GiB)

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4364375 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4364375 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1223399867 (1.1 GiB)  TX bytes:1223399867 (1.1 GiB)

tap0      Link encap:Ethernet  HWaddr 00:00:00:00:01:00 
          inet6 addr: fe80::200:ff:fe00:100/64 Scope:Link
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:21603 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12398 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:9463952 (9.0 MiB)  TX bytes:12534014 (11.9 MiB)

tap1      Link encap:Ethernet  HWaddr 96:3b:32:d0:e1:9d 
          inet6 addr: fe80::943b:32ff:fed0:e19d/64 Scope:Link
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:297612 errors:0 dropped:0 overruns:0 frame:0
          TX packets:308407 errors:0 dropped:1 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:13713605 (13.0 MiB)  TX bytes:434156747 (414.0 MiB)



based on my net config, shouldn't my taps get 01:00 and 01:01 while my bridge stays w/ some random mac address?

the 2 extra taps work though....
_________________
a razamatan doth speaketh,
"Never attribute to malice, that which can be adequately explained by stupidity"


Last edited by razamatan on Thu Nov 08, 2012 6:14 am; edited 1 time in total
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Wed Nov 07, 2012 6:10 pm    Post subject: Reply with quote

The bridge inherits the MAC address of the first interface assigned to it. It's done that way so connections don't immediately get dropped, but if you really have a good reason for it to have a random MAC you could always assign a dummy interface with a random address first.
Back to top
View user's profile Send private message
Mad Merlin
Veteran
Veteran


Joined: 09 May 2005
Posts: 1155

PostPosted: Thu Nov 08, 2012 12:21 am    Post subject: Reply with quote

Ant P. wrote:
The bridge inherits the MAC address of the first interface assigned to it. It's done that way so connections don't immediately get dropped, but if you really have a good reason for it to have a random MAC you could always assign a dummy interface with a random address first.


Actually the bridge takes on the lowest MAC address of the interfaces in it. As you can imagine, this means that the bridge MAC address can change over time (and if you have STP enabled, will cause network breaks to the host while the forward delay timer is ticking).

One approach is to use the randomly generated tap MAC addresses, but replace the high order octet pair with FE (and if you're pedantic, like me, make sure that you didn't just cause a MAC address collision), that way your bridge will always keep your physical interfaces' MAC address, unless you're unlucky enough to have a real interface with MAC address starting with FE (but I have yet to see one of these in the wild).
_________________
Game! - Where the stick is mightier than the sword!
Back to top
View user's profile Send private message
razamatan
Apprentice
Apprentice


Joined: 28 Feb 2003
Posts: 160

PostPosted: Thu Nov 08, 2012 6:13 am    Post subject: Reply with quote

hmm.. i just tried rebooting /w the mac_tapN stuff set, and it didn't work (things hung when sshd started up). removing them fixed things, and it appears things get randomly assigned anyway. ultimately, this was trying to get bridging to multiple vms to work, and it seems that the macaddr i set for the virts doesn't have to agree with the what's specified for the taps anyway.

solved. thanks all.
_________________
a razamatan doth speaketh,
"Never attribute to malice, that which can be adequately explained by stupidity"
Back to top
View user's profile Send private message
razamatan
Apprentice
Apprentice


Joined: 28 Feb 2003
Posts: 160

PostPosted: Fri Mar 18, 2016 6:25 am    Post subject: Reply with quote

for posterity, the final setup for me to get a stable br0 mac address is to bind it to the physical nic's mac.
_________________
a razamatan doth speaketh,
"Never attribute to malice, that which can be adequately explained by stupidity"
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum