计算机网络 实验 DHCP

在这里插入图片描述

实验目标:
       配置思科设备作为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
  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

所恋皆洛尘

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值