OS導入直後の、初期状態の /etc/sysconfig/network-scripts/ifcfg-eth0 サンプル
[root@localhost ~]# less /etc/sysconfig/network-scripts/ifcfg-eth0 |
HWADDR=xx:xx:xx:xx:xx:xx TYPE=Ethernet BOOTPROTO=dhcp DEFROUTE=yes PEERDNS=yes PEERROUTES=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_PEERDNS=yes IPV6_PEERROUTES=yes IPV6_FAILURE_FATAL=no NAME=eth0 UUID=abb51b04-420b-49bb-bfca-3c159ebbc6ee ONBOOT=no |
nmcli device の実行結果
[root@localhost ~]# nmcli device |
DEVICE TYPE STATE CONNECTION eth0 ethernet connected eth0 lo loopback unmanaged --
[root@localhost ~]# nmcli connection show |
NAME UUID TYPE DEVICE eth0 f3b463df-5cc8-4c3b-b5d4-c245134f77fe ethernet eth0
実行結果例
[root@localhost ~]# nmcli c add type bridge ifname br0 |
Connection 'bridge-br0' (f1ea72c8-e773-4bd9-aff7-d6873b015f74) successfully added. |
ifcfg-bridge-br0 の中身を確認する
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-bridge-br0 |
DEVICE=br0 STP=yes BRIDGING_OPTS=priority=32768 TYPE=Bridge BOOTPROTO=dhcp DEFROUTE=yes PEERDNS=yes PEERROUTES=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_PEERDNS=yes IPV6_PEERROUTES=yes IPV6_FAILURE_FATAL=no NAME=bridge-brenp3s0 UUID=f1ea72c8-e773-4bd9-aff7-d6873b015f74 ONBOOT=yes
[root@localhost ~]# nmcli con modify bridge-br0 bridge.stp no |
もう一度ファイルを確認する。STP=no に変わっていることがわかる。
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-bridge-br0 |
DEVICE=br0 STP=no TYPE=Bridge BOOTPROTO=dhcp DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no NAME=bridge-brenp3s0 UUID=f1ea72c8-e773-4bd9-aff7-d6873b015f74 ONBOOT=yes PEERDNS=yes PEERROUTES=yes IPV6_PEERDNS=yes IPV6_PEERROUTES=yes
[root@localhost ~]# nmcli con modify bridge-br0 ipv4.method manual ipv4.addresses 10.10.10.2/24 |
ファイルを確認する。IPアドレス(IPADDR0)が設定されていることが確認できる。またネットマスク(PREFIX0)がセットされている。
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-bridge-br0 |
DEVICE=br0 STP=no TYPE=Bridge BOOTPROTO=none DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no NAME=bridge-brenp3s0 UUID=f1ea72c8-e773-4bd9-aff7-d6873b015f74 ONBOOT=yes IPADDR0=10.10.10.2 PREFIX0=24 IPV6_PEERDNS=yes IPV6_PEERROUTES=yes
ifcfg-eth0 の確認、こちらは特に変化がない
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 |
HWADDR=xx:xx:xx:xx:xx:xx TYPE=Ethernet BOOTPROTO=dhcp DEFROUTE=yes PEERDNS=yes PEERROUTES=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_PEERDNS=yes IPV6_PEERROUTES=yes IPV6_FAILURE_FATAL=no NAME=eth0 UUID=abb51b04-420b-49bb-bfca-3c159ebbc6ee ONBOOT=no
[root@localhost ~]# nmcli con add type bridge-slave ifname eth0 master bridge-br0 |
Connection 'bridge-slave-eth0' (3264fc3b-9b7c-4241-87b0-3b207dc7cc92) successfully added. |
新しく、ifcfg-bridge-slave-eth0 というファイルができました。
[root@localhost ~]# ls /etc/sysconfig/network-scripts/ |
ifcfg-bridge-eth0 ifcfg-bridge-slave-eth0 ifcfg-eth0 |
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-bridge-slave-eth0 |
TYPE=Ethernet NAME=bridge-slave-eth0 UUID=3264fc3b-9b7c-4241-87b0-3b207dc7cc92 DEVICE=eth0 ONBOOT=yes BRIDGE=f1ea72c8-e773-4bd9-aff7-d6873b015f74 |
[root@localhost ~]# nmcli device |
br0 bridge connected bridge-br0 eth0 ethernet connected bridge-slave-eth0 lo loopback unmanaged --
[root@localhost ~]# nmcli c show |
NAME UUID TYPE DEVICE eth0 abb51b04-420b-49bb-bfca-3c159ebbc6ee ethernet -- bridge-slave-eth0 3264fc3b-9b7c-4241-87b0-3b207dc7cc92 ethernet eth0 bridge-br0 f1ea72c8-e773-4bd9-aff7-d6873b015f74 bridge br0
[root@localhost ~]# nmcli con modify eth0 ipv4.dns "" ipv4.addresses "" ipv4.dns-search "" ipv4.method disable |
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 |
TYPE=Ethernet DEFROUTE=yes PEERDNS=yes PEERROUTES=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no NAME=eth0 UUID=abb51b04-420b-49bb-bfca-3c159ebbc6ee ONBOOT=no HWADDR=xx:xx:xx:xx:xx:xx IPV6_PEERDNS=yes IPV6_PEERROUTES=yes
[root@localhost ~]# systemctl restart NetworkManager |
[root@localhost ~]# nmcli d |
DEVICE TYPE STATE CONNECTION br0 bridge connected bridge-br0 eth0 ethernet connected bridge-slave-eth0 lo loopback unmanaged --
[root@localhost ~]# nmcli c show |
nmcli c show NAME UUID TYPE DEVICE bridge-slave-eth0 3264fc3b-9b7c-4241-87b0-3b207dc7cc92 ethernet eth0 bridge-br0 f1ea72c8-e773-4bd9-aff7-d6873b015f74 bridge br0 eth0 9bd21e62-df5c-4d81-ab1d-b5a46de5ed5d ethernet -- eth0 abb51b04-420b-49bb-bfca-3c159ebbc6ee ethernet --
[root@localhost ~]# grep f1ea72c8-e773-4bd9-aff7-d6873b015f74 ifcfg-* |
ifcfg-bridge-br0:UUID=f1ea72c8-e773-4bd9-aff7-d6873b015f74 ifcfg-bridge-slave-eth0:BRIDGE=f1ea72c8-e773-4bd9-aff7-d6873b015f74 |
[root@localhost ~]# brctl show |
bridge name bridge id STP enabled interfaces br0 8000.002590df8219 no eth0