After the xen4.4.2 installation is complete, we observe the following information:
DOM0:
[[Email protected] ~] #ifconfig
Eth0 Link encap:ethernet HWaddr 00:0c:29:2e:72:81
inet addr:10.43.2.11 bcast:10.43.2.255 mask:255.255.255.0
Inet6 ADDR:FE80::20C:29FF:FE2E:7281/64 Scope:link
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:3882 errors:0 dropped:0 overruns:0 frame:0
TX packets:61 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:431458 (421.3 KiB) TX bytes:7243 (7.0 KiB)
Lo Link encap:local Loopback
inet addr:127.0.0.1 mask:255.0.0.0
Inet6 addr::: 1/128 scope:host
Up LOOPBACK RUNNING mtu:65536 metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Virbr0 Link encap:ethernet HWaddr FE:FF:FF:FF:FF:FF
inet addr:192.168.122.1 bcast:192.168.122.255 mask:255.255.255.0
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Our DOM2 IP address is:
[Email protected] ~]# XM console Dom2
[Email protected] ~]# ifconfig eth0
Eth0 Link encap:ethernet HWaddr 00:16:3e:dd:82:e8
inet addr:192.168.122.71 bcast:192.168.122.255 mask:255.255.255.0
Inet6 ADDR:FE80::216:3EFF:FEDD:82E8/64 Scope:link
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:2319 errors:0 dropped:0 overruns:0 frame:0
TX packets:89 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:93605 (91.4 KiB) TX bytes:10126 (9.8 KiB)
interrupt:247
We found that Dom2 is using the Virbr0 bridge by default, by
Use: A single bridged network configured with A local IP address via DHCP
Modify the IP address of the VIFBR0 with the host DOM0 within the same network segment (10.43.2.0/24)
With the above information we know that after loading the Livrit-manager Dom2 default is to use the Livirt provided virbr0 this bridge, and this bridge is the NAT mode that is used by default.
1. Add a bridge XENBR0
Create ifcfg-xenbr0 under/etc/sysconfig/network-scripts/for the following
[Email protected] network-scripts]# vim ifcfg-xenbr0
Device=xenbr0
Type=bridge
Onboot=yes
Delay=0
Bootproto=dhcp
Nm_controlled=no
2. Modify the Ifcfg-eth0 to the following: (associating eth0 to the top of the bridge Xenbr0)
[Email protected] network-scripts]# vim Ifcfg-eth0
Device=eth0
hwaddr=00:0c:29:2e:72:81
Onboot=yes
Nm_controlled=no
Bridge=xenbr0
3.reboot
[Email protected] ~]# ifconfig
Eth0 Link encap:ethernet HWaddr 00:0c:29:2e:72:81
Inet6 ADDR:FE80::20C:29FF:FE2E:7281/64 Scope:link
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:3882 errors:0 dropped:0 overruns:0 frame:0
TX packets:61 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:431458 (421.3 KiB) TX bytes:7243 (7.0 KiB)
Lo Link encap:local Loopback
inet addr:127.0.0.1 mask:255.0.0.0
Inet6 addr::: 1/128 scope:host
Up LOOPBACK RUNNING mtu:65536 metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
vif1.0 Link encap:ethernet HWaddr FE:FF:FF:FF:FF:FF
Inet6 ADDR:FE80::FCFF:FFFF:FEFF:FFFF/64 Scope:link
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:29 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:32
RX bytes:0 (0.0 b) TX bytes:1664 (1.6 KiB)
Virbr0 Link encap:ethernet HWaddr FE:FF:FF:FF:FF:FF
inet addr:192.168.122.1 bcast:192.168.122.255 mask:255.255.255.0
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Xenbr0 Link encap:ethernet HWaddr 00:0c:29:2e:72:81
inet addr:10.43.2.11 bcast:10.43.2.255 mask:255.255.255.0
Inet6 ADDR:FE80::20C:29FF:FE2E:7281/64 Scope:link
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:2631 errors:0 dropped:0 overruns:0 frame:0
TX packets:77 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:160369 (156.6 KiB) TX bytes:10303 (10.0 KiB)
After rebooting we found that XENBR0 now has eth0 MAC address and IP address.
4. Remove default configuration (VIRBR0)
Enter the Virsh command line:
Virsh # Net-destroy Default
Network default destroyed
Virsh # net-undefine Default
Network Default has been undefined
Service LIBVIRTD Restart
5. Modify the bridge used by default for DOM2
[Email protected] ~]# Virsh edit Dom2
Use the following information:
<source bridge= ' virbr0 '/>
instead
<source bridge= ' xenbr0 '/>
6. Restart the Dom2 and connect the DOM2
XM Start Dom2
XM Console Dom2
[Email protected] ~]# ifconfig
Eth0 Link encap:ethernet HWaddr 00:16:3e:dd:82:e8
inet addr:10.43.2.104 bcast:10.43.2.255 mask:255.255.255.0
Inet6 ADDR:FE80::216:3EFF:FEDD:82E8/64 Scope:link
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:414 errors:0 dropped:0 overruns:0 frame:0
TX packets:17 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:27434 (26.7 KiB) TX bytes:2028 (1.9 KiB)
interrupt:247
Lo Link encap:local Loopback
inet addr:127.0.0.1 mask:255.0.0.0
Inet6 addr::: 1/128 scope:host
Up LOOPBACK RUNNING mtu:16436 metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
It is observed that the IP address of Dom2 is already in the same network segment as DOM0.
It was later discovered that a simple command could be implemented when using Virsh as a management tool.
Virsh Iface-bridge eth0 xenbr0
Summarize:
Delete the default virbr0---> Create a bridge (bridge set to DHCP get IP address)----> Associate a physical NIC to the top of this bridge-----> restart the operating system
xen4.4.2 Network Configuration