brona / iproute2mac

CLI wrapper for basic network utilites on Mac OS X inspired with iproute2 on Linux systems - ip command.
MIT License
898 stars 73 forks source link

Bridge management #53

Open signal-09 opened 4 months ago

signal-09 commented 4 months ago

Simple bridge management in Linux is handled by iproute2 as follow:

$ sudo ip link add name br0 type bridge
$ sudo ip link set dev br0 up
$ sudo ip link set dev eth0 master br0
$ sudo ip link set dev eth1 master br0

To remove an interface from the bridge:

$ sudo ip link set dev eth0 nomaster

In macOS the same result can be obtained with:

$ sudo ifconfig bridge0 create
$ sudo ifconfig bridge0 addm en0
$ sudo ifconfig bridge0 addm en1

And to remove an interface from the bridge:

$ sudo ifconfig bridge0 deletem en0

Bridge interfaces must be named bridge<n>, otherwise the system will throw an exception:

$ sudo ifconfig br0 create
ifconfig: SIOCIFCREATE2: Invalid argument