cisco交换机开启dhcp服务
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了cisco交换机开启dhcp服务相关的知识,希望对你有一定的参考价值。
拓扑图如下:
上述设备用途说明:
1、使用R1做dhcp server
2、使用R2和R3代替电脑做dhcp client
3、SW1用做傻瓜交换机。
dhcp server配置(R1配置):
R1#disable #############使用 disable 命令退出特权模式 R1> R1>enable #############使用 enable 命令进入特权模式 R1#show privilege Current privilege level is 15 #############查看特权模式的级别 ############# 进入配置模式 R1#configure terminal Enter configuration commands, one per line. End with CNTL/Z. R1(config)#exit #############查看接口状态 R1#show ip interface brief Interface IP-Address OK? Method Status Protocol FastEthernet0/0 unassigned YES unset administratively down down FastEthernet0/1 unassigned YES unset administratively down down Serial1/0 unassigned YES unset administratively down down Serial1/1 unassigned YES unset administratively down down Serial1/2 unassigned YES unset administratively down down Serial1/3 unassigned YES unset administratively down down R1#configure terminal Enter configuration commands, one per line. End with CNTL/Z. #############进入接口进行配置 R1(config)#int fastEthernet 0/0 R1(config-if)#no shutdown R1(config-if)# *Aug 1 19:39:28.523: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up *Aug 1 19:39:29.523: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up R1(config-if)#ip address 123.1.1.1 255.255.255.0 R1(config-if)# R1(config-if)# #############在配置模式中查看接口状态需要加 do 前缀 R1(config-if)#do show ip interface brief Interface IP-Address OK? Method Status Protocol FastEthernet0/0 123.1.1.1 YES manual up up FastEthernet0/1 unassigned YES unset administratively down down Serial1/0 unassigned YES unset administratively down down Serial1/1 unassigned YES unset administratively down down Serial1/2 unassigned YES unset administratively down down Serial1/3 unassigned YES unset administratively down down R1(config-if)# #############也可使用 end 命令退出配置模式 R1(config-if)#end R1# R1# *Aug 1 19:43:17.991: %SYS-5-CONFIG_I: Configured from console by console R1# R1#configure terminal Enter configuration commands, one per line. End with CNTL/Z. #############开启dhcp server 功能 R1(config)#service dhcp R1(config)#ip dhcp pool R123 R1(dhcp-config)#network 123.1.1.0 255.255.255.0 #############将客户端的网关指向 dhcp server 接口的IP R1(dhcp-config)#default-router 123.1.1.1 #############将客户端的DNS指向 dhcp server 接口的IP R1(dhcp-config)#dns-server 123.1.1.1 #############设置租期为1天0时1分 R1(dhcp-config)#lease 1 0 1 #############配置域名为cisco.com R1(dhcp-config)#domain-name cisco.com R1(dhcp-config)#
dhcp client配置(R2和R3配置):
R2#configure terminal Enter configuration commands, one per line. End with CNTL/Z. #############禁用ip routing路由转发表,将路由器模拟为pc R2(config)#no ip routing R2(config)#int fastEthernet 0/0 R2(config-if)#no shutdown R2(config-if)# *Aug 1 19:07:41.279: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up *Aug 1 19:07:42.279: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up #############开启dhcp动态获取 R2(config-if)#ip address dhcp R2(config-if)# *Aug 1 19:11:47.891: %DHCP-6-ADDRESS_ASSIGN: Interface FastEthernet0/0 assigned DHCP address 123.1.1.2, mask 255.255.255.0, hostname R2 R2(config-if)#end #############查看接口状态 R2#show ip interface brief Interface IP-Address OK? Method Status Protocol FastEthernet0/0 123.1.1.2 YES DHCP up up FastEthernet0/1 unassigned YES unset administratively down down Serial1/0 unassigned YES unset administratively down down Serial1/1 unassigned YES unset administratively down down Serial1/2 unassigned YES unset administratively down down Serial1/3 unassigned YES unset administratively down down R2# #############查看单独接口状态 R2#show running-config interface fastEthernet 0/0 Building configuration... Current configuration : 94 bytes ! interface FastEthernet0/0 ip address dhcp no ip route-cache duplex auto speed auto end
本文出自 “甘木” 博客,请务必保留此出处http://ganmu.blog.51cto.com/9305511/1952781
以上是关于cisco交换机开启dhcp服务的主要内容,如果未能解决你的问题,请参考以下文章
Cisco dhcp snooping实例3-多交换机环境(DHCP服务器和DHCP客户端位于同VLAN)
cisco思科开启dhcp,不同vlan确保全网互通(详细步骤)
Cisco dhcp snooping实例1-单交换机(DHCP服务器和DHCP客户端位于同一VLAN)