拓扑图如下:
上述设备用途说明:
1、使用R1做dhcp server
2、使用R2和R3代替电脑做dhcp client
3、SW1用做傻瓜交换机。
dhcp server配置(R1配置):
R1#disable#############使用disable命令退出特权模式R1>R1>enable#############使用enable命令进入特权模式R1#showprivilegeCurrentprivilegelevelis15#############查看特权模式的级别#############进入配置模式R1#configureterminalEnterconfigurationcommands,oneperline.EndwithCNTL/Z.R1(config)#exit#############查看接口状态R1#showipinterfacebriefInterfaceIP-AddressOK?MethodStatusProtocolFastEthernet0/0unassignedYESunsetadministrativelydowndownFastEthernet0/1unassignedYESunsetadministrativelydowndownSerial1/0unassignedYESunsetadministrativelydowndownSerial1/1unassignedYESunsetadministrativelydowndownSerial1/2unassignedYESunsetadministrativelydowndownSerial1/3unassignedYESunsetadministrativelydowndownR1#configureterminalEnterconfigurationcommands,oneperline.EndwithCNTL/Z.#############进入接口进行配置R1(config)#intfastEthernet0/0R1(config-if)#noshutdownR1(config-if)#*Aug119:39:28.523:%LINK-3-UPDOWN:InterfaceFastEthernet0/0,changedstatetoup*Aug119:39:29.523:%LINEPROTO-5-UPDOWN:LineprotocolonInterfaceFastEthernet0/0,changedstatetoupR1(config-if)#ipaddress123.1.1.1255.255.255.0R1(config-if)#R1(config-if)##############在配置模式中查看接口状态需要加do前缀R1(config-if)#doshowipinterfacebriefInterfaceIP-AddressOK?MethodStatusProtocolFastEthernet0/0123.1.1.1YESmanualupupFastEthernet0/1unassignedYESunsetadministrativelydowndownSerial1/0unassignedYESunsetadministrativelydowndownSerial1/1unassignedYESunsetadministrativelydowndownSerial1/2unassignedYESunsetadministrativelydowndownSerial1/3unassignedYESunsetadministrativelydowndownR1(config-if)##############也可使用end命令退出配置模式R1(config-if)#endR1#R1#*Aug119:43:17.991:%SYS-5-CONFIG_I:ConfiguredfromconsolebyconsoleR1#R1#configureterminalEnterconfigurationcommands,oneperline.EndwithCNTL/Z.#############开启dhcpserver功能R1(config)#servicedhcpR1(config)#ipdhcppoolR123R1(dhcp-config)#network123.1.1.0255.255.255.0#############将客户端的网关指向dhcpserver接口的IPR1(dhcp-config)#default-router123.1.1.1#############将客户端的DNS指向dhcpserver接口的IPR1(dhcp-config)#dns-server123.1.1.1#############设置租期为1天0时1分R1(dhcp-config)#lease101#############配置域名为cisco.comR1(dhcp-config)#domain-namecisco.comR1(dhcp-config)#
dhcp client配置(R2和R3配置):
R2#configureterminalEnterconfigurationcommands,oneperline.EndwithCNTL/Z.#############禁用iprouting路由转发表,将路由器模拟为pcR2(config)#noiproutingR2(config)#intfastEthernet0/0R2(config-if)#noshutdownR2(config-if)#*Aug119:07:41.279:%LINK-3-UPDOWN:InterfaceFastEthernet0/0,changedstatetoup*Aug119:07:42.279:%LINEPROTO-5-UPDOWN:LineprotocolonInterfaceFastEthernet0/0,changedstatetoup#############开启dhcp动态获取R2(config-if)#ipaddressdhcpR2(config-if)#*Aug119:11:47.891:%DHCP-6-ADDRESS_ASSIGN:InterfaceFastEthernet0/0assignedDHCPaddress123.1.1.2,mask255.255.255.0,hostnameR2R2(config-if)#end#############查看接口状态R2#showipinterfacebriefInterfaceIP-AddressOK?MethodStatusProtocolFastEthernet0/0123.1.1.2YESDHCPupupFastEthernet0/1unassignedYESunsetadministrativelydowndownSerial1/0unassignedYESunsetadministrativelydowndownSerial1/1unassignedYESunsetadministrativelydowndownSerial1/2unassignedYESunsetadministrativelydowndownSerial1/3unassignedYESunsetadministrativelydowndownR2##############查看单独接口状态R2#showrunning-configinterfacefastEthernet0/0Buildingconfiguration...Currentconfiguration:94bytes!interfaceFastEthernet0/0ipaddressdhcpnoiproute-cacheduplexautospeedautoend
本文出自 “甘木” 博客,请务必保留此出处http://ganmu.blog.51cto.com/9305511/1952781