配置本地网络文件
[root@foundation14 ~]# cd /etc/sysconfig/network-scripts/
[root@foundation14 network-scripts]# ls
ifcfg-br0 ifdown-routes ifup-plusb
ifcfg-enp0s25 ifdown-sit ifup-post
ifcfg-Ethernet_connection_1 ifdown-Team ifup-ppp
ifcfg-lo ifdown-TeamPort ifup-routes
ifcfg-wlp3s0 ifdown-tunnel ifup-sit
ifdown ifup ifup-Team
ifdown-bnep ifup-aliases ifup-TeamPort
ifdown-eth ifup-bnep ifup-tunnel
ifdown-ib ifup-eth ifup-wireless
ifdown-ippp ifup-ib init.ipv6-global
ifdown-ipv6 ifup-ippp keys-“Thinkpad”的_iPhone
ifdown-isdn ifup-ipv6 network-functions
ifdown-post ifup-isdn network-functions-ipv6
ifdown-ppp ifup-plip
[root@foundation14 network-scripts]#
做好ifcfg-enp0s25 ,ifcfg-enp0s25 备份,删除除ifcfg-lo,ifcfg-wlp3s0外其他ifcfg文件。
配置ifcfg-enp0s25,vim ifcfg-enp0s25
DEVICE=enp0s25
0NBOOT=yes
BOOTPROTO=none
IPADDR=172.25.254.x
NETMASK=255.255.255.0
网桥
能使虚拟机独立,于真机为平行关系
配置方式:
配置本地网络文件
vim /etc/sysconfig/network-scripts/ifcfg-enp0s25
DEVICE=enp0s25 设备名称
0NBOOT=yes 开启设备自动激活
BOOTPROTO=none 网卡工作状态
BRIDGE=br0 网卡开启的网桥接口
配置桥接文件
vim /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
ONBOOT=yes
BOOTPROTO=none
IPADDR=172.25.254.14
NETMASK=255.255.255.0
TYPE=Bridge 网络接口类型
systemcl stop NetworkManager.service
systemcl restart network
systemcl start NetworkManager.service
[root@foundation14 network-scripts]# ifconfig
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.25.254.14 netmask 255.255.255.0 broadcast 172.25.254.255
inet6 fe80::5871:5ff:fe94:b6f2 prefixlen 64 scopeid 0x20<link>
ether fe:54:00:00:0e:0a txqueuelen 0 (Ethernet)
RX packets 3989 bytes 278219 (271.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 15 bytes 1893 (1.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
桥接建立
虚拟机建立桥接
先删除原来所做的steam
nmcli connection delete team0
nmcli connection delete eth0
nmcli connection delete eth1
先 systemctl stop NetworkManager.service
brctl show 显示所有桥接
brctl addbr br0 添加bro桥接
brctl addif br0 eth0 给bro桥接加上eth0网卡
ifconfig eth0 up 开启eth0网卡
ifconfig br0 172.25.254.x netmask 255.255.255.0 配置桥接
brctl show 看是否成功
ping 172.25.254.250 通过桥接p
删除
ifconfig br0 down 关闭br0端口
brctl delif br0 eth0 卸下br0上的eth0网卡
brctl delbr br0 删除br0端口