4

In the following diagram, each color stands for a network namespace, which is connected by a Linux bridge v-net-0.

  • veth-red and veth-red-br are a pair of veth.
  • veth-blue and veth-blue-br are a pair of veth.
  • v-net-0 is a linux bridge.

enter image description here

what does "master" mean in this command?

ip link set veth-blue-br master v-net-0

I have checked the man page of ip link set, but still don't understand the meaning of flag master.

1 Answer 1

3

I will assume:

  • v-net-0 was created with something like ip link add name v-net-0 type bridge
  • veth-blue-br was created with something like ip link add veth-blue-br type veth peer name veth-blue

It is my understanding that the "master" parameter adds your virtual interface "veth-blue-br" into the bridge called "v-net-0".

I find the term "master" to be a bit confusing for bridging, but I suppose from a certain point of view, it makes sense. From the point of view of the "ip" command, which is generic in the sense that it can configure a number of types of interfaces (e.g. bond, vlan - not just bridge), it is useful to have similar terms (e.g. master) when indicating that an interface is dependant upon another. However, if you happen to be familiar with bridging / switching outside of the iproute2 software world (the ip command is part of iproute2), then the term "master" might be a bit confusing.

The obsolete command "brctl", has a sub-command called "addif", and if you read the man page for brctl, there is a reasonable description under "addif" (quoted below), and I believe this is what the "master" parameter in "ip link set" is doing. Note that brctl makes no mention of the word "master". The functionality from brctl has been added to ip/bridge from iproute2. However, there are useful sections from the brctl man page which don't seem to have made it into the ip/bridge man pages.

The command brctl addif <brname> <ifname> will make the interface <ifname> a port of the bridge <brname>. This means that all frames received on <ifname> will be processed as if destined for the bridge. Also, when sending frames on <brname>, <ifname> will be considered as a potential output interface.

3
  • Thanks for your feedback. I have added more details as context.
    – Ryan Lyu
    Apr 28, 2022 at 8:22
  • There's a number of interface constructs that can point to another interface, and they all share the property that this interface is now dependent on the "master", which is the reason for the name.
    – dirkt
    Apr 28, 2022 at 11:11
  • @dirkt Agreed. From the point of view of the "ip" command, which is generic in the sense that it can configure a number of types of interfaces (not just bridge), it is useful to have similar terms (e.g. master) when indicating that an interface is dependant upon another. However, if you happen to be familiar with bridging / switching outside of the iproute2 software world, then the term "master" might be a bit confusing. I will attempt to clarify my answer on that point.
    – DericS
    Apr 28, 2022 at 12:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.