[root@linux-node1~]
[root@linux-node1~]
注:此时会断网如果是远程操作服务器不在身边,建议写成脚本来执行
[root@linux-node1 ~]
[root@linux-node1 ~]
[root@linux-node1 ~]
为了避免断网,直接写成脚本即可:
brctl addbr br0
brctl addif br0 eth0
ip addr del dev eth0192.168.56.11
/24
ifconfig
br0192.168.56.11
/24
up
route add default gw192.168.56.2
[root@linux-node1 ~]
将:
<interfacetype=
'network'
<- 虚拟机网络连接方式->
<mac address=
'52:54:00:0b:f8:a5'
/>
<
source
network=
'default'
/> <- 当前主机网络名称 ->
修改为:
<interfacetype=
'bridge'
>
<mac address=
'52:54:00:0b:f8:a5'
/>
<
source
bridge=
'br0'
/>
[root@linux-node1 ~]
Domain CentOS-7-x86_64 isbeing
shutdown
[root@linux-node1 ~]
Domain CentOS-7-x86_64started
[root@linux-node1~]
br0:flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.56.11 netmask 255.255.255.0 broadcast 192.168.56.255
inet6 fe80::20c:29ff:fefe:1620 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:fe:16:20 txqueuelen 0 (Ethernet)
RX packets 74 bytes 8909 (8.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 63 bytes 11462 (11.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0:flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::20c:29ff:fefe:1620 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:fe:16:20 txqueuelen 1000 (Ethernet)
RX packets 26401 bytes 26066467 (24.8 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 8582 bytes 1939240 (1.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo:flags=73<UP,LOOPBACK,RUNNING> mtu65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 0 (Local Loopback)
RX packets 4 bytes 216 (216.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4 bytes 216 (216.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0:flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 00:00:00:00:00:00 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2 bytes 84 (84.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vnet0:flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether fe:54:00:0b:f8:a5 txqueuelen 500 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0