wKiom1fWwbbx2XkYAAAeNmv_szQ762.png-wh_50

拓扑很简单

R1作为DHCP服务器模拟为ISP,R2作为DHCP客户端,作为公司链接ISP的出口

按道理来说,这种配置是相当容易的


R1的配置

R1#conf t

R1(config)#int s2/0

R1(config-if)#ip add 10.1.1.1 255.255.255.0

R1(config-if)#no sh

R1(config-if)#exit

R1(config)#ip dhcp pool ISP

R1(dhcp-config)#network 10.1.1.0 /24

R1(dhcp-config)#default-router 10.1.1.1

R1(dhcp-config)#exit

R1(config)#ip dhcp excluded-address 10.1.1.1    //排除地址




R2的配置

R2#conf t

R2(config)#int s2/0

R2(config-if)#ip address ? 

  A.B.C.D     IP address

  negotiated  IP Address negotiated over PPP

  pool        IP Address autoconfigured from a local DHCP pool

  slarp       Set IP address through SLARP

可以看出,并没有dhcp选项,然后我上网查了一下,还可以使用

R2(config-if)#ip dhcp client client-id s2/0   

其实并没有什么卵用(可能是我配置错误)


一开始我以为是IOS的问题,一开始使用的是


c3640-ik9o3s-mz.124-25c.bin


后来我换成了


c3660-ik9o3s-mz.124-15.T6.bin


发现还是同样的问题


接下来我思考的是,是不是串口不能做DHCP(一开始感觉这个想法有点扯淡,毕竟链接ISP的介质大多都是串行线)


接下来我使用了快速以太网端口


wKioL1fXMlbix3iAAAAUjyLFV8w984.png-wh_50

R1(config)#int s2/0

R1(config-if)#no ip add

R1(config-if)#int f0/0

R1(config-if)#ip add 10.1.1.1 255.255.255.0

R1(config-if)#no sh


DHCP服务照常


R2(config-if)#int f0/0 

R2(config-if)#no sh

R2(config-if)#ip add ?

  A.B.C.D  IP address

  dhcp     IP Address negotiated via DHCP

  pool     IP Address autoconfigured from a local DHCP pool


发现DHCP选项,很惊喜有木有


R2(config-if)#ip add dhcp


结果如下


R2(config-if)#

*Mar  1 00:49:17.411: %DHCP-6-ADDRESS_ASSIGN: Interface FastEthernet0/0 assigned DHCP address 10.1.1.2, mask 255.255.255.0, hostname R2



R2#show ip int b

Interface                  IP-Address      OK? Method Status                Protocol

FastEthernet0/0            10.1.1.2        YES DHCP   up                    up      

FastEthernet0/1            unassigned      YES unset  administratively down down    

FastEthernet1/0            unassigned      YES unset  administratively down down    

Serial2/0                  unassigned      YES unset  administratively down down    


获取到了


接下来,我使用Cisco Packet Tracer 7.0 来配置


wKiom1fXMmaDzrzNAAAZKeFB-TA157.png-wh_50


R1配置完了之后

R的配置如下

R2(config)#int s0/3/0

R2(config-if)#ip add

R2(config-if)#ip address ?

A.B.C.D  IP address

R2(config-if)#ip ?

access-group        Specify access control for packets

address             Set the IP address of an interface

authentication      authentication subcommands

flow                NetFlow Related commands

hello-interval      Configures IP-EIGRP hello interval

helper-address      Specify a destination address for UDP broadcasts

mtu                 Set IP Maximum Transmission Unit

nat                 NAT interface commands

ospf                OSPF interface commands

split-horizon       Perform split horizon

summary-address     Perform address summarization

virtual-reassembly  Virtual Reassembly


还是没有dhcp的选项


同样的,吉比特以太网接口是有的


R2(config-if)#int g0/0

R2(config-if)#ip add ?

A.B.C.D  IP address

dhcp     IP Address negotiated via DHCP



小结(暂时):思科的串行接口不支持DHCP动态获取地址。