???? 路由器 DHCP和DHCP中繼的配置
???
?????
??????? 路由器作為DHCP服務器:
??????????? 1.配置router的地址:Route(config)# hostname gateway (更改主機名字)
??????????????????????????????? Gateway(config)# interface gigabitethernet 0/0
??????????????????????????????? Gateway(config-if)# ip address 192.168.1.254? 255.255.255.0
??????????????????????????????? Gateway(config-if)# no shutdown
??????????
??????????? 2.啟動DHCP服務 :
??????????????????????????? Gateway(config)# service dhcp
????????????????????????????
??????????? 3.配置DHCP地址池:
??????????????????????????? Gateway(config)# ip? dhcp pool CCNE (為DHCP取名為CCNE)
??????????????????????????? Gateway(dhcp-cofig)# network 192.168.1.1?? 255.255.255.0
??????????????????????????? Gateway(dhcp-config)# default-router 192.168.1.254
??????????????????????????? Gateway(dhcp-config)# dns-server? 8.8.8.8
??????????
??????????? 4.配置DHCP客戶端:點擊“DHCP”
???????????
????????????
??????????? 5.驗證命令:
????????????????????? Gateway# show? ip dhcp binding
??????????? or??????? Gateway# show? running-config
?
????????
??????????? 6.DHCP排除IP地址命令:
???????????????????????????????? Gateway(config)# ip? dhcp? excluded-address 192.168.1.1 192.168.1.20(排除1.1-1.20的ip地址)
???????? 路由器DHCP中繼服務器:(需要一臺服務器,完成不同網段互通。)
?????????????????????????? Router(config)# interface gigabitEthernet 0/2
?????????????????????????? Router(config-if)# description? WO? (給端口打標簽名字WO)
?????????????????????????? Router(config-if)# ip helper-address 192.168.1.250 (服務器的ip地址,
????????????????????????? 報文以廣播方式變為單播方式發送出去到DHCP服務器)
?????????????????????????? Router(config)# service dhcp??? 作為DHCP中繼,必須開啟DHCP。
????????? 注意:當DHCP服務器上具有多個DHCP地址池時,服務器是通過DHCP報文中的源ip地址來進行地址池區分的。
??????????????? 在DHCP中繼環境中,本質上是根據每個部門的“網關ip地址”來決定的。
??????????????? 在DHCP服務器上,配置三個網關的DHCP地址池, 同時在DHCP服務器配置“網關IP地址”,
??????????????? 確保DHCP服務器能回應其他部門網關的DHCP客戶端發送的DHCP報文。
轉載于:https://blog.51cto.com/13399294/1972438