把路由器配置成DHCP服務器,並確保路由功能。

DHCP(Dynamic Host Configuration Protocol,動態的主機配置協議)


實驗名稱:把路由器配置成DHCP服務器,並確保路由功能。


實驗需求: 1.爲終端設備,自動分配IP地址

            2.具備路由功能


實驗須知:本實驗需要 pc機 2臺 ,2811型號的路由器 2臺

   圖示c8e10f4950994985fb775ad94f56c610.png-wh_



實驗配置


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

                     

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章