1

计算节点上启动的 VM 实例可以访问除 C 类 IP 之外的所有外部 Internet 网站。根据 ubuntu 上的 openstack 自由指南,控制器和计算节点已成功安装。

[root@vm3 ~]# wget http://www.sina.com.cn正在解析www.sina.com.cn... 202.108.33.60 正在连接www.sina.com.cn|202.108.33.60|:80。 ..失败:没有到主机的路由。

但是,A-CLass 和 B-Class 外部 IP 都可以成功访问:

 [root@vm3 ~]# wget http://www.163.com
    Resolving www.163.com... 60.207.246.98, 124.202.166.57
    Connecting to www.163.com|60.207.246.98|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: unspecified [text/html]
    Saving to: “index.html.1”

虚拟机的接口是:

[root@vm3 ~]# ifconfig eth1 Link encap:Ethernet HWaddr FA:16:3E:57:1B:57
inet addr:192.168.0.215 Bcast:255.255.255.255 Mask:192.0.0.0 inet6 addr: fe80::f816:3eff :fe57:1b57/64 范围:连接广播运行组播 MTU:1450 指标:1 RX 数据包:46213 错误:0 丢弃:0 超限:0 帧:0 TX 数据包:42118 错误:0 丢弃:0 超限:0 运营商: 0 次冲突:0 txqueuelen:1000 RX 字节:13492902 (12.8 MiB) TX 字节:39875879 (38.0 MiB)

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:58630 errors:0 dropped:0 overruns:0 frame:0
          TX packets:58630 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:44931488 (42.8 MiB)  TX bytes:44931488 (42.8 MiB)

virbr0    Link encap:Ethernet  HWaddr 52:54:00:D2:F5:28  
          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)

VM上的路由是:

 [root@vm3 ~]# route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    169.254.169.254 192.168.0.200   255.255.255.255 UGH   0      0        0 eth1
    192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0
    192.0.0.0       0.0.0.0         192.0.0.0       U     1      0        0 eth1
    0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 eth1

我创建了启动 VM 的公共网络。公网是 192.168.0.0/24,私网是 10.0.0.0/24。控制器:192.168.0.12/10.0.0.11 计算:192.168.0.10/10.0.0.31

如果我明确添加 202.108.33.60 的路由, wget 可以工作:

路由添加 202.108.33.60 gw 1​​92.168.0.1

    [root@vm3 ~]# route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    202.108.33.60   192.168.0.1     255.255.255.255 UGH   0      0        0 eth1
    169.254.169.254 192.168.0.200   255.255.255.255 UGH   0      0        0 eth1
    192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0
    192.0.0.0       0.0.0.0         192.0.0.0       U     1      0        0 eth1
    0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 eth1

有人知道原因或就如何调试此问题提供一些帮助吗?非常感谢!

4

1 回答 1

0

经过几天的分析和挖掘,最终我发现原因是路由条目“192.0.0.0 0.0.0.0 192.0.0.0 U 1 0 0 eth1”将所有C级IP过滤为LAN(邻居网络)和偶尔www.sina.com.cn就是这样的主机。我改成下面这样后,www.sina.com.cn就可以访问了。

192.0.0.0 0.0.0.0 255.0.0.0 U 1 0 0 eth1

于 2016-01-10T07:52:02.363 回答