DHCP中继服务原理及实验

DHCP中继服务原理及实验_第1张图片

目录

1.DHCP的原理

2.DHCP作用

3.DHCP 的租约过程的四个步骤

4,实验步骤

  1.设置交换机 -创建vlan,配置acess口,配置trunk口

  2.配置路由器AR1-接口配置地址,静态路由,DHCP中继分配

  3.设置路由器AR3-接口配置地址,DHCP中继分配

  4.配置AR2-配置DHCP,接口配置地址,默认路由

  5.测试 - 五台PC依次测试

实验成功


1.DHCP的原理

         集中的管理、分配IP地址,使client动态的获得IP地址、Gateway地址、DNS服务器地址等信息,并能够提升地址的使用率。简单来说,DHCP就是一个不需要账号密码登录的、自动给内网机器分配IP地址等信息的协议。

2.DHCP作用

        使用 DHCP 可以减少管理员的工作量,避免 IP 地址冲突,当网络更改 IP 地址网段时不
需要再重新配置每个用户的 IP 地址,提高了 IP 地址的利用率,方便客户端的配置。

3.DHCP 的租约过程的四个步骤

(1)客户机请求IP(客户机发DHCP Discover广播包)

(2)服务器响应(服务器发DHCP Offer⼴播包)

(3)客户机选择IP(客户机发DHCP Request⼴播包)

(4)服务器确定租约(服务器发DHCP ACK广播包)

4,实验步骤

    1.设置交换机 -创建vlan,配置acess口,配置trunk口

system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sys    
[Huawei]sysname SW1 
[SW1]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW1]int e0/0/1
[SW1-Ethernet0/0/1]port link-type acess
[SW1-Ethernet0/0/1]port default vlan 10
[SW1-Ethernet0/0/1]undo shutdown
Info: Interface Ethernet0/0/1 is not shutdown.
[SW1-Ethernet0/0/1]int e0/0/2
[SW1-Ethernet0/0/2]port link-type acess
[SW1-Ethernet0/0/2]port default vlan 20
[SW1-Ethernet0/0/2]undo shutdown
Info: Interface Ethernet0/0/2 is not shutdown.
[SW1-Ethernet0/0/2]int e0/0/3
[SW1-Ethernet0/0/3]port link-type acess
[SW1-Ethernet0/0/3]port default vlan 10
[SW1-Ethernet0/0/3]undo shutdown
Info: Interface Ethernet0/0/3 is not shutdown.
[SW1-Ethernet0/0/3]int e0/0/4
[SW1-Ethernet0/0/4]port link-type acess
[SW1-Ethernet0/0/4]port default vlan 20
[SW1-Ethernet0/0/4]undo shutdown
Info: Interface Ethernet0/0/4 is not shutdown.
[SW1-Ethernet0/0/4]quit  
[SW1]int g0/0/1
[SW1-GigabitEthernet0/0/1]port link-type trunk 
[SW1-GigabitEthernet0/0/1]port trunk allow-pass vlan all 
[SW1-GigabitEthernet0/0/1]undo shutdown
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[SW1-GigabitEthernet0/0/1] User interface con0 is available

  2.配置路由器AR1-接口配置地址,静态路由,DHCP中继分配

