R7 r8 r10端口动态获取ip
router(config)#interfacef0/0
Router(config-if)#ip address dhcp
R6划分VLAN 打上trunk
R5配置
Router(config)#interface f0/0
Router(config-if)#no shutdown
Router(config-subif)#interface f0/0.2
Router(config-subif)#no shutdown
Router(config-subif)#encapsulation dot1q 2
Router(config-subif)#ip address 192.168.20.1 255.255.255.0
Router(config-subif)#interface f0/0.3
Router(config-subif)#encapsulation dot1q 3
Router(config-subif)#ip address 192.168.30.1 255.255.255.0
Router(config)#service dhcp
Router(config)#ip dhcp excluded-address 192.168.20.1 192.168.20.10
Router(config)#ip dhcp excluded-address 192.168.30.1 192.168.30.10
Router(config)#ip dhcp excluded-address 192.168.40.1 192.168.40.10
Router(config)#ip dhcp pool yang
Router(dhcp-config)#network 192.168.0.0 255.255.0.0
Router(dhcp-config)#dns-server 5.5.5.5
Router(dhcp-config)#domain-name yang.com
Router(dhcp-config)#lease 2
Router(dhcp-config)#ip dhcp pool vlan2
Router(dhcp-config)#network 192.168.20.0 255.255.255.0
Router(dhcp-config)#lease 1
Router(dhcp-config)#default-router 192.168.20.1
Router(dhcp-config)#ip dhcp pool vlan3
Router(dhcp-config)#network 192.168.30.0 255.255.255.0
Router(dhcp-config)#default-router 192.168.30.1
Router(dhcp-config)#lease 1
Router(dhcp-config)#ip dhcp pool vlan4
Router(dhcp-config)#network 192.168.40.0 255.255.255.0
Router(dhcp-config)#default-router 192.168.40.1
Router(dhcp-config)#lease 1
R9配置
Router(config)#service dhcp
Router(config)#interface f0/0
Router(config-if)#no sh
Router(config-if)#ip address 192.168.40.1 255.255.255.0
Router(config-if)#ip helper-address 1.1.1.1
R5和R9封装路由协议;