Commands / Interfaces and addresses

Interfaces and addresses

ip maddr

Also multicast addresses, group membership, netstat -g

Lists the multicast groups each card has joined, and the group MAC addresses it accepts.

A card normally takes only frames for its own MAC and broadcast. Each multicast group a program joins adds a group address (inet) and the matching group MAC (link, 01:00:5e:… for IPv4, 33:33:… for IPv6) to the card's list, and the kernel accepts that group's packets. Every IPv4 device is in 224.0.0.1 (all hosts); routers running OSPF add 224.0.0.5. The joins themselves come from programs (socat, a video player, a routing daemon), not from ip maddr.

ip maddr command usage

ip maddr [show [dev CARD]]

Options

show dev eth0
only eth0's groups

ip maddr examples

ip maddr show dev eth0
Lists the groups eth0 is in and the MAC addresses it accepts for them.
cat /proc/net/igmp
The same groups per card, with the IGMP version the card speaks.

Reading the output

$ ip maddr show dev eth0
11:	eth0
	link  01:00:5e:00:00:01
	link  01:00:5e:01:01:01
	inet  239.1.1.1
	inet  224.0.0.1
  • inet lines are the IPv4 groups joined; link lines the group MACs the card lets in.
  • 01:00:5e:01:01:01 is 239.1.1.1's MAC: 01:00:5e and the group's low 23 bits.

Pitfalls

  • Joining a group on the wrong card (a router or a VPN has several) means nothing arrives: the join names the card.
  • The group MAC is shared by 32 group addresses, so the card lets in groups nobody joined; the kernel drops them.

Run it on real machines

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Start with a free account: Google or email, no card.

Open this lab