Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides

FAQ
It is currently Thu Dec 07, 2023 8:07 am


Internet Protocol, Transport Control Protocol, Network protocols, Routing, Routers, IP aliases, Routes, Ethernet

Author Message
mandrei99
Post  Post subject: KVM: List MAC address table and interface that learned them.  |  Posted: Sun Feb 01, 2015 6:26 am

Joined: Tue Aug 04, 2009 9:16 am
Posts: 250

Offline
 

KVM: List MAC address table and interface that learned them.

Kernel Virtualization Module (KVM) provides an internal switch with a physical interface or bundle as an uplink and virtual network devices (through virtio driver) as port to each virtual machine’s ethX interfaces.

List KVM mac address table:


This requires brctl command.
Quote:
brctl showmacs <brname> shows a list of learned MAC addresses for this bridge.

Code:
# brctl showmacs vmbr0
port no   mac addr      is local?   ageing timer
  1   00:00:1c:17:1c:33   no         0.11
  1   00:16:c7:16:11:11   no         0.31
  1   00:16:c7:16:11:50   no         0.01
  1   00:1f:ca:a7:b7:d1   no         0.07
  1   00:61:81:aa:87:6e   no        18.01
  1   00:61:81:aa:94:da   no       117.52
  1   00:a0:d1:ea:14:2c   yes         0.00
  2   12:5a:2c:d5:81:26   yes         0.00
  2   e6:da:24:7b:6c:de   no        34.93

Port 1 being a bond0 uplink to the server has learned multiple mac addresses.
Code:
# brctl show
bridge name   bridge id      STP enabled   interfaces
vmbr0      8000.00a0d1ec142c   no      bond0
                     vmnic1e0
                     vmnic2e0

Now we know mac addresses learned by KVM switch, port IDs and port names.

KVM: List interface that learned a specific mac address:


Code:
# brctl showstp vmbr0 | grep -E “bond|vmnic”
bond0 (1)
vmnic1e0 (2)
vmnic2e0 (3)


The “showstp” output provides all interfaces inside a bridge and their IDs. “showcase” provides all mac addresses learned by the switch (mac address table) and the port IDs. Based on the two commands, each mac address can be associated to a specific virtual machine (detecting spoofed addresses).

One thing to note, every switch port has two mac addresses learned: a local one (port mac) and non-local one (belonging to the KVM virtual machine).
Code:
# ip a l vmnic1e0
45: vmnic1e0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master vmbr0 state UNKNOWN qlen 500
    link/ether 12:5a:2c:d5:81:26 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::105a:2cff:fed6:5116/64 scope link
       valid_lft forever preferred_lft forever





Top
Display posts from previous:  Sort by  
E-mail friendPrint view

Topics related to - "KVM: List MAC address table and interface that learned them."
 Topics   Author   Replies   Views   Last post 
There are no new unread posts for this topic. Linux How to change hardware MAC address of an interface

debuser

1

3598

Tue Dec 06, 2011 6:26 am

Zettie49 View the latest post

There are no new unread posts for this topic. FreeBSD list interface multicast group membership

mandrei99

0

4655

Tue Dec 03, 2013 9:02 am

mandrei99 View the latest post

There are no new unread posts for this topic. FreeBSD list the outgoing interface for packets to a specific IP destination

mandrei99

0

2951

Mon Jul 22, 2013 10:12 am

mandrei99 View the latest post

There are no new unread posts for this topic. Linux list the outgoing interface for packets to a specific IP destination

mandrei99

0

3303

Mon Jul 22, 2013 10:17 am

mandrei99 View the latest post

There are no new unread posts for this topic. "OSPF not enabled on this interface" FreeBSD Quagga ospfd interface status

debuser

1

5519

Thu Apr 01, 2010 5:55 am

debuser View the latest post

There are no new unread posts for this topic. FreeBSD find pid that opened TCP/UDP socket without lsof using address of protocol control block(PCB

mandrei99

0

3365

Wed Dec 11, 2013 4:56 am

mandrei99 View the latest post

There are no new unread posts for this topic. FreeBSD show network interface statistics

mandrei99

0

5693

Wed Sep 25, 2013 9:30 am

mandrei99 View the latest post

There are no new unread posts for this topic. Linux script for interface network bandwidth monitoring

admin

0

3738

Mon Feb 09, 2015 7:05 pm

admin View the latest post

There are no new unread posts for this topic. How to accept IPv6 Router Advertisements on interface in FreeBSD

mandrei99

0

3807

Wed Apr 29, 2015 3:54 am

mandrei99 View the latest post

There are no new unread posts for this topic. FreeBSD + IPerf send multicast source traffic via specific interface

mandrei99

3

6230

Sat Apr 11, 2015 5:28 am

areeba View the latest post

 

Who is online
Users browsing this forum: No registered users and 2 guests
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
Jump to:  
cronNews News Site map Site map SitemapIndex SitemapIndex RSS Feed RSS Feed Channel list Channel list


Delete all board cookies | The team | All times are UTC - 5 hours [ DST ]



phpBB SEO