华为DHCP实验
为了抓取DHCP发包过程,将一台Router模拟成PC。https://upload-images.jianshu.io/upload_images/24325874-59e3cfff778c61cd.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240
先在AR1上面配置地址。12.1.1.1 24然后开启DHCP配置dhcp enableint g0/0/0dhcp select interfacedhcp server dns-list 114.114.114.114 8.8.8.8DNSdhcp server domain-name huawei.con域名dhcp server lease day 3 hour 0 minute 0 过期时间dhcp server excluded-ip-address 12.1.1.101 12.1.1.253设置排除在外的地址池,将不再下发12.1.1.101-12.1.1.253内的IP
https://upload-images.jianshu.io/upload_images/24325874-062a436fbf9e0842.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240
现在在PC上启用DHCP ,查看一下结果
https://upload-images.jianshu.io/upload_images/24325874-1d79bf44dfdd33e9.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240
PC已经获取到地址
https://upload-images.jianshu.io/upload_images/24325874-c2ee09f2c28ea770.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240
现在在用AR2模拟一下PC,进行抓包。先打开抓包。抓这个接口。
https://upload-images.jianshu.io/upload_images/24325874-d9a695c1a618de4e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240
然后配置R2,开启DHCP。将接口改为客户端模式。dhcp enableint g0/0/0ip address dhcp-alloc配置接口模拟dhcp客户端
https://upload-images.jianshu.io/upload_images/24325874-1ab17e984bc13944.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240
抓到了DHCP四个报文。
https://upload-images.jianshu.io/upload_images/24325874-050d0dc1e5546adf.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240
Discover 源地址全0目的地址255.255.255.255Offer源地址是R1目的为99先看Discover报文
https://upload-images.jianshu.io/upload_images/24325874-15950374c51023e8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240
端口68的为客户端 67的为服务器
https://upload-images.jianshu.io/upload_images/24325874-7be58fe347d18a43.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240
Flag字段,置0就是允许接收单播换下一个报文Offer
https://upload-images.jianshu.io/upload_images/24325874-1b755a5fe56938ed.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240
上图可见,Offer中携带被分配的IP地址。去AR2上面验证,是否是报文中的IP地址。
https://upload-images.jianshu.io/upload_images/24325874-0f6a6c051b2d1b0a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240
验证成功,实验结束。
学习了dhcp
页:
[1]