發布時間: 2017-10-13 18:10:38
在大型企業網絡中,會有大量的主機或設備需要獲取IP地址等網絡參數。如果采用手工配置,工作量大且不好管理,如果有用戶擅自修改網絡參數,還有可能會造成IP地址沖突等問題。使用動態主機配置協議DHCP(DynamicHost
Configuration Protocol)來分配IP地址等網絡參數,可以減少管理員的工作量,避免用戶手工配置網絡參數時造成的地址沖突。
在華為的DHCP的方式有分為三種,全局地址池,接口地址池,中繼模式。
以下是DHCP全局地址池下發方式:
[router]dhcp enable
[router]ip pool globalpool //創建一個地址池名為globalpool的地址池
Info: It's successful to create an IP address pool.
[router-ip-pool-router]network 10.1.1.0 mask 24 //下發的網絡號跟掩碼
[router-ip-pool-router]gateway-list 10.1.1.1 //網關
[router-ip-pool-router]dns-list 8.8.8.8 //配置DNS
[router-ip-pool-router]excluded-ip-address 10.1.1.100 10.1.1.254 //不下發的地址
[router-ip-pool-router]quit
[router]int g0/0/0
[router-GigabitEthernet0/0/0]dhcp select global //使用全局地址池
接口地址池的配置方法:
[router]dhcp enable
[router]int g0/0/0
[router-GigabitEthernet0/0/0]ip add 10.1.1.1 24
[router-GigabitEthernet0/0/0]dhcp select interface //以接口地址作為網關,發放接口的網段的地址。
[router-GigabitEthernet0/0/0]dhcp server excluded-ip-address 10.1.1.100 10.1.1.254 //不發放10.1.1.100~10.1.1.254的地址
[router-GigabitEthernet0/0/0]dhcp server dns-list 10.1.1.1 //配置DNS服務器為10.1.1.1
DHCP中繼:
[r2]dhcp enable
[r2]ip pool pool1
Info: It's successful to create an IP address pool.
[r2-ip-pool-pool1]network 10.1.1.0 mask 24
[r2-ip-pool-pool1]gateway-list 10.1.1.1
[r2-ip-pool-pool1]dns-list 8.8.8.8
[r2-ip-pool-pool1]excluded-ip-address 10.1.1.100 10.1.1.254
[r2]ip pool pool2
Info: It's successful to create an IP address pool.
[r2-ip-pool-pool2]network 172.16.10.0 mask 24
[r2-ip-pool-pool2]gateway-list 172.16.10.1
[r2-ip-pool-pool2]dns-list 114.114.114.114
[r2-ip-pool-pool2]excluded-ip-address 172.16.10.3 172.16.10.254
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 192.168.1.1 24
[r2-GigabitEthernet0/0/0]dhcp select global
[r2]ospf
[r2-ospf-1]a 0
[r2-ospf-1-area-0.0.0.0]net 192.168.1.0 0.0.0.255
中繼配置:
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 192.168.1.2 24
[Huawei-GigabitEthernet0/0/1]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 10.1.1.1 24
[Huawei-GigabitEthernet0/0/1]dhcp select relay //使用中繼模式
[Huawei-GigabitEthernet0/0/1]dhcp relay server-ip 192.168.1.1 //指向DHCP服務器
[Huawei-GigabitEthernet0/0/1]int g0/0/2
[Huawei-GigabitEthernet0/0/2]ip add 172.16.10.1 24
[Huawei-GigabitEthernet0/0/2]dhcp select relay
[Huawei-GigabitEthernet0/0/2]dhcp relay server-ip 192.168.1.1
[Huawei-ospf-1]a 0
[Huawei-ospf-1-area-0.0.0.0]net 10.1.1.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]net 192.168.1.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]net 172.16.10.0 0.0.0.255
做DHCP中繼需要保證網絡可達,網關以自己的源代替主機像DHCP服務器請求地址,所以此處使用OSPF使其網絡可達。
上一篇: {思科CCNA-RS}STP生成樹