来源: 最后更新:24-04-09 12:10:32
通过本实验掌握,如何在Cisco Catalyst 3550交换机来配置DHCP服务,实现对内网主机分配IP地址,网关,DNS,WINS,租期,域名等。可能你之前是在windows Server服务器或者Cisco Router 部署过DHCP,但在工程项目中,根据需求,大多是在接入层或者汇聚层多层交换机来配置的,可以同时实现DHCP Snooping等技术。
实验过程:
第一步:Catalyst 3550底层配置
Switch(config)#no ip do lo
Switch(config)#line con 0
Switch(config-line)#no exec-t
Switch(config-line)#logg syn
Switch(config-line)#host Switch_Dhcp
Switch_Dhcp(config)#int f0/1
Switch_Dhcp(config-if)#no sh
Switch_Dhcp(config-if)#spanning-tree portfast
//连接终端的接口下,开启portfast特性,跳过生成树的选举,接口立即进入转发状态
%Warning: portfast should only be enabled on ports connected to a single
host. Connecting hubs, concentrators, switches, bridges, etc... to this
interface when portfast is enabled, can cause temporary bridging loops.
Use with CAUTION
%Portfast has been configured on FastEthernet0/1 but will only
have effect when the interface is in a non-trunking mode.
Switch_Dhcp(config-if)#end
第二步: 开启DHCP服务,定义分配地址池范围及掩码,网关,DNS,域名,租期等
//全局下开启DHCP服务,该服务默认是关闭的
复制代码
Switch_Dhcp#show vlan brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/15, Fa0/16, Fa0/17
Fa0/18, Fa0/19, Fa0/20, Fa0/21
Fa0/22, Fa0/23, Fa0/24, Gi0/1
Gi0/2
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
Switch_Dhcp#conf t
Enter configuration commands, one per line. End with CNTL/Z.
//进入管理VLAN1 下,启用SVI功能
Switch_Dhcp(config)#int vlan 1
//配置VLAN的地址为192.168.0.1 掩码为24位,默认情况下Cisco Catalyst交换机所有的物理接口都属于VLAN1,此地址也就是PC网关地址。
Switch_Dhcp(config-if)#ip add 192.168.0.1 255.255.255.0
Switch_Dhcp(config-if)#no sh
Switch_Dhcp(config-if)#end
Switch_Dhcp#
00:09:07: %SYS-5-CONFIG_I: Configured from console by console
Switch_Dhcp#
00:09:08: %LINK-3-UPDOWN: Interface Vlan1, changed state to up
00:09:09: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to
第四步:查看当前交换机配置文件
复制代码
代码如下:
//验证DHCP的配置信息
Switch_Dhcp#sh run | begin ip dhcp
第五步:此时将PC1的网线插入Catalyst 3550 的F0/1接口,并在PC上查看IP地址获得信息。PC上的本地连接,TCP/IP 设置为自动获得IP地址形式。
PC上查看方法:开始-运行-cmd-ipconfig/all
从以上信息可以得出,PC已经能从DHCP服务器获得IP地址等信息,实验现象成功。
第六步:查看交换机DHCP 动态绑定,以及交换机DHCP Server状态信息
复制代码
代码如下:
//查看DHCP动态绑定信息,从这里可以看到PC,从DHCP地址池中的得到IP地址,以及PC的MAC地址等
Switch_Dhcp#show ip dhcp binding
IP address Client-ID/ Lease expiration Type
Hardware address
192.168.0.2 0100.16d3.249f.fd Infinite Automatic
//查看DHCP服务器工作状态
Switch_Dhcp#show ip dhcp server statistics
Memory usage 5661
Address pools 1
Database agents 0
Automatic bindings 1
Manual bindings 0
Expired bindings 0
Malformed messages 0
Message Received
BOOTREQUEST 0
DHCPDISCOVER 2
DHCPREQUEST 3
DHCPDECLINE 0
DHCPRELEASE 0
DHCPINFORM 3
Message Sent
BOOTREPLY 0
DHCPOFFER 2
DHCPACK 6
DHCPNAK 0
Switch_Dhcp#
Switch_Dhcp#clear ip dhcp binding *
第七步:使用debug 调试命令查看PC申请IP地址过程(DHCP工作过程)
在PC上:开始-运行-cmd-ipconfig /release (释放获得IP地址)
重新申请IP地址ipconfig /renew
此时查看交换机日志信息
复制代码
代码如下:
Switch_Dhcp#debug ip dhcp server events
01:13:12: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Switch_Dhcp#
01:13:13: DHCPD: DHCPDISCOVER received from client 0100.16d3.249f.fd on interface Vlan1.
Switch_Dhcp#
01:13:20: DHCPD: assigned IP address 192.168.0.3 to client 0100.16d3.249f.fd.
01:13:20: DHCPD: Sending DHCPOFFER to client 0100.16d3.249f.fd (192.168.0.3).
01:13:20: DHCPD: broadcasting BOOTREPLY to client 0016.d324.9ffd.
01:13:20: DHCPD: DHCPREQUEST received from client 0100.16d3.249f.fd.
01:13:20: DHCPD: Sending DHCPACK to client 0100.16d3.249f.fd (192.168.0.3).
01:13:20: DHCPD: broadcasting BOOTREPLY to client 0016.d324.9ffd.
Switch_Dhcp#
01:13:23: DHCPD: DHCPINFORM received from client 0100.16d3.249f.fd (192.168.0.3).
01:13:23: DHCPD: Sending DHCPACK to client 0100.16d3.249f.fd (192.168.0.3).
01:13:23: DHCPD: unicasting BOOTREPLY to client 0016.d324.9ffd (192.168.0.3).
本文出自 “王万利的博客” 博客
歌剧魅影电影剧情(歌剧魅影电影主演)1、在歌剧院的地下深处,传说住着一名相貌丑陋、戴着面具、却学识
上饶科技馆春节假期开放安排(上饶科技馆每日开馆时间) 2024年2月4日宜昌最新交通管制路段(宜昌交通路况查询电话) 2月4日宜昌交通最新路况(宜昌路况实时查询电话) 许昌契税补贴二手房可以申请吗 许昌契税补贴二手房可以申请吗知乎