Difference between revisions of "CentOS 8.x Creating bridge interfaces (br0) for virtual hosts to use shared interface"
m |
m |
||
Line 39: | Line 39: | ||
'''Caution: You will get disconnected if you run below commands remotely. Plan for secondary access to machine via virtualization platform / iDRAC etc. before doing below'''. | |||
For changes to take effect restart NetworkManager service using: | For changes to take effect restart NetworkManager service using: | ||
<pre> | <pre> | ||
systemctl stop NetworkManager | systemctl stop NetworkManager; systemctl start NetworkManager | ||
systemctl start NetworkManager | |||
</pre> | </pre> | ||
OR stop / start networking using: | OR stop / start networking using: | ||
<pre> | <pre> | ||
nmcli networking off | nmcli networking off; nmcli networking on | ||
nmcli networking on | |||
</pre> | </pre> | ||
Revision as of 12:25, 12 February 2021
<yambe:breadcrumb self="Creating bridge interfaces (br0) for virtual hosts to use shared interface">CentOS 8.x Network configuration|Network configuration</yambe:breadcrumb>
To create bridge interfaces in CentOS 8.0 (or even 7.0) almost same settings as described in older Creating bridge interfaces (br0) for virtual hosts to use shared interface, with an additional 'NAME=' parameter in both interface configuration files. Example configuration files for CentOS 8.0 bridge are:
In /etc/sysconfig/network-scripts/ifcfg-br0
NAME="br0" DEVICE="br0" TYPE="Bridge" BOOTPROTO="dhcp" ONBOOT="yes"
In /etc/sysconfig/network-scripts/ifcfg-<interface-name>
NAME="<interface-name>" DEVICE="<interface-name>" TYPE="Ethernet" BOOTPROTO="none" ONBOOT="yes" BRIDGE="br0"
where <interface-name> can be eth0, enp0s1, eno1, etc.
If you want to specify additional settings such as for IPV6 they should all go in ifcfg-br0 file only. Example settings that can go to ifcfg-br0 are:
DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy
These should be removed from ifcfg-<interface-name> file to avoid duplication.
Caution: You will get disconnected if you run below commands remotely. Plan for secondary access to machine via virtualization platform / iDRAC etc. before doing below.
For changes to take effect restart NetworkManager service using:
systemctl stop NetworkManager; systemctl start NetworkManager
OR stop / start networking using:
nmcli networking off; nmcli networking on
Validate that bridge is having ip address and not interface:
nmcli connection show nmcli connection show <ethernet-interface> | grep br0
Should show
connection.master: br0
Other option is to use command:
bridge link
which should show all interfaces and their master bridges. Example output of above command is:
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master br0 state forwarding priority 32 cost 100 5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 master virbr0 state disabled priority 32 cost 100
Disabling bridge on laptop to use wifi
If we create bridge using above steps, it might be required to disable it on laptop so that wifi can be used. Without changing config files or restarting network services use following to disable bridge on laptop and switch network to wifi:
- Ensure that both ifcfg-br0 and ifcg-<interface-name> files have
- NM_CONTROLLED=yes
- Then we can shutdown bridge if required using:
- nmcli connection down br0
- After this use ping to test if traffic is now getting routed via wireless as desired or not.
Older information on this can be found at:
Refer:
<yambe:breadcrumb self="Creating bridge interfaces (br0) for virtual hosts to use shared interface">CentOS 8.x Network configuration|Network configuration</yambe:breadcrumb>