作者:张华  发表于:2013-12-22
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明

( http://blog.csdn.net/quqi99 )

虚机获取不到IP,排除32位系统使用64位镜像之后,查看其console log的信息如下:

Starting network...
udhcpc (v1.18.5) started
Sending discover...
Sending discover...
Sending discover...
No lease, failing
WARN: /etc/rc3.d/S40-network failed

解决办法:

iptables -A POSTROUTING -t mangle -p udp --dport 68 -j CHECKSUM --checksum-fill

https://bugs.launchpad.net/neutron/+bug/1722584

https://lore.kernel.org/patchwork/patch/824819/

--checksum-fill

Compute and fill in the checksum in a packet that lacks a checksum. This is particularly useful, if you need to work around old applications such as dhcpclients, that do not work well with checksum offloads, but don't want to disable checksum offload in your device.

2014-01-25添加:

虚机没有IP还有一种情况,在ovs中dhcp的port的vlan号变成了4095,这个是不对的。

2014-08-28添加:

今天帮一个同事线上远程调试一个环境,它用的gre, 忽然说虚机取不到ip,查来查去,原因是它中途把一个计算节点的ip改了,然后把local_ip参数也给变了,造成那台计算节点自己和自己建立了遂道。这种人为的问题真难查。

2014-08-29, 这位同事遇到的可能是这样一个问题 (https://lists.launchpad.net/openstack/msg23595.html, https://bugs.launchpad.net/neutron/+bug/1179223 )

2014-10-17, metadata服务不通也会造成此问题

所以解决此问题的关键是看console log, 具体分析

$ sudo dhcpclient eth0

$ sudo tcpdump -ni eth0 port 67 or port 68
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
11:06:00.684853 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 28:d2:44:52:31:1d, length 300
11:06:00.686075 IP 192.168.99.1.67 > 192.168.99.135.68: BOOTP/DHCP, Reply, length 300

1, sudo ovs-ofctl dump-flows br-int

2, sudo ovs-appctl bridge/dump-flows br-int   # can show some HIDDEN rules as well

实例:

hua@node1:/bak/openstack/devstack$ nova reboot testAttach
Request to reboot server <Server: testAttach> has been accepted.

qvo口有dhcp请求。
hua@node1:/bak/openstack/devstack$ sudo tcpdump -ni qvo3c64d4e8-ad port 67 or port 68
tcpdump: WARNING: qvo3c64d4e8-ad: no IPv4 address assigned
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on qvo3c64d4e8-ad, link-type EN10MB (Ethernet), capture size 65535 bytes

14:39:59.180107 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from fa:16:3e:5b:08:a3, length 294

但dhcp port没有收到dhcp请求,那肯定是br-int里的流规则出问题了。
hua@node1:/bak/openstack/devstack$ sudo ip netns exec qdhcp-15101061-5784-422b-8c6b-7885b3616d07 tcpdump -ni tap36af97e6-50 port 67 or port 68
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on tap36af97e6-50, link-type EN10MB (Ethernet), capture size 65535 bytes

hua@node1:~$ sudo ovs-ofctl dump-flows br-int
NXST_FLOW reply (xid=0x4):
 cookie=0x80d224499fbdf5f8, duration=1890.568s, table=0, n_packets=0, n_bytes=0, idle_age=1890, priority=10,icmp6,in_port=10,icmp_type=136 actions=resubmit(,24)
 cookie=0x80d224499fbdf5f8, duration=1890.795s, table=0, n_packets=0, n_bytes=0, idle_age=1890, priority=3,in_port=7,dl_vlan=1003 actions=mod_vlan_vid:2,NORMAL
 cookie=0x80d224499fbdf5f8, duration=1890.563s, table=0, n_packets=0, n_bytes=0, idle_age=1890, priority=10,arp,in_port=10 actions=resubmit(,24)
 cookie=0x80d224499fbdf5f8, duration=2229.258s, table=0, n_packets=0, n_bytes=0, idle_age=2229, priority=2,in_port=7 actions=drop
 cookie=0x80d224499fbdf5f8, duration=2229.305s, table=0, n_packets=422, n_bytes=71584, idle_age=39, priority=0 actions=NORMAL
 cookie=0x80d224499fbdf5f8, duration=2229.303s, table=23, n_packets=0, n_bytes=0, idle_age=2229, priority=0 actions=drop
 cookie=0x80d224499fbdf5f8, duration=1890.57s, table=24, n_packets=0, n_bytes=0, idle_age=1890, priority=2,icmp6,in_port=10,icmp_type=136,nd_target=fe80::f816:3eff:fe5b:8a3 actions=NORMAL
 cookie=0x80d224499fbdf5f8, duration=1890.566s, table=24, n_packets=0, n_bytes=0, idle_age=1890, priority=2,arp,in_port=10,arp_spa=10.0.1.24 actions=NORMAL
 cookie=0x80d224499fbdf5f8, duration=2229.301s, table=24, n_packets=0, n_bytes=0, idle_age=2229, priority=0 actions=drop

hua@node1:~$ sudo ovs-appctl bridge/dump-flows br-int 
duration=1918s, priority=10, n_packets=0, n_bytes=0, priority=10,icmp6,in_port=10,icmp_type=136,actions=resubmit(,24)
#qvo的local_vlan=2,所以这是从int-br-phy(in_port=7)进虚机经过br-int时将vlan改成local_vlan
duration=1918s, priority=3, n_packets=0, n_bytes=0, priority=3,in_port=7,dl_vlan=1003,actions=mod_vlan_vid:2,NORMAL
duration=1918s, priority=10, n_packets=0, n_bytes=0, priority=10,arp,in_port=10,actions=resubmit(,24)
duration=2256s, priority=2, n_packets=0, n_bytes=0, priority=2,in_port=7,actions=drop
duration=2257s, priority=0, n_packets=423, n_bytes=71920, priority=0,actions=NORMAL
table_id=23, duration=2257s, priority=0, n_packets=0, n_bytes=0, priority=0,actions=drop
table_id=24, duration=1918s, priority=2, n_packets=0, n_bytes=0, priority=2,icmp6,in_port=10,icmp_type=136,nd_target=fe80::f816:3eff:fe5b:8a3,actions=NORMAL
#允许从qvo口(in_port=10)进br-int也就是出虚机的ARP流量
table_id=24, duration=1918s, priority=2, n_packets=0, n_bytes=0, priority=2,arp,in_port=10,arp_spa=10.0.1.24,actions=NORMAL
table_id=24, duration=2257s, priority=0, n_packets=0, n_bytes=0, priority=0,actions=drop
table_id=254, duration=4478s, priority=0, n_packets=0, n_bytes=0, priority=0,reg0=0x3,actions=drop
table_id=254, duration=4478s, priority=0, n_packets=0, n_bytes=0, priority=0,reg0=0x1,actions=controller(reason=no_match)
table_id=254, duration=4478s, priority=0, n_packets=0, n_bytes=0, priority=0,reg0=0x2,actions=drop

hua@node1:~$ sudo ovs-vsctl show
d186e8ba-b5ce-4062-a50e-202db91f80c1
    Bridge br-int
        fail_mode: secure
        Port "tap36af97e6-50"
            Interface "tap36af97e6-50"
                type: internal
        Port int-br-phy
            Interface int-br-phy
                type: patch
                options: {peer=phy-br-phy}
        Port "qr-3233dbfb-2c"
            Interface "qr-3233dbfb-2c"
                type: internal
        Port br-int
            Interface br-int
                type: internal
        Port patch-tun
            Interface patch-tun
                type: patch
                options: {peer=patch-int}
        Port "qvo3c64d4e8-ad"
            tag: 2
            Interface "qvo3c64d4e8-ad"
    Bridge br-phy
        Port phy-br-phy
            Interface phy-br-phy
                type: patch
                options: {peer=int-br-phy}
        Port br-phy
            Interface br-phy
                type: internal
    Bridge br-ex
        Port br-ex
            Interface br-ex
                type: internal
        Port "qg-e837ef4b-73"
            Interface "qg-e837ef4b-73"
                type: internal
    Bridge br-tun
        fail_mode: secure
        Port br-tun
            Interface br-tun
                type: internal
        Port patch-int
            Interface patch-int
                type: patch
                options: {peer=patch-tun}
    ovs_version: "2.0.2"

20190507更新:

今天遇到一个虚机无法获得IP的问题, 使用tcpdump命令(tcpdump -enli bond0 udp port 4789)在计算节点的bond0上能看到ping后的ICMP响应, 但无法看到DHCP request 与DHCP reply,

05:27:24.003173 fa:16:3e:a0:5a:17 > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 342: 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from fa:16:3e:a0:5a:17, length 300
05:27:26.750370 fa:16:3e:38:6a:e8 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: Request who-has 10.222.100.1 tell 10.222.100.10, length 28

在bond0.60, qbr, qbo, tap等的网卡上能看到DHCP request不能看到DHCP reply. 在dhcp-agent节点上的tap上也无法看到request与reply. 在一个好的节点上却能看到下列的tcpdump输出:

05:46:47.092678 fa:16:3e:6a:14:36 > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 342: 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from fa:16:3e:6a:14:36, length 300
05:46:47.092886 fa:16:3e:5a:d1:0b > fa:16:3e:6a:14:36, ethertype IPv4 (0x0800), length 390: 10.222.100.11.67 > 10.222.100.24.68: BOOTP/DHCP, Reply, length 348

客户使用的是mallonax的网卡, 默认打开了offload. 换成不支持offload的网卡能解决问题, 使用hwe kernel (sudo apt-get install --install-recommends linux-generic-hwe-16.04)也能解决问题(git log --no-merges --oneline origin/hwe...origin/master drivers/net/ethernet/mellanox/mlx5/ |grep offload).

参考:http://techbackground.blogspot.kr/2013/05/debugging-quantum-dhcp-and-open-vswitch.html

http://yeasy.blogspot.kr/2013/06/openstack-vm-cannot-get-ip-by-dhcp-with_4553.html

虚机获取不到IP报错No lease, failing (by quqi99)相关推荐

  1. 本机获取Intel AMT IP地址的例子

    转自:http://software.intel.com/zh-cn/blogs/2009/02/10/intel-amt-ip/?cid=sw:51cto    Intel AMT的IP地址设置有两 ...

  2. 【hadoop】java 获取 yarn app 信息 报错 ConfiguredRMFailoverProxyProvider - Failing over to rm2

    文章目录 1.概述 1.概述 java 获取 yarn app 信息 报错 ConfiguredRMFailoverProxyProvider - Failing over to rm2 2022-0 ...

  3. VMware虚拟机更改静态IP报错Unit network.service entered failed state解决方案

    VMware虚拟机更改静态IP报错Unit network.service entered failed state解决方案 问题背景 解决方案一 解决方案二 Lyric: 就算没伴奏也可以继续 问题 ...

  4. 获取京东商品信息报错error pdos_captcha

    获取京东商品信息报错error pdos_captcha 2020.7.20 python 请求商品信息出现 {"error":"pdos_captcha"}. ...

  5. JsonMap对象的获取与前台浏览器报错Uncaught TypeError: Cannot read property ‘map‘ of undefined

    JsonMap对象的获取与前台浏览器报错Uncaught TypeError: Cannot read property 'map' of undefined 经过不断排查以后发现是自己的后台传的值出 ...

  6. Unity当GameObject.Find(““)获取不到对象报错时

    Unity当GameObject.Find("")获取不到对象报错时 有时候Hierarchy明明有我们需要获取的对象,但当他不启用时,我们用GameObject.Find(&qu ...

  7. ADO连接数据库,编译到客户机运行时出现CreateInstance报错0x80004002、CreateParameter报0xC0000005错误的解决方法。

    ADO连接数据库,编译到客户机运行时出现CreateInstance报错0x80004002,经查是由于ADO版本不一致引起的. 解决方法将原来stdafx.h中的 #import "c:\ ...

  8. 使用叶神模拟器无法访问本机服务器的问题(报错:java.net.ConnectException: failed to connect to /127.0.0.1 (port 5000) )

    最近打算用夜神模拟器来和本机服务器做一些信息交互的功能,但是服务器搭建好了,用叶神模拟器却无法访问.折腾了大半天才发现原来是模拟器的问题. 具体过程如下: 搭建好服务器后,在本机上访问"ht ...

  9. mysql获取数据库账号密码报错errorCode 1045, state 28000——常见5种解决办法

    本地写了个一个项目后想上传到阿里云服务器(Windows)中,mysql+tomcat+jdk都已经配置好了,但就在项目运行时报错,显示如下 create connection error, url: ...

最新文章

  1. Office word 2007不能另存为pdf格式的解决方法
  2. 「网络流24题」 12. 软件补丁问题
  3. 使用JDBC处理MySQL大数据
  4. python中、文件最重要的功能是( )和接收数据_Python基础语法14个知识点大串讲
  5. 同一网段计算机无法共享打印机,Win7同一个局域网内共享打印机不成功的修复方法...
  6. Python中获取当前日期的格式
  7. SAP License:SAP会计凭证抬头的字段状态控制
  8. 【背包问题】基于粒子群算法求解0-1背包问题matlab代码
  9. ue4 umg帧动画
  10. 使用c++语言做概率论 涉及求方差
  11. java smart单点登录_SmartBi 单点登录的实现
  12. centos安装图形化界面及vnc-server连接
  13. 竟然可以用Python操作 Word 文档,这么多的骚操作!
  14. ASAM XCP及驱动代码、ISO 11898+CANFD,ISO 14229,ISO 15031,ISO 15765相关标准文档
  15. python 提取一个单词的所有字母_如何用python提取单词(正则表达式or分割)
  16. 【NLP自然语言处理】文本特征提取
  17. 5年测试开发工程师感悟——写给还在迷茫中的朋友
  18. 二叉树非递归遍历(模版)
  19. C 语言 System 设置背景色和前景颜色
  20. idea maven 下载源码出现:Cannot download sources Sources not found for: xxx

热门文章

  1. 浙大版《python程序设计》第2章课后习题
  2. 老师助手为什么总是服务器错误,【家长助手】孩子在校总犯错 解决内因最关键...
  3. eslint报错no-octal-escape.js:41
  4. 『边城』: 陌上花开,可缓缓归矣
  5. 明天就会有阳光...
  6. cpu中计算机的主要功能,cpu主要功能详解介绍
  7. 动力电池系统介绍(一)——锂离子电池材料组成及其充放电过程
  8. 全程干货!人物设计是什么?如何设计出好看的人物?
  9. 新手如何做游戏代理赚钱?
  10. RecyclerView与ViewPager2