计算机网络 实验 DHCP

计算机网络 实验 DHCP_第1张图片

实验目标:
       配置思科设备作为DHCP服务器

实验步骤:
       1.配置OSPF路由协议
       2.配置R1为DHCP服务器
       3.配置DHCP中继,使得PC3可以获得地址
       4.全网通信测试

1.把R1配置为DHCP服务器

Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#host R1
R1(config)#ip dhcp pool ccna
R1(dhcp-config)#network 192.168.1.0 255.255.255.0
R1(dhcp-config)#default-router 192.168.1.254  //网关
R1(dhcp-config)#dns-server 61.177.7.1 //dns
R1(dhcp-config)#exit

//排查某些地址
R1(config)#ip dhcp excluded-address 192.168.1.1 192.168.1.9
R1(config)#ip dhcp excluded-address 192.168.1.251 192.168.1.254
R1(config)#end



//查看每台pc分配的ip
R1#show ip dhcp binding 
IP address       Client-ID/              Lease expiration        Type
                 Hardware address
192.168.1.10     0001.9650.3887           --                     Automatic
192.168.1.11     00E0.8FB6.8913           --                     Automatic
192.168.1.12     0030.F27D.3274           --                     Automatic
R1#



配置中继
R2>en
R2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#interface fa0/1
R2(config-if)#ip helper-address 192.168.12.1


配置OSPF路由协议
R1#show ip inter brief 
Interface              IP-Address      OK? Method Status                Protocol
 
FastEthernet0/0        192.168.12.1    YES manual up                    up
 
FastEthernet0/1        192.168.1.254   YES manual up                    up
 
Vlan1                  unassigned      YES unset  administratively down down
R1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#router ospf 1
R1(config-router)#network 192.168.12.0 0.0.0.255 area 0
R1(config-router)#network 192.168.1.0 0.0.0.255 area 0
R1(config-router)#end
R1#

R2#show ip inter brief 
Interface              IP-Address      OK? Method Status                Protocol
 
FastEthernet0/0        192.168.12.2    YES manual up                    up
 
FastEthernet0/1        192.168.2.254   YES manual up                    up
 
Vlan1                  unassigned      YES unset  administratively down down
R2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#router ospf 1
R2(config-router)#network 192.168.12.0 0.0.0.255 area 0
R2(config-router)#network 192.168.2.0 0.0.0.255 area 0
R2(config-router)#end


配置另一个网段的DHCP
R1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#ip dhcp pool ccnp
R1(dhcp-config)#network 192.168.2.0 255.255.255.0
R1(dhcp-config)#default-router 192.168.2.254
R1(dhcp-config)#dns-server 61.177.7.1
R1(dhcp-config)#exit

排除已经在使用的地址
R1(config)#ip dhcp excluded-address 192.168.2.1 192.168.2.9
R1(config)#ip dhcp excluded-address 192.168.2.251 192.168.2.254
R1(config)#end

你可能感兴趣的:(计算机网络,计算机网络,服务器,网络)