拓扑图如下:上述设备用途说明: 1、使用R1做dhcp server 2、使用R2和R3代替电脑做dhcp client 3、SW1用做傻瓜交换机。dhcp server配置(R1配置):R1#d
.
拓扑图如下:
上述设备用途说明:
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 briefInterface IP-Address OK? Method Status ProtocolFastEthernet0/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/0R1(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 upR1(config-if)#ip address 123.1.1.1 255.255.255.0R1(config-if)#R1(config-if)##############在配置模式中查看接口状态需要加 do 前缀R1(config-if)#do show ip interface briefInterface IP-Address OK? Method Status ProtocolFastEthernet0/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)#endR1#R1#*Aug 1 19:43:17.991: %SYS-5-CONFIG_I: Configured from console by consoleR1#R1#configure terminal Enter configuration commands, one per line. End with CNTL/Z.#############开启dhcp server 功能R1(config)#service dhcpR1(config)#ip dhcp pool R123R1(dhcp-config)#network 123.1.1.0 255.255.255.0#############将客户端的网关指向 dhcp server 接口的IPR1(dhcp-config)#default-router 123.1.1.1#############将客户端的DNS指向 dhcp server 接口的IPR1(dhcp-config)#dns-server 123.1.1.1#############设置租期为1天0时1分R1(dhcp-config)#lease 1 0 1#############配置域名为cisco.comR1(dhcp-config)#domain-name cisco.comR1(dhcp-config)#
dhcp client配置(R2和R3配置):
R2#configure terminal Enter configuration commands, one per line. End with CNTL/Z.#############禁用ip routing路由转发表,将路由器模拟为pcR2(config)#no ip routing R2(config)#int fastEthernet 0/0 R2(config-if)#no shutdownR2(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 dhcpR2(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 R2R2(config-if)#end#############查看接口状态R2#show ip interface briefInterface IP-Address OK? Method Status ProtocolFastEthernet0/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/0Building configuration...Current configuration : 94 bytes!interface FastEthernet0/0 ip address dhcp no ip route-cache duplex auto speed autoend