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服務器,同時實現路由功能。