标签:code ddr abi def arp port 路由 lease 过程
一:实验环境[SW1]vlan batch 10 20
[SW1]int e0/0/1
[SW1-Ethernet0/0/1]p l a
[SW1-Ethernet0/0/1]p d v 10
[SW1-Ethernet0/0/1]un sh
[SW1-Ethernet0/0/1]int e0/0/2
[SW1-Ethernet0/0/2]p l a
[SW1-Ethernet0/0/2]p d v 20
[SW1-Ethernet0/0/2]un sh
[SW1-Ethernet0/0/2]int e0/0/3
[SW1-Ethernet0/0/3]p l a
[SW1-Ethernet0/0/3]p d v 10
[SW1-Ethernet0/0/3]un sh
[SW1-Ethernet0/0/4]int e0/0/4
[SW1-Ethernet0/0/4]p l a
[SW1-Ethernet0/0/4]p d v 20
[SW1-Ethernet0/0/4]un sh
[SW1-Ethernet0/0/4]int g0/0/1
[SW1-GigabitEthernet0/0/1]p l t
[SW1-GigabitEthernet0/0/1]p t a v a
[SW1-GigabitEthernet0/0/1]un sh
[SW1]dis int b
Ethernet0/0/1 up up 0% 0% 0 0
Ethernet0/0/2 up up 0% 0% 0 0
Ethernet0/0/3 up up 0% 0% 0 0
Ethernet0/0/4 up up 0% 0%
[SW1]dis cu
interface Ethernet0/0/1
port link-type access
port default vlan 10
interface Ethernet0/0/2
port link-type access
port default vlan 20
interface Ethernet0/0/3
port link-type access
port default vlan 10
interface Ethernet0/0/4
port link-type access
port default vlan 20
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
2.3 配置R1路由器
先配置单臂路由
interface GigabitEthernet0/0/0
ip address 12.0.0.1 255.255.255.0
[R1]int g0/0/1.10
[R1-GigabitEthernet0/0/1.10]ip add 192.168.10.1 24
[R1-GigabitEthernet0/0/1.10]d t v 10
[R1-GigabitEthernet0/0/1.10]a b e
[R1-GigabitEthernet0/0/1.10]un sh
[R1]int g0/0/1.20
[R1-GigabitEthernet0/0/1.20]ip add 192.168.20.1 24
[R1-GigabitEthernet0/0/1.20]dot1q termination vid 20
[R1-GigabitEthernet0/0/1.20]arp broadcast enable
[R1-GigabitEthernet0/0/1.20]un sh
再配置DNS
[R1]int g0/0/1.10
[R1-GigabitEthernet0/0/1.10]dhcp select interface
[R1-GigabitEthernet0/0/1.10]dhcp server dns-list 2.2.2.2 8.8.8.8
[R1-GigabitEthernet0/0/1.10]int g0/0/1.20
[R1-GigabitEthernet0/0/1.20]dhcp select interface
[R1-GigabitEthernet0/0/1.20]dhcp server dns-list 2.2.2.2 8.8.8.8
[R1-GigabitEthernet0/0/1.20]dis this
interface GigabitEthernet0/0/1.20
dot1q termination vid 20
ip address 192.168.20.1 255.255.255.0
arp broadcast enable
dhcp select interface
dhcp server dns-list 2.2.2.2 8.8.8.8
[R1-GigabitEthernet0/0/1.20]int g0/0/1.10
[R1-GigabitEthernet0/0/1.10]dis this
interface GigabitEthernet0/0/1.10
dot1q termination vid 10
ip address 192.168.10.1 255.255.255.0
arp broadcast enable
dhcp select interface
dhcp server dns-list 2.2.2.2 8.8.8.8
配置路由[R1]ip route-static 0.0.0.0 0.0.0.0 12.0.0.2
2.4 配置R2路由器
先配置接口
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 12.0.0.2 24
[R2-GigabitEthernet0/0/0]un sh
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 15.0.0.1 24
[R2-GigabitEthernet0/0/1]un sh
再配置DHCP
[R2]dhcp enable
[R2-GigabitEthernet0/0/1]dhcp select global
[R2-GigabitEthernet0/0/1]q
[R2]ip pool DHCP15
[R2-ip-pool-DHCP15]network 15.0.0.0 mask 24
[R2-ip-pool-DHCP15]gateway-list 15.0.0.1
[R2-ip-pool-DHCP15]dns-list 8.8.8.8 2.2.2.2
[R2-ip-pool-DHCP15]dis this
ip pool DHCP15
gateway-list 15.0.0.1
network 15.0.0.0 mask 255.255.255.0
dns-list 8.8.8.8 2.2.2.2
[R2]ip route-static 192.168.10.0 24 12.0.0.1
[R2]ip route-static 192.168.20.0 24 12.0.0.1
2.5 PC端测试
把其余PC均设置DHCP 再应用并查看其他地址
Ipconfig /renew 重新获取ip地址
Ipconfig /release 释放IP地址
再用其他PC ping 192.168.10.254,都能ping通
2.4 抓包研究DHCP报文
标签:code ddr abi def arp port 路由 lease 过程
原文地址:https://blog.51cto.com/14625831/2499370