本文共 2665 字,大约阅读时间需要 8 分钟。
一、实验拓扑:
二、命令部署:1、基本命令:Server(config)#int f1/0Server(config-if)#no shutdown Server(config-if)#no switchport Server(config-if)#ip add 172.168.24.1 255.255.255.0Server(config)#ip dhcp pool vlan10
Server(dhcp-config)#network 192.168.10.0 255.255.255.0Server(dhcp-config)#default-router 192.168.10.254Server(dhcp-config)#dns-server 8.8.8.8Server(dhcp-config)#lease 15Server(config)#ip dhcp pool vlan20
Server(dhcp-config)#network 192.168.20.0 255.255.255.0Server(dhcp-config)#default-router 192.168.20.254Server(dhcp-config)#dns-server 8.8.8.8Server(dhcp-config)#lease 30Server(config)#ip dhcp excluded-address 192.168.10.254
Server(config)#ip dhcp excluded-address 192.168.20.254Server(config)#ip routing
Server(config)#router ospf 100Server(config-router)#network 172.168.24.0 0.0.0.255 area 0SW1(config)#int f1/0
SW1(config-if)#no shutdown SW1(config-if)#no switchport SW1(config-if)#ip address 172.168.24.2 255.255.255.0SW1(config)#int f1/1
SW1(config-if)#no shutdown SW1(config-if)#switchport trunk encapsulation dot1q SW1(config-if)#switchport mode trunkSW1(config)#int vlan 10
SW1(config-if)#no shutdown SW1(config-if)#ip address 192.168.10.254 255.255.255.0SW1(config)#int vlan 20SW1(config-if)#no shutdown SW1(config-if)#ip address 192.168.20.254 255.255.255.0SW1(config)#ip routing
SW1(config)#router ospf 100SW1(config-router)#network 172.168.24.0 0.0.0.255 area 0SW1(config-router)#network 192.168.10.0 0.0.0.255 area 0SW1(config-router)#network 192.168.20.0 0.0.0.255 area 0SW2(config)#int f1/0
SW2(config-if)#no shutdown SW2(config-if)#switchport trunk encapsulation dot1q SW2(config-if)#switchport mode trunkSW2(config)#int f1/1
SW2(config-if)#no shutdown SW2(config-if)#switchport mode access SW2(config-if)#switchport access vlan 10SW2(config)#int f1/2
SW2(config-if)#no shutdown SW2(config-if)#switchport mode access SW2(config-if)#switchport access vlan 20SW2(vlan)#vlan 10
VLAN 10 added:Name: VLAN0010SW2(vlan)#vlan 20VLAN 20 added:Name: VLAN0020SW2(config)#no ip routing
PC1(config)#int f0/0
PC1(config-if)#no shutdown PC1(config-if)#ip address dhcpPC1(config)#no ip routingPC1(config)#ip default-gateway 192.168.10.254PC2(config)#int f0/0
PC2(config-if)#no shutdown PC2(config-if)#ip address dhcpPC2(config)#no ip routingPC2(config)#ip default-gateway 192.168.20.2542、重点命令:
SW1(config)#int vlan 10SW1(config-if)#ip helper-address 172.168.24.1SW1(config)#int vlan 20
SW1(config-if)#ip helper-address 172.168.24.1三、验证:
(1)交换机SW2和三层交换机SW1抓包VLAN20发出的DHCP DiscoverVLAN10发出的DHCP Discover(2)Server端和三层交换机SW1之间抓包GNS3-0.8.6GNS3:IOU
结论:必须要用IOU做才有效果,其它模拟命令可以敲,但是都没有效果的。转载于:https://blog.51cto.com/13856092/2137430