DHCP(Dynamic Host Configuration Protocol,动态的主机配置协议)服务器
实验名称:把路由器配置成DHCP服务器,并确保路由功能。ide
实验需求: 1.为终端设备,自动分配IP地址测试
2.具有路由功能
spa
实验须知:本实验须要 pc机 2台 ,2811型号的路由器 2台3d
实验配置:router
⑴ 给路由器router1配置IP地址blog
① 命令实现:ip
Router>路由
enable
Router#
config terminal
Router(config)#
hostname R1
R1(config)#
interface fas 0/1
R1(config-if)#
no shutdown
R1(config-if)#
ip address 192.168.1.100 255.255.255.0
R1(config-if)#
exit
② 开启DHCP服务:
R1(config)#
service dhcp
③ 配置DHCP地址池
R1(config)#
ip dhcp pool dizhichi1
R1(dhcp-config)#
network 192.168.1.0 255.255.255.0
R1(dhcp-config)#
default-router 192.168.1.100
R1(dhcp-config)#
end
④ 用交叉线链接路由器的fas0/1 和电脑pc0的fas0/0口
⑤ 点击电脑IP的dhcp 自动获取 IP地址 默认分配192.168.1.1 255.255.255.0
⑥ 验证与测试 show ip dhcp binding ﹤查看已经分配出去的IP地址﹥
⑵ 给路由器router2配置IP地址
① 命令实现:
Router>
enable
Router#
config terminal
Router(config)#
hostname R2
R2(config)#
interface fas 0/1
R2(config-if)#
no shutdown
R2(config-if)#
ip address 192.168.2.100 255.255.255.0
R2(config-if)#
exit
② 开启DHCP服务:
R2(config)#
service dhcp
③ 配置DHCP地址池
R2(config)#
ip dhcp pool dizhichi2
R1(dhcp-config)#
network 192.168.2.0 255.255.255.0
R1(dhcp-config)#
default-router 192.168.2.100
R1(dhcp-config)#
end
④ 用交叉线链接路由器R2的fas0/1 和电脑PC2的fas0/0口
⑤ 点击电脑PC2 的dhcp 自动获取 IP地址 默认分配192.168.2.1 255.255.255.0
⑥ 验证与测试 show ip dhcp binding ﹤查看已经分配出去的IP地址﹥
⑶ 用交叉线分别链接两个路由器的fas0/0口
⑷ 在路由器R1中配置fas0/0的IP地址
R1(config)#
inter fas0/0
R1(config-if)#
no shutdown
R1(config-if)#
ip address 10.10.12.1 255.255.255.0
⑸ 在路由器R1中配置fas0/0的IP地址
R1(config)#
inter fas0/0
R1(config-if)#
no shutdown
R1(config-if)#
ip address 10.10.12.1 255.255.255.0
⑹ 给路由器R1配置静态路由条目
R1(config)#
ip route 192.168.2.0 255.255.255.0 10.10.12.2
⑺ 给路由器R2配置静态路由条目
R2(config)#
ip route 192.168.1.0 255.255.255.0 10.10.12.1
验证与测试
show ip route ﹤查看路由表﹥
pc0 > ping 192.168.2.1 ﹤pc0 给 pc2发送请求﹥
实验总结:路由器可配置成 dhcp服务器,同时实现路由功能。