Netifrc/Brctl Migration

From Gentoo Wiki
Jump to:navigation Jump to:search

This article outlines details necessary to migrate a netifrc-based bridge setup from brctl to iproute.

The utilities from the sys-apps/iproute2 package can manage bridges. It is superior than using the old specific utilities like the brctl command from net-misc/bridge-utils.

Modern Linux kernels expose bridge setting via sysfs, as result there is no need for iproute2 to support complex configuration as brctl utility, same sysfs configuration can be used for brctl based configurations as well.

brctl to iproute2 migration

The migration of brctl to iproute can be done in two phases:

  1. Migrate bridge configuration to sysfs, this can be done in stable net-misc/netifrc.
  2. Migrate bridge management into iproute2 and drop brctl usage, this requires net-misc/netifrc >= 0.4.0.

Once sysfs migration is completed, migration to iproute2 will be done as soon as netifrc supports iproute2, at this time net-misc/bridge-utils can be safely removed from system.

brctl syntax

brctl_\${NAME}="brctl-option value
brctl-option value
brctl-option port value

sysfs syntax



Old sysfs keys

In the past, bridge and brport settings were specified as variables without a prefix, now one should specify bridge_ or brport_ prefix, for example:


Should be specified as:


brctl settings

Bridge master interface

These are setting of the bridge master device, the name of interface is the bridge name.

brctl option sysfs option notes
setageing bridge_ageing_time brctl is in seconds, sysfs is in 1/100 second, multiple by 100
setgcint N/A unsupported
stp bridge_stp_state 'on', 'yes', '1' are translated to 1 otherwise 0
setbridgeprio bridge_priority
setfd bridge_forward_delay brctl is in seconds, sysfs is in 1/100 second, multiple by 100
sethello bridge_hello_time brctl is in seconds, sysfs is in 1/100 second, multiple by 100
setmaxage bridge_max_age brctl is in seconds, sysfs is in 1/100 second, multiple by 100

Bridge slave (port)

These are setting of the bridge slave device (port), the name of interface is the slave name.

brctl option sysfs option notes
setpathcost brport_path_cost
setportprio brport_priority
hairpin brport_hairpin_mode '1' or '0'


Various bridge attributes can be verified after porting the configuration by reading data from the /sys/class/net/br0/bridge/* location:

root #ls /sys/class/net/br0/bridge
ageing_time      max_age                            multicast_snooping                stp_state
bridge_id        multicast_igmp_version             multicast_startup_query_count     tcn_timer
default_pvid     multicast_last_member_count        multicast_startup_query_interval  topology_change
flush            multicast_last_member_interval     multicast_stats_enabled           topology_change_detected
forward_delay    multicast_membership_interval      nf_call_arptables                 topology_change_timer
gc_timer         multicast_mld_version              nf_call_ip6tables                 vlan_filtering
group_addr       multicast_querier                  nf_call_iptables                  vlan_protocol
group_fwd_mask   multicast_querier_interval         no_linklocal_learn                vlan_stats_enabled
hash_elasticity  multicast_query_interval           priority                          vlan_stats_per_port
hash_max         multicast_query_response_interval  root_id
hello_time       multicast_query_use_ifaddr         root_path_cost
hello_timer      multicast_router                   root_port


FILE /etc/conf.d/net
brctl_br0="setfd 15
sethello 2
stp on"


FILE /etc/conf.d/net


FILE /etc/conf.d/net
brctl_br0="setbridgeprio 50
setportprio eth0 60"


FILE /etc/conf.d/net