总部同事要访问一个本地ac设备,让给配个ip,他通过两地出口间n2n隧道进行远程访问。
找到设备,接串口看ip

已知,vlan1.4093和vlan1.4094是ac的wan口,但不知道面板丝印和实际是否一致,需要验证一下。

切到linux下执行ethtool -p eth0和ethtool -p eth1进行验证,网口左右灯闪亮的就是对接接口。


确定eth0和eth1是左侧第一列上下的两个网口后,扯一根网线接上,已知这根网线是接的是子网192.168.186.0/24,该子网开启了自动获取ip地址。
插上网线后,串口下执行route -n发现默认路由没有生成

why?
查看接口状态,show int brief看看,发现vlan1.4093和eth0都已经up,那就是物理层已经激活了

那为啥获取没有获取到地址,生成直连路由和默认路由?
抓包eth0,看看广播域是否打通?tcpdump -i eth0 -nnev arp
/mnt/userspace # tcpdump -i eth0 -nnev arp
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
09:36:10.027362 64:a4:42:03:40:47 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.186.47 (64:a4:42:03:40:47) tell 192.168.186.47, length 46
09:36:15.687233 64:a3:80:86:ff:01 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.186.181 tell 0.0.0.0, length 28
09:36:15.687511 64:a3:41:b3:f7:60 > 64:a3:80:86:ff:01, ethertype ARP (0x0806), length 60: Ethernet (len 6), IPv4 (len 4), Reply 192.168.186.181 is-at 64:a3:41:b3:f7:60, length 46
09:36:16.447434 64:a3:41:93:08:61 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.186.50 (64:a3:41:93:08:61) tell 192.168.186.50, length 46 发现能收到其他设备发来的广播消息
09:36:20.028628 64:a4:42:03:40:47 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.186.47 (64:a4:42:03:40:47) tell 192.168.186.47, length 46 发现能收到其他设备发来的广播消息
09:36:26.087230 64:a3:80:86:ff:01 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.186.181 tell 0.0.0.0, length 28 这种源ip是0.0.0.0的arp消息是arp探查消息,用于获得ip后探查是否存在ip冲突
09:36:26.087559 64:a3:41:b3:f7:60 > 64:a3:80:86:ff:01, ethertype ARP (0x0806), length 60: Ethernet (len 6), IPv4 (len 4), Reply 192.168.186.181 is-at 64:a3:41:b3:f7:60, length 46
这是arp探查的响应消息,说明环境里存在192.168.186.181的设备,mac是64:a3:41:b3:f7:60
09:36:26.447383 64:a3:41:93:08:61 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.186.50 (64:a3:41:93:08:61) tell 192.168.186.50, length 46
09:36:30.029001 64:a4:42:03:40:47 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.186.47 (64:a4:42:03:40:47) tell 192.168.186.47, length 46
^C
抓包发现广播域是通的,发现有arp探查消息从64:a3:80:86:ff:01,发出,而且有单播的arp响应给64:a3:80:86:ff:01,检查一下这个mac是否是eth0口的,是的话,说明设备获取了地址,但环境里有ip冲突。
检查一下eth0口的配置情况ip addr
eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 64:a3:80:86:ff:02 brd ff:ff:ff:ff:ff:ff lower_up说明物理状态是激活up的,但mac不是64:a3:80:86:ff:01,但考虑到ac是在把所有网口上创建一个网桥,在网桥上划分vlan,eth0属于vlan1.4093,那再去检查vlan1.4093的mac地址
vlan1.4093: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default 物理状态是up的
link/ether 64:a3:80:86:ff:01 brd ff:ff:ff:ff:ff:ff mac地址符合
inet6 fe80::66a3:80ff:fe86:ff01/64 scope link
valid_lft forever preferred_lft forever
32: vlan1.4094: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default
link/ether 64:a3:80:86:ff:01 brd ff:ff:ff:ff:ff:ff
在192.168.186.0/24的dhcp服务器上检查mac地址和ip dhcp的情况?
XOS#show mac- | inc ff01
1 1 eth3 64a3.8086.ff01 1 298 发现mac有
检查ip分配情况
XOS#show ip dhcp lease act | inc ff:01 回显为空
查看arp
XOS#show ip arp | inc ff:01 回显为空,说明获取ip没有成功,但mac地址已经被发现
抓bootp的包看看tcpdump -i eth0 -nnev port 67

发现bootp的过程discover,offer分配地址是192.168.186.181,确认request,ack都在正常
但下面打印中decline后又重新发起discover过程:


