0
点赞
收藏
分享

微信扫一扫

华为配置案例8:DHCP

一点读书 2023-06-26 阅读 71

(1)DHCP接口地址池配置

华为配置案例8:DHCP_DHCP


dhcp enable

interface GigabitEthernet0/0/0

ip address 192.168.1.1 255.255.255.0

dhcp select interface

dhcp server excluded-ip-address 192.168.1.2 192.168.1.10

dhcp server lease day 5 hour 0 minute 0

dhcp server dns-list 4.4.4.4

华为配置案例8:DHCP_DHCP_02


PC1可以获得ip地址及DNS地址

PC>ipconfig

Link local IPv6 address...........: fe80::5689:98ff:fe95:958

IPv6 address......................: :: / 128

IPv6 gateway......................: ::

IPv4 address......................: 192.168.1.254

Subnet mask.......................: 255.255.255.0

Gateway...........................: 192.168.1.1

Physical address..................: 54-89-98-95-09-58

DNS server........................: 4.4.4.4


[DHCP]dis ip pool

-----------------------------------------------------------------

Pool-name : GigabitEthernet0/0/0

Pool-No : 0

Position : Interface Status : Unlocked

Gateway-0 : 192.168.1.1

Mask : 255.255.255.0

VPN instance : --



IP address Statistic

Total :253

Used :1 Idle :243

Expired :0 Conflict :0 Disable :9

(2)DHCP全局地址池配置

华为配置案例8:DHCP_DHCP_03


[DHCP]dhcp enable

Info: The operation may take a few seconds. Please wait for a moment.done.

[DHCP]ip pool R1

Info: It's successful to create an IP address pool.

[DHCP-ip-pool-R1]network 192.168.2.0 mask 24

[DHCP-ip-pool-R1]gateway-list 192.168.2.1

[DHCP-ip-pool-R1]dns-list 8.8.8.8

[DHCP-ip-pool-R1]excluded-ip-address 192.168.2.2 192.168.2.10

[DHCP-ip-pool-R1]lease day 10

[DHCP-ip-pool-R1]q

[DHCP]int g0/0/0

[DHCP-GigabitEthernet0/0/0]ip add 192.168.2.1 24

[DHCP-GigabitEthernet0/0/0]dhcp select global

华为配置案例8:DHCP_DHCP_04


PC>ipconfig


Link local IPv6 address...........: fe80::5689:98ff:fe95:958

IPv6 address......................: :: / 128

IPv6 gateway......................: ::

IPv4 address......................: 192.168.2.254

Subnet mask.......................: 255.255.255.0

Gateway...........................: 192.168.2.1

Physical address..................: 54-89-98-95-09-58

DNS server........................: 8.8.8.8


[DHCP]dis ip pool

-----------------------------------------------------------------

Pool-name : R1

Pool-No : 0

Position : Local Status : Unlocked

Gateway-0 : 192.168.2.1

Mask : 255.255.255.0

VPN instance : --



IP address Statistic

Total :253

Used :1 Idle :243

Expired :0 Conflict :0 Disable :9


(3)DHCP中继代理配置

华为配置案例8:DHCP_DHCP_05


vlan及端口配置

[SW1]vlan batch 2 3

[SW1-vlan3]int g0/0/2

[SW1-GigabitEthernet0/0/2]port link-type access

[SW1-GigabitEthernet0/0/2]port default vlan 2

[SW1-GigabitEthernet0/0/2]int g0/0/3

[SW1-GigabitEthernet0/0/3]port link-type access

[SW1-GigabitEthernet0/0/3]port default vlan 3

[SW1-GigabitEthernet0/0/3]q

[SW1]int Vlanif 1

[SW1-Vlanif1]ip add 12.1.1.1 24

[SW1-Vlanif1]int Vlanif 2

[SW1-Vlanif2]ip add 192.168.2.1 24

[SW1-Vlanif2]int Vlanif 3

[SW1-Vlanif3]ip add 192.168.3.1 24


[AR2]int g0/0/0

[AR2-GigabitEthernet0/0/0]ip add 12.1.1.2 24


路由配置(如没有路由,不同网段间无法通信

[SW1]ospf

[SW1-ospf-1]area 0

[SW1-ospf-1-area-0.0.0.0]net 12.1.1.0 0.0.0.255

[SW1-ospf-1-area-0.0.0.0]net 192.168.2.0 0.0.0.255

[SW1-ospf-1-area-0.0.0.0]net 192.168.3.0 0.0.0.255


[AR2]ospf

[AR2-ospf-1]area 0

[AR2-ospf-1-area-0.0.0.0]net 12.1.1.0 0.0.0.255


全局地址池配置

[AR2]dhcp enable

[AR2]ip pool vlan2

Info: It's successful to create an IP address pool.

[AR2-ip-pool-vlan2]network 192.168.2.0 mask 24

[AR2-ip-pool-vlan2]gateway-list 192.168.2.1

[AR2-ip-pool-vlan2]dns-list 4.4.4.4

[AR2-ip-pool-vlan2]lease day 5

[AR2-ip-pool-vlan2]q

[AR2]ip pool vlan3

Info: It's successful to create an IP address pool.

[AR2-ip-pool-vlan3]network 192.168.3.0 mask 24

[AR2-ip-pool-vlan3]gateway-list 192.168.3.1

[AR2-ip-pool-vlan3]dns-list 8.8.8.8

[AR2-ip-pool-vlan3]lease day 10

[AR2-ip-pool-vlan3]q


[AR2]int g0/0/0

[AR2-GigabitEthernet0/0/0]dhcp select global


DHCP中继代理配置

[SW1]dhcp enable

Info: The operation may take a few seconds. Please wait for a moment.done.

[SW1]int Vlanif 2

[SW1-Vlanif2]dhcp select relay

[SW1-Vlanif2]dhcp relay server-ip 12.1.1.2

[SW1-Vlanif2]int vlanif 3

[SW1-Vlanif3]dhcp select relay

[SW1-Vlanif3]dhcp relay server-ip 12.1.1.2


PC1:

PC>ipconfig


Link local IPv6 address...........: fe80::5689:98ff:fe01:6cba

IPv6 address......................: :: / 128

IPv6 gateway......................: ::

IPv4 address......................: 192.168.2.254

Subnet mask.......................: 255.255.255.0

Gateway...........................: 192.168.2.1

Physical address..................: 54-89-98-01-6C-BA

DNS server........................: 4.4.4.4


PC2:

PC>ipconfig


Link local IPv6 address...........: fe80::5689:98ff:fe45:32ba

IPv6 address......................: :: / 128

IPv6 gateway......................: ::

IPv4 address......................: 192.168.3.254

Subnet mask.......................: 255.255.255.0

Gateway...........................: 192.168.3.1

Physical address..................: 54-89-98-45-32-BA

DNS server........................: 8.8.8.8


PC1能ping通PC2

PC>ping 192.168.3.254


Ping 192.168.3.254: 32 data bytes, Press Ctrl_C to break

Request timeout!

From 192.168.3.254: bytes=32 seq=2 ttl=127 time=47 ms

From 192.168.3.254: bytes=32 seq=3 ttl=127 time=31 ms

From 192.168.3.254: bytes=32 seq=4 ttl=127 time=16 ms

From 192.168.3.254: bytes=32 seq=5 ttl=127 time=46 ms


--- 192.168.3.254 ping statistics ---

5 packet(s) transmitted

4 packet(s) received

20.00% packet loss

round-trip min/avg/max = 0/35/47 ms


举报

相关推荐

0 条评论