centos8搭建网桥

1. nmcli命令搭建

nmcli connection add type bridge con-name br0 ifname br0 autoconnect yes
nmcli connection modify br0 ipv4.addresses "192.168.8.16/24" ipv4.gateway 192.168.8.1 ipv4.dns 8.8.8.8 ipv4.method manual connection.autoconnect yes
nmcli connection add type bridge-slave ifname enp8s0f0 master br0


nmcli connection down enp8s0f0; nmcli connection up br0
nmcli connection show

 

2. 配置文件搭建

# cat /etc/sysconfig/network-script/ifc-br0
TYPE=Bridge
BOOTPROTO=none
DEVICE=br0
ONBOOT=yes
IPADDR=192.168.1.100
PREFIX=24
GATEWAY=192.168.1.1
DNS1=114.114.114.114

# cat /etc/sysconfig/network-script/ifc-eno1
TYPE=Ethernet
BOOTPROTO=none
DEVICE=eno1
ONBOOT=yes
BRIDGE=br0

 

posted @ 2023-02-03 20:34  咿呀哒喏  阅读(222)  评论(0编辑  收藏  举报