问题原因判断:
发现设备获得ip后,又发出decline宣告这个ip冲突了,要求重发,而dhcp服务器再次分配还是192.168.186.181,然后再次报decline,这样死循环,显然是dhcp服务器在设备获取ip后发现冲突,上报后,再次发起bootp的discover,而dhcp服务器没有重新分配新的空闲ip,造成的问题。
抓dhcp过程和arp验证一下
tcpdump -i eth0 -nnev port 67 or arp抓bootp过程和arp过程,看看是否arp探查过程
09:39:40.468155 64:a3:41:80:13:91 > 64:a3:80:86:ff:01, ethertype IPv4 (0x0800), length 342: (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328)
192.168.186.1.67 > 192.168.186.181.68: BOOTP/DHCP, Reply, length 300, xid 0x6a345bfe, Flags [none]
Your-IP 192.168.186.181
Client-Ethernet-Address 64:a3:80:86:ff:01
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: ACK
Server-ID Option 54, length 4: 192.168.186.1
Lease-Time Option 51, length 4: 86400
Subnet-Mask Option 1, length 4: 255.255.255.0
Default-Gateway Option 3, length 4: 192.168.186.1
Domain-Name-Server Option 6, length 4: 8.8.8.8
09:39:40.627223 64:a3:80:86:ff:01 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.186.181 tell 0.0.0.0, length 28 arp探查
09:39:40.627556 64:a3:41:b3:f7:60 > 64:a3:80:86:ff:01, ethertype ARP (0x0806), length 60: Ethernet (len 6), IPv4 (len 4), Reply 192.168.186.181 is-at 64:a3:41:b3:f7:60, length 46 arp响应
09:39:40.717197 64:a3:80:86:ff:01 > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 342: (tos 0x0, ttl 64, id 59417, offset 0, flags [none], proto UDP (17), length 328)
0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 64:a3:80:86:ff:01, length 300, xid 0x6a345bfe, Flags [none]
Client-Ethernet-Address 64:a3:80:86:ff:01
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Decline ip冲突,拒绝这个ip地址
Requested-IP Option 50, length 4: 192.168.186.181
Server-ID Option 54, length 4: 192.168.186.1
MSG Option 56, length 26: "Duplicate address detected" ip冲突
09:39:41.199411 cc:96:e5:13:94:58 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: Ethernet (len 6), IPv4 (len 4), Request who-has 169.254.169.254 tell 192.168.186.242, length 46 使用本地链路地址169.254.xxx.xxx
09:39:41.745382 cc:96:e5:13:94:58 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: Ethernet (len 6), IPv4 (len 4), Request who-has 169.254.169.254 tell 192.168.186.242, length 46
09:39:42.748513 cc:96:e5:13:94:58 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: Ethernet (len 6), IPv4 (len 4), Request who-has 169.254.169.254 tell 192.168.186.242, length 46
结论是dhcp服务器存在bug,在收到decline拒绝分配的ip后,没有给设备分配新的空闲ip地址导致的问题,但这个问题短时没有办法解决,需要规避。
想到可以对这个设备mac64:a3:80:86:ff:01进行静态绑定ip,来规避这个问题,尝试一下
在dhcp服务器上进行静态绑定mac和ip,执行后显示:
XOS(dhcp-config)#static-bind mac-address 64a3.8086.ff01 ip addr 192.168.186.44
XOS(dhcp-config)#show run | inc stati
static-bind mac-address 64A3.4191.8700 ip address 192.168.186.136
static-bind mac-address 201F.54F5.3661 ip address 192.168.186.201
static-bind mac-address C0A6.6D45.0680 ip address 192.168.186.212
static-bind mac-address CC96.E523.393C ip address 192.168.186.118
static-bind mac-address 64A3.4103.0405 ip address 192.168.186.185
static-bind mac-address 64A3.41B2.36A0 ip address 192.168.186.122
static-bind mac-address 64A3.41B4.FB51 ip address 192.168.186.132
static-bind mac-address 64A3.4193.0020 ip address 192.168.186.153
static-bind mac-address 64A4.4201.A1B1 ip address 192.168.186.245
static-bind mac-address 63A3.41B3.F760 ip address 192.168.186.59
static-bind mac-address 64A3.8086.FF01 ip address 192.168.186.44
然后拔掉设备ac的eth0口网线,改插到eth1上(eth0,担心ip信息残留,为了获得完整的discover,offer,request,ack流程),然后ip addr观察
16: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 64:a3:80:86:ff:03 brd ff:ff:ff:ff:ff:ff 物理状态激活
32: vlan1.4094: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default
link/ether 64:a3:80:86:ff:01 brd ff:ff:ff:ff:ff:ff
inet 192.168.186.44/24 brd 192.168.186.255 scope global vlan1.4094 获得静态绑定的地址192.168.186.44
valid_lft forever preferred_lft forever
inet6 fe80::66a3:80ff:fe86:ff01/64 scope link
valid_lft forever preferred_lft forever
进行路由检查:
/mnt/userspace # ip route
default via 192.168.186.1 dev vlan1.4094 proto zebra
172.16.81.0/24 dev vlan1.1 proto kernel scope link src 172.16.81.3
172.16.82.0/24 dev vlan1.2 proto kernel scope link src 172.16.82.3
172.16.84.0/24 dev vlan1.4 proto kernel scope link src 172.16.84.3
192.168.186.0/24 dev vlan1.4094 proto kernel scope link src 192.168.186.44
/mnt/userspace # route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.186.1 0.0.0.0 UG 0 0 0 vlan1.4094
172.16.81.0 0.0.0.0 255.255.255.0 U 0 0 0 vlan1.1
172.16.82.0 0.0.0.0 255.255.255.0 U 0 0 0 vlan1.2
172.16.84.0 0.0.0.0 255.255.255.0 U 0 0 0 vlan1.4
192.168.186.0 0.0.0.0 255.255.255.0 U 0 0 0 vlan1.4094
直连路由和默认路由生成,问题解决
知识点:
1、ac上多个网口,是创建了一个网桥,然后在网桥上划分vlan,eth0和eth1默认是wan口,使用vlan4093和4094,默认开启dhcp.
2、设备端口开启dhcp client功能,会发起bootp过程,获得ip后,会用获得ip发起arp探查过程,和普通arp区别的,源ip是0.0.0.0,一般默认发出三次,间隔1s,若三次没有应答,认为这个ip可用,若有响应,认为环境广播域里存在ip冲突,会发出bootp的decline消息,要求dhcp服务器重新分配ip地址。若没有重新分配ip,设备会使用本地链路地址169.254.xxx.xxx这个地址,并进行arp探查。
探查arp请求消息:发送ip和目的mac为00

探查arp响应消息:



2333

被折叠的 条评论
为什么被折叠?



