XEN--虚拟服务器无法上网解决案例

分析:

实体机器10.0.0.229eth0eth1 eth1和交换机连接,eth0 未用

/sbin/ifconfig

eth1      Link encap:Ethernet  HWaddr 00:1E:90:6A:A0:F9 

          inet addr:10.0.0.229  Bcast:10.0.0.255  Mask:255.255.255.0

          inet6 addr: fe80::21e:90ff:fe6a:a0f9/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:335948116 errors:0 dropped:328633 overruns:0 frame:0

          TX packets:730400280 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:100

          RX bytes:27731724580 (25.8 GiB)  TX bytes:1077307892050 (1003.3 GiB)

          Memory:fd8c0000-fd8e0000

 

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:63577 errors:0 dropped:0 overruns:0 frame:0

          TX packets:63577 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:117854954 (112.3 MiB)  TX bytes:117854954 (112.3 MiB)

 

peth1     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:9 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:0 (0.0 b)  TX bytes:1494 (1.4 KiB)

 

vif4.0    Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF 

          inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link

          UP BROADCAST RUNNING NOARP  MTU:1500  Metric:1

          RX packets:47873 errors:0 dropped:0 overruns:0 frame:0

          TX packets:743612 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:32

          RX bytes:1341108 (1.2 MiB)  TX bytes:31259471 (29.8 MiB)

 

vif5.0    Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF 

          inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link

          UP BROADCAST RUNNING NOARP  MTU:1500  Metric:1

          RX packets:739556 errors:0 dropped:0 overruns:0 frame:0

          TX packets:47547 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:32

          RX bytes:20734610 (19.7 MiB)  TX bytes:1996974 (1.9 MiB)

 

xenbr1    Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF 

          UP BROADCAST RUNNING NOARP  MTU:1500  Metric:1

          RX packets:836254 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:23462121 (22.3 MiB)  TX bytes:0 (0.0 b)

/etc/init.d/xend status   #查看当前运行的虚拟服务器

xend is running

xm list

Name                                      ID Mem(MiB) VCPUs State   Time(s)

Domain-0                                   0     4096     8 r----- 173001.1

arch01                                     4     6143     4 -b----   1620.9

nagios                                     5     2047     1 -b----   3234.1

/etc/xen/scripts/network-bridge status   #检查虚拟网卡连接状态

============================================================

3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 100

    link/ether 00:1e:90:6a:a0:f9 brd ff:ff:ff:ff:ff:ff

    inet 10.0.0.229/24 brd 10.0.0.255 scope global eth1

    inet6 fe80::21e:90ff:fe6a:a0f9/64 scope link

       valid_lft forever preferred_lft forever

13: xenbr1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue

    link/ether fe:ff:ff:ff:ff:ff brd ff:ff:ff:ff:ff:ff

 

bridge name     bridge id               STP enabled     interfaces

xenbr1          8000.feffffffffff       no                   vif5.0

                                                        vif4.0

 

10.0.0.0/24 dev eth1  proto kernel  scope link  src 10.0.0.229

169.254.0.0/16 dev eth1  scope link

default via 10.0.0.248 dev eth1

 

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

10.0.0.0      0.0.0.0         255.255.255.0   U     0      0        0 eth1

169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth1

0.0.0.0         10.0.0.248    0.0.0.0         UG    0      0        0 eth1

或者用命令:brctl

[root@bigtest ~]# brctl show

bridge name     bridge id               STP enabled     interfaces

xenbr1          8000.feffffffffff       no                   vif5.0

                                                        vif4.0

 

找一正常的对比:

[root@bigWLWX019 ~]# brctl show

bridge name     bridge id               STP enabled     interfaces

virbr0          8000.000000000000       yes   #这一条可忽略,因为我们采用的是桥接

xenbr0          8000.feffffffffff       no                  peth0

                                                        vif0.

 

==============================================================================

/etc/xen/目录xend-config.sxp配置文件:

# Your default ethernet device is used as the outgoing interface, by default.

# To use a different one (e.g. eth1) use

#

# (network-script 'network-bridge netdev=eth1')  #默认的

#

# The bridge is named xenbr0, by default.  To rename the bridge, use

#

# (network-script 'network-bridge bridge=<name>')  #默认的

 

解决办法:

步骤一、当前和交换机相连的是eth1,所以我们需要将xend-config.sxp文件做相应改动,如下:

xend-config.sxp

# Your default ethernet device is used as the outgoing interface, by default.

# To use a different one (e.g. eth1) use

##-------2011-06-13-----------------------------#

(network-script 'network-bridge netdev=eth1')  #去掉前面的注释符,

#

# The bridge is named xenbr0, by default.  To rename the bridge, use

#

#-------2011-06-15------------------------------#

(network-script 'network-bridge bridge=xenbr1') #去掉前面的注释符,将桥接设备改为xenbr1.

#

步骤二、重新载入配置文件

/etc/init.d/xend reload

参照原理图

测试虚拟服务器的上网情况,结果令人失望,还是不行,检查虚拟网卡情况如下:

[root@bigtest ~]# brctl show

bridge name     bridge id               STP enabled     interfaces

xenbr1          8000.feffffffffff       no                   vif5.0   #缺少peth1

                                                        vif4.0

既然其中的原因已找到,通讯原理也搞清楚了,接下来我们需要做的事就是,重新启动

实体机(我先在本本的虚拟机上搞的测试,验证了结果),加载peth1.

周知10.0.0.229服务器业务相关负责人,说明情况,需要重新启动机器,确认OK,重新启动机器,检查:

[root@bigtest ~]# brctl show

bridge name     bridge id               STP enabled     interfaces

xenbr1          8000.feffffffffff       no                   vif2.0

                                                        peth1   #peth1已出现

                                                        vif0.1

在实体机上ping 虚拟服务器10.0.0.101,进行测试:ping  10.0.0.101 OK

登录虚拟服务器,ping 外网IPOK

 

至此上网问题解决OK

你可能感兴趣的:(职场,xen,休闲,虚拟化问题)