sys    
system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
[R1]int g0/0/2
[R1-GigabitEthernet0/0/2]ip add 14.0.0.1 24
[R1-GigabitEthernet0/0/2]undo shutdown 
Info: Interface GigabitEthernet0/0/2 is not shutdown.
[R1-GigabitEthernet0/0/2]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 12.0.0.1 24
[R1-GigabitEthernet0/0/0]undo shutdown 
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R1-GigabitEthernet0/0/0]quit
[R1]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[R1]int g0/0/1.10
[R1-GigabitEthernet0/0/1.10]dot1q termination vid 10
[R1-GigabitEthernet0/0/1.10]ip add 192.168.10.1 24
[R1-GigabitEthernet0/0/1.10]arp broadcast enable 
[R1-GigabitEthernet0/0/1.10]un sh
Info: Interface GigabitEthernet0/0/1.10 is not shutdown.
[R1-GigabitEthernet0/0/1.10]dhcp select relay 
[R1-GigabitEthernet0/0/1.10]dhcp relay server-ip 14.0.0.2
[R1-GigabitEthernet0/0/1.10]un sh
Info: Interface GigabitEthernet0/0/1.10 is not shutdown.
[R1-GigabitEthernet0/0/1.10]int g0/0/1.20 
[R1-GigabitEthernet0/0/1.20]dot1q termination vid 20
[R1-GigabitEthernet0/0/1.20]ip add 192.168.20.1 24
[R1-GigabitEthernet0/0/1.20]arp broadcast enable 
[R1-GigabitEthernet0/0/1.20]un sh
Info: Interface GigabitEthernet0/0/1.20 is not shutdown.
[R1-GigabitEthernet0/0/1.20]dhcp select relay 
[R1-GigabitEthernet0/0/1.20]dhcp relay server-ip 14.0.0.2
[R1-GigabitEthernet0/0/1.20]un sh
Info: Interface GigabitEthernet0/0/1.20 is not shutdown.
[R1-GigabitEthernet0/0/1.20]q
[R1]ip route-static 15.0.0.0 24 12.0.0.2

  3.设置路由器AR3-接口配置地址,DHCP中继分配

system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname AR2
[AR2]int g0/0/0
[AR2-GigabitEthernet0/0/0]ip add 12.0.0.2 24
[AR2-GigabitEthernet0/0/0]un sh 
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[AR2-GigabitEthernet0/0/0]int g0/0/1
[AR2-GigabitEthernet0/0/1]ip add 15.0.0.1 24
[AR2-GigabitEthernet0/0/1]un sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[AR2-GigabitEthernet0/0/1]q
[AR2]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[AR2]int g0/0/1
[AR2-GigabitEthernet0/0/1]dhcp select relay 
[AR2-GigabitEthernet0/0/1]dhcp relay server-ip 14.0.0.2
[AR2-GigabitEthernet0/0/1]un sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[AR2-GigabitEthernet0/0/1

[AR2]ip route-static 0.0.0.0 0.0.0.0 12.0.0.1 

  4.配置AR2-配置DHCP,接口配置地址,默认路由

system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname AR3
[AR3]int g0/0/0 
[ AR3-GigabitEthernet0/0/0]ip add 14.0.0.2 24
[ AR3-GigabitEthernet0/0/0]un sh
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[ AR3-GigabitEthernet0/0/0]q  
[ AR3]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[ AR3]int g0/0/0
[ AR3-GigabitEthernet0/0/0]dhcp select  global 
[3-GigabitEthernet0/0/0]un sh
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[ AR3-GigabitEthernet0/0/0]q
[ AR3]ip pool DHCP15.0.0.0
Info: It's successful to create an IP address pool.
[ AR3-ip-pool-DHCP15.0.0.0]network 15.0.0.0 mask 24
[ AR3-ip-pool-DHCP15.0.0.0]gateway-list 15.00.0.1
[ AR3-ip-pool-DHCP15.0.0.0]dns-list 8.8.8.8 2.2.2.2 
[ AR3-ip-pool-DHCP15.0.0.0]ip pool DHCPvlan10
Info: It's successful to create an IP address pool.
[ AR3-ip-pool-DHCPvlan10]network 192.168.10.0 mask 24 
[ AR3-ip-pool-DHCPvlan10]gateway-list 192.168.10.1
[ AR3-ip-pool-DHCPvlan10]dns-list 8.8.8.8 2.2.2.2
[ AR3-ip-pool-DHCPvlan10]ip pool DHCPvlan20
Info: It's successful to create an IP address pool.
[ AR3-ip-pool-DHCPvlan20]network 192.168.20.0 mask 24  
[ AR3-ip-pool-DHCPvlan20]gateway-list 192.168.20.1
[ AR3-ip-pool-DHCPvlan20]dns-list 8.8.8.8 2.2.2.2
[ AR3-ip-pool-DHCPvlan20]q 
[ AR3]ip route-static 0.0.0.0 0.0.0.0 14.0.0.1

   5.测试 - 五台PC依次测试

DHCP中继服务原理及实验_第2张图片

DHCP中继服务原理及实验_第3张图片

实验成功

 

 

 

 

 

 

 

 

 


 

 


 

 

 

 

你可能感兴趣的:(DHCP中继服务原理及实验)