网桥

搭建网桥之前:

[[email protected] Desktop]# rht-vmctl poweroff desktop  ####关掉虚拟机

[[email protected] Desktop]# cd /etc/sysconfig/network-scripts/

网桥


[[email protected] network-scripts]# mv ifcfg-br0 ifcfg-enp0s25 /mnt/     ####备份br0
[[email protected] network-scripts]# nm-connection-editor            ####删掉system enp0s25 和 bridge enp0s25
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.

** (nm-connection-editor:5872): WARNING **: Unsupported connection type 'generic'

** (nm-connection-editor:5872): WARNING **: Unsupported connection type 'generic'
[[email protected] network-scripts]# vim ifcfg-enp0s25               ####编写配置   
DEVICE=enp0s25
ONBOOT=yes
BOOTPROTO=none
IPADDR=172.25.254.42

NETMASK=255.255.255.0

网桥


[[email protected] network-scripts]# systemctl stop NetworkManager.service     ###关掉服务
[[email protected] network-scripts]# systemctl restart network        ####重启网络

[[email protected] network-scripts]# ls


网桥

在控制台去安装虚拟机,安装速度很慢

                                                                       ---------------------网桥--------------------

网络桥接:实现共享上网主机和客户机的的可利用软件,还可以用系统自带的网络桥建立连接用双网卡的做主机

真实主机中
[[email protected] ~]# cd /etc/sysconfig/network-scripts/
[[email protected] network-scripts]# vim ifcfg-enp0s25
DEVICE=enp0s25        ####设备名称
ONBOOT=yes               ####开启服务设备自动**
BOOTPROTO=none     ####网卡工作状态

BRIDGE=br0                  ####网卡开启的网桥接口

网桥


[[email protected] network-scripts]# vim ifcfg-br0
DEVICE=br0
ONBOOT=yes
BOOTPROTO=none
IPADDR=172.25.254.42
NETMASK=255.255.255.0

TYPE=Bridge                     ####网络接口类型是桥接

网桥


[[email protected] network-scripts]# systemctl stop NetworkManager.service   ####服务用来记录网卡位置,关闭此服务
[[email protected] network-scripts]# systemctl restart network   ####重启网络
[[email protected] network-scripts]# systemctl start  NetworkManager.service     ####重启服务
[[email protected] network-scripts]# ifconfig
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.25.254.42  netmask 255.255.255.0  broadcast 172.25.254.255
        inet6 fe80::221:ccff:feb8:6c5d  prefixlen 64  scopeid 0x20<link>
        ether 00:21:cc:b8:6c:5d  txqueuelen 0  (Ethernet)
        RX packets 40  bytes 4311 (4.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 24  bytes 3144 (3.0 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

网桥

再次在控制台去安装虚拟机,安装速度明显加快


命令管理方式

虚拟主机中
1.添加:
nm-connection-editor  ###删除team0
systemctl stop NetworkManager.service   ####服务用来记录网卡位置
brctl show                  ####显示网桥
brctl addbr br0         ###添加网桥
brctl addif br0 eth0   ####添加网桥的物理接口eth0
ifconfig eth0 up         ####开启接口
ifconfig br0 172.25.254.142 netmask 255.255.255.0   ####配置br0
brctl show                      ####显示网桥

ping 172.25.254.250    ####查看网络状态

网桥


2删除:
ifconfig br0 down     ####关掉br0
brctl delif br0 eth0    ####断开网桥接口
brctl delbr br0           ###删除网桥
brctl show                  ####显示网桥
网桥