Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2484008
  • 博文数量: 609
  • 博客积分: 10061
  • 博客等级: 上将
  • 技术积分: 5920
  • 用 户 组: 普通用户
  • 注册时间: 2008-06-25 08:30
文章分类

全部博文(609)

文章存档

2010年(13)

2009年(39)

2008年(558)

我的朋友

分类: LINUX

2008-08-29 22:57:17

Xen domainU Guest has an IP address on 192.168.122 subnet instead of the subnet to which the domain0 host belongs

From Virtuatopia

Jump to: ,

Problem Summary - After booting a Xen domainU it is discovered that the system has been assigned an IP address in the 192.168.122.* address range which is a different to the subnet to which the host (domain0) system belongs. This configuration is commonly encountered on Red Hat Enterprise Linux and recent Fedora releases.

Firstly, it is important to understand that, rather than being a problem, this is the intended behavior for Xen on a number of Linux distributions. The objective is to provide the ability to create a private network of Xen domainU guests protected though Network Address Translation (NAT) on domain0. In fact, all domainU guests on the host in question will be assigned an IP address from this subnet and will be able to communicate with each other, although by default they will be unable to communicate with the outside world.

For many Xen configurations this is desired behavior for which there are a number of benefits. For some configurations, however, an IP address on the same subnet (and issued by the same DHCP server) as the Xen host system is needed.

Solution - By default a number of systems (typically Red Hat based distributions) default to using the virbr0 network bridge for all domainU guests. For example, running ifconfig on the Xen domainU guest will provide output similar to the following:

eth0      Link encap:Ethernet  HWaddr 00:16:3E:34:12:00  
inet addr:192.168.122.233 Bcast:192.168.122.255 Mask:255.255.255.0
inet6 addr: fe80::216:3eff:fe34:1200/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:9 errors:0 dropped:0 overruns:0 frame:0
TX packets:55 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:634 (634.0 b) TX bytes:9467 (9.2 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:16436 Metric:1
RX packets:188 errors:0 dropped:0 overruns:0 frame:0
TX packets:188 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:14732 (14.3 KiB) TX bytes:14732 (14.3 KiB)

virbr0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:56 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:9764 (9.5 KiB)

As shown above, the domainU guest has an IP address in the 192.168.122.* subnet range. In order to configure the domainU guest so that it acquires an IP address in the same subnet as the domain0 host it is necessary to modify the guest configuration file and specify the xenbr0 bridge on the vif = line. For example:

vif = [ 'bridge=xenbr0' ]

Once this change has been made, restart the domainU guest. When the system has started running ifconfig shows that the domainU guest now has an IP address on the same subnet as the Xen host (in this the 192.168.2.* address range):

eth0      Link encap:Ethernet  HWaddr 00:16:3E:05:B5:6C  
inet addr:192.168.2.29 Bcast:255.255.255.255 Mask:255.255.255.0
inet6 addr: fe80::216:3eff:fe05:b56c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:44 errors:0 dropped:0 overruns:0 frame:0
TX packets:101 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:11243 (10.9 KiB) TX bytes:19012 (18.5 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:16436 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:560 (560.0 b) TX bytes:560 (560.0 b)

virbr0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:41 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:8307 (8.1 KiB)
阅读(3222) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~