Monday, April 23, 2012

Linux Display Ethernet Bridge Name and Information

How do I display a list of bridges under Linux? How do I show info about the Ethernet bridge configuration in the Linux kernel?

Bridging used in packet-switched networks and only used in local area networks. It connects multiple network segments at the Layer 2 so that these ethernets will appear as one ethernet to the participants.Each of the ethernets being connected corresponds to one physical interface in the bridge. These individual ethernets are bundled into one biggerethernet, this bigger ethernet corresponds to the bridge network interface.

brctl command

You need to use the brctl command, which is used to set up, maintain, and display the Ethernet bridge configuration in the Linux systems. Open a command-line terminal (select Applications > Accessories > Terminal), or login to remote system using the ssh client, and then type the following commands.

Linux Show All Instances of The Ethernet Bridge

Type the following command as the root user, enter:
# brctl show
Sample outputs:
bridge name bridge id  STP enabled interfaces
br0 8000.0030488e31ac no eth0
br1 8000.0030488e31ad no eth1

Display Mac Address

To display a list of learned MAC addresses for br0 bridge, enter:
# brctl showmacs br0
Sample outputs:
port no mac addr  is local? ageing timer
1 00:1a:30:38:a8:00 no 0.00
1 00:1b:53:bb:a7:a1 no 5.06
1 00:30:48:32:d7:aa no 0.27
1 00:30:48:33:bc:32 no 0.03
1 00:30:48:8c:57:d2 no 0.65
1 00:30:48:8e:31:ac yes 0.00
1 02:30:48:8e:31:ac no 12.86

Show br0 IP Address Information

To see ip address assinged to br0, enter:
# ifconfig br0
OR
# ip addr show br0
Sample outputs:
br0       Link encap:Ethernet  HWaddr 00:30:48:8E:31:AC
inet addr:10.10.29.74 Bcast:10.10.29.127 Mask:255.255.255.192
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:382175211 errors:0 dropped:0 overruns:0 frame:0
TX packets:290454591 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:275381068495 (256.4 GiB) TX bytes:224019772370 (208.6 GiB)

How Do I See and Change Ethernet Bridge Network Configuration File?

Under RHEL / Fedora / CentOS / Redhat Linux Ethernet bridge network configuration for br0 stored as follows:
  1. /etc/sysconfig/network-scripts/ifcfg-eth0 - Specify bridge name
  2. /etc/sysconfig/network-scripts/ifcfg-br0 - br0 config file.
  3. /etc/sysconfig/network-scripts/route-br0 - Static routing (optional).
Debian or Ubuntu Linux user should use /etc/network/interfaces configuration file. A typical example is as follows:
# cat /etc/network/interfaces
Sample outputs:
 
# The loopback network interface
auto lo br0
iface lo inet loopback
 
# Set up interfaces manually
iface eth0 inet manual
iface eth1 inet manual
 
# Bridge setup
iface br0 inet static
bridge_ports eth0 eth1
address 192.168.1.100
broadcast 192.168.1.255
netmask 255.255.255.0
gateway 192.168.1.254
 

No comments:

Post a Comment