配置DHCP的思路:
1.创建dhcp服务
2.添加一个网络号(或者说地址池)
3.排除路由器的网管
4.排除DHCP的网关
代码:
Router>enable
Router#config
Router#configure t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface fa0/0
Router(config-if)#ip address 192.168.1.1 255.255.255.0
Router(config-if)#no shRouter(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#exit
Router(config)#ip dhcp??
dhcp
Router(config)#ip dhcp ?
excluded-address Prevent DHCP from assigning certain addresses
pool Configure DHCP address pools
Router(config)#ip dhcp pool test //创建名为test的dhcp服务
Router(dhcp-config)#network 192.168.1.1 255.255.255.0//添加网络号
Router(dhcp-config)#defa
Router(dhcp-config)#default-router 192.168.1.1 //排除路由的网关
Router(dhcp-config)#exit
Router(config)#ip dhcp
Router(config)#ip dhcp e
Router(config)#ip dhcp excluded-address 192.168.1.1 //排除DHCP的网关
Router(config)#exit