DHCP配置
2个交换机,3个路由器,其中2个模拟PC。
拓扑: R1 E0--F0/1 SW1 F0/15---F0/15 SW2 F0/2 ---R2
SW2 F0/3---R3 R2,R3 模拟PC
R1
Router>
Router>en
Router#conf t
Router(config)#hos r1
r1(config)#int e0/0
r1(config-if)#ip add 192.168.100.1 255.255.255.0
r1(config-if)#no sh
r1(config-if)#lin lo 0
r1(config-if)#ip add 1.1.1.1 255.255.255.0
r1(config-if)#no sh
r1(config-if)#exit
r1(config)#service dhcp //开启DHCP 服务
r1(config)#ip dhcp pool qq // qq为DHCP 的服务ID
r1(dhcp-config)#network 192.168.1.0 255.255.255.0 //宣告网段
r1(dhcp-config)#default-router 192.168.1.1 //宣告网关
r1(dhcp-config)#exit
r1(config)#ip dhcp excluded-address 192.168.1.88 //排除192.168.1.88 在宣告的网段中
r1(config)#ip dhcp aa
r1(config)#ip dhcp pool aa
r1(dhcp-config)#network 192.168.2.0 255.255.255.0
r1(dhcp-config)#default-router 192.168.2.1
r1(dhcp-config)#exit
r1(config)#ip dhcp excluded-address 192.168.2.88
r1(config)#
R2
Router>
Router>en
Router#conf t
Router(config)#no ip routing
Router(config)#hos Pc1
Pc1(config)#int e0/0
Pc1(config-if)#ip add dhcp
Pc1(config-if)#no sh
Pc1(config-if)#exit
Pc1(config)#^Z
Pc1#
R3
Router>
Router>en
Router#conf t
Router(config)#hos pc2
pc2(config)#no ip routing
pc2(config)#int e0/0
pc2(config-if)#ip add dhcp
pc2(config-if)#no sh
pc2(config-if)#exit
SW1
Router>en
Router#
Router#conf t
Router(config)#hos sw1
sw1(config)#ip routing
sw1(config)#int f0/1
sw1(config-if)#no switchport
sw1(config-if)#exit
sw1(config)#exit
sw1#vlan database
sw1(vlan)#vlan 2
VLAN 2 added:
Name: VLAN0002
sw1(vlan)#vlan 3
VLAN 3 added:
Name: VLAN0003
sw1(vlan)#exit
APPLY completed.
Exiting....
sw1#conf t
Sw1(config)#int f0/15
sw1(config-if)#switchport trunk encapsulation dot1q
sw1(config-if)#switchport mode trunk
sw1(config-if)#no sh
sw1(config)#no cdp run
sw1(config)#int vlan 2
sw1(config-if)#ip add 192.168.1.1 255.255.255.0
sw1(config-if)#no sh
sw1(config-if)#int vlan 3
sw1(config-if)#ip add 192.168.2.1 255.255.255.0
sw1(config-if)#no sh
sw1(config)#int vlan 2
sw1(config-if)#ip helper-address 192.168.100.1 //中继
sw1(config-if)#int vlan 3
sw1(config-if)#ip helper-address 192.168.100.1 //中继
SW2
Router>
Router>en
Router#conf t
Router(config)#hos sw2
sw2#vlan database
sw2(vlan)#vlan 2
VLAN 2 added:
Name: VLAN0002
sw2(vlan)#vlan 3
VLAN 3 added:
Name: VLAN0003
sw2(vlan)#exit
APPLY completed.
Exiting....
sw2#
sw2#conf t
sw2(config)#no cdp run
sw2(config)#int f0/2
sw2(config-if)#switchport mode access
sw2(config-if)#switchport access vlan 2
sw2(config-if)#no sh
sw2(config-if)#int f0/3
Sw2(config-if)#switchport mode access
sw2(config-if)#switchport access vlan 3
sw2(config-if)#no sh
sw2(config-if)#int f0/15
sw2(config-if)#switchport trunk encapsulation dot1q
sw2(config-if)#switchport mode trunk
sw2(config-if)#no sh
sw2(config-if)#exit
sw2(config)#^Z
阅读(1173) | 评论(0) | 转发(0) |