- CONFIGURE 802.1Q VLAN TAGGING USING THE COMMAND LINE TOOL, NMCLI
- nmcliで仮想ブリッジ作成
- RHEL7/CentOS7のnmcliコマンドでTeamデバイス/Bondingデバイス/VLAN/ブリッジを組み合わせる方法
- CentOS7/ネットワーク設定
- CentOS7.1:
- VLANを作る際のインターフェースの名前: 物理インターフェース名.VLAN番号
- 物理インターフェース: enp3s0, VLAN: 212の場合
- VLANインターフェース名: enp3s0.212
- ブリッジを作る際のインターフェースの名前: br + VLANインターフェース名
- VLANインターフェース名: enp3s0.212
- ブリッジインターフェース名: brenp3s0.212
- VLANの作成
- ブリッジインターフェースの作成
- STPの無効化
- ブリッジインターフェースへのIPアドレスの適用
- ブリッジインターフェースとVLANインターフェースの関連づけ
- ブリッジインターフェースのup
- VLANインターフェースのup
# nmcli con add type vlan ifname enp3s0.212 dev enp3s0 id 212
Connection 'vlan-enp3s0.212' (c77e2971-82f3-4178-9bb8-736b8504f7ca) successfully added.
確認
# nmcli c show
NAME UUID TYPE DEVICE
vlan-enp3s0.212 c77e2971-82f3-4178-9bb8-736b8504f7ca vlan enp3s0.212
...
# nmcli c add type bridge ifname brenp3s0.212
Connection 'bridge-brenp3s0.212' (3a123216-e56d-41a4-8303-14bfb8b4288f) successfully added.
確認
# nmcli c show
NAME UUID TYPE DEVICE
vlan-enp3s0.212 c77e2971-82f3-4178-9bb8-736b8504f7ca vlan enp3s0.212
bridge-brenp3s0.212 3a123216-e56d-41a4-8303-14bfb8b4288f bridge brenp3s0.212
# nmcli con modify bridge-brenp3s0.212 bridge.stp no
確認、STP enabledがnoになっていることを確認します。
# brctl show
bridge name bridge id STP enabled interfaces
brenp3s0.212 8000.000000000000 no
# nmcli con modify bridge-brenp3s0.212 ipv4.method manual ipv4.addresses 192.168.212.10/24
確認
# con show bridge-brenp3s0.212
connection.id: bridge-brenp3s0.212
...
ipv4.method: manual
...
ipv4.addresses: 192.168.212.10/24
# nmcli c mod vlan-enp3s0.212 connection.master brenp3s0.212 connection.slave-type bridge
# nmcli c show vlan-enp3s0.212
connection.id: vlan-enp3s0.212
connection.uuid: c77e2971-82f3-4178-9bb8-736b8504f7ca
connection.interface-name: enp3s0.212
...
connection.master: brenp3s0.212
connection.slave-type: bridge
# nmcli conn up bridge-brenp3s0.212
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/8)
確認
# brctl show
bridge name bridge id STP enabled interfaces
brenp3s0.212 8000.000000000000 no
# nmcli conn up vlan-enp3s0.212
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/9)
interfacesにenp3s0.212が設定される。
# brctl show
bridge name bridge id STP enabled interfaces
brenp3s0.212 8000.002590df8219 no enp3s0.212