Huawei --DHCP relay test (two ways dhcp provided, not assigned an address range dhcp manner, the fixed address assignment)

Foreword

  • Usually in the case of DHCP to assign too much network segment, gateway router configuration of the DHCP service, too much pressure,
    usually we use the second router, or the second DHCP server to share business

A: experimental environment

1.1: Fundamentals

  • The first step: the client sends a DHCP Discover packets to find the server by broadcasting

  • Step two: The server sends DHCP Offer packet provides IP address and other network information to clients through unicast

  • The third step: the client by broadcasting DHCP Request packet to inform the local server to select which IP address

  • Step Four: The server IP address by DHCP Ack packet to inform the client is legally available

1.2: Principles summary

  • In the actual production environment, the second, four steps are basically Unicast
  • In the Microsoft system, the basic principles are broadcast in four steps

1.3: Experimental Software

  • Ensp
  • A switch
  • Three routers
  • Five hosts

1.4: Purpose

  • Automatically assign IP addresses by DHCP router
  • To achieve interoperability between hosts of different vlan

1.5: Experiment topology DHCP Huawei

mark

II: experiment

2.1: Setting Switch

<Huawei>system-view 
[Huawei]sysname SW1
[SW1]vlan bat 10 20		'//连续添加vlan'
[SW1]interface Ethernet 0/0/1	'//进入接口'
[SW1-Ethernet0/0/1]port link-type access 	'//设置接口模式'
[SW1-Ethernet0/0/1]port default vlan 10		'//划分vlan'
[SW1-Ethernet0/0/1]undo shutdown
[SW1-Ethernet0/0/1]interface Ethernet 0/0/2
[SW1-Ethernet0/0/2]port link-type access 
[SW1-Ethernet0/0/2]port default vlan 20
[SW1-Ethernet0/0/2]undo shutdown
[SW1-Ethernet0/0/2]interface Ethernet 0/0/3
[SW1-Ethernet0/0/3]port link-type access 
[SW1-Ethernet0/0/3]port default vlan 10
[SW1-Ethernet0/0/3]undo shutdown
[SW1-Ethernet0/0/3]interface Ethernet 0/0/4
[SW1-Ethernet0/0/4]port link-type access 
[SW1-Ethernet0/0/4]port default vlan 20
[SW1-Ethernet0/0/4]undo shutdown
[SW1-Ethernet0/0/4]quit
[SW1]interface GigabitEthernet 0/0/1	'//进入接口'
[SW1-GigabitEthernet0/0/1]port link-type trunk 		'//设置接口模式'
[SW1-GigabitEthernet0/0/1]port trunk allow-pass  vlan all 	'//设置允许通过的vlan'
[SW1-GigabitEthernet0/0/1]undo shutdown 

2.2: router (R1) is provided

<Huawei>system-view 
[Huawei]sysname R1
[R1]dhcp enable 
[R1]interface GigabitEthernet 0/0/1.1	'//进入接口'
[R1-GigabitEthernet0/0/1.1]dot1q termination vid 10		'//选择封装类型并设置vlan归属'
[R1-GigabitEthernet0/0/1.1]ip address 192.168.10.1 24
[R1-GigabitEthernet0/0/1.1]arp broadcast enable 	'//开启arp广播'
[R1-GigabitEthernet0/0/1.1]dhcp select relay 	'//选择转发设置DHCP'
[R1-GigabitEthernet0/0/1.1]dhcp relay server-ip 13.0.0.2  '//选择DHCP路由器地址'
[R1-GigabitEthernet0/0/1.1]undo shutdown 
[R1-GigabitEthernet0/0/1.1]interface GigabitEthernet 0/0/1.2
[R1-GigabitEthernet0/0/1.2]dot1q termination vid 20
[R1-GigabitEthernet0/0/1.2]ip address 192.168.20.1 24
[R1-GigabitEthernet0/0/1.2]arp broadcast enable 
[R1-GigabitEthernet0/0/1.2]dhcp select relay	'//选择转发设置DHCP'
[R1-GigabitEthernet0/0/1.2]dhcp relay server-ip 13.0.0.2  '//选择DHCP路由器地址'
[R1-GigabitEthernet0/0/1.2]undo shutdown 
[R1-GigabitEthernet0/0/1.2]q
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip add 12.0.0.1 24
[R1-GigabitEthernet0/0/0]undo shutdown 
[R1-GigabitEthernet0/0/0]quit
[R1]interface GigabitEthernet 0/0/2
[R1-GigabitEthernet0/0/2]ip add 13.0.0.1 24
[R1-GigabitEthernet0/0/2]undo shutdown 
[R1-GigabitEthernet0/0/2]quit
[R1]ip route-static 15.0.0.0 24 12.0.0.2	'//添加静态路由'

2.3: router (R2) provided

<Huawei>system-view 
[Huawei]sysname R2
[R2]dhcp enable 
[R2]interface GigabitEthernet0/0/0	
[R2-GigabitEthernet0/0/0]ip add 12.0.0.2 24
[R2-GigabitEthernet0/0/0]undo shutdown 
[R2-GigabitEthernet0/0/0]interface GigabitEthernet0/0/1
[R2-GigabitEthernet0/0/1]ip add 15.0.0.1 24
[R2-GigabitEthernet0/0/1]undo shutdown 
[R2-GigabitEthernet0/0/1]quit
[R2]ip route-static 192.168.10.0 24 12.0.0.1	'//添加静态路由'
[R2]ip route-static 192.168.20.0 24 12.0.0.1
[R2]ip route-static 13.0.0.0 12.0.0.1
[R2]ip pool v11		'//进入ip地址池'
[R2-ip-pool-v11]gateway-list 15.0.0.1	'//设置网关'
[R2-ip-pool-v11]network 15.0.0.0 mask 24	'//设置网段和子网掩码'
[R2-ip-pool-v11]quit
[R2]interface GigabitEthernet0/0/1
[R2-GigabitEthernet0/0/1] dhcp select reply	'//选择转发设置DHCP'
[R2-GigabitEthernet0/0/1] dhcp relay server-ip 13.0.0.2  '//选择DHCP路由器地址'

2.4: router (R3) provided

<Huawei>system-view 
[Huawei]sysname R3
[R3]dhcp enable 
[R3]interface GigabitEthernet0/0/2	
[R3-GigabitEthernet0/0/2]ip address 13.0.0.2 24
[R3-GigabitEthernet0/0/2]undo shutdown
[R3-GigabitEthernet0/0/2]quit
[R3]ip pool v15
[R3-ip-pool-v15]gateway-list 15.0.0.1 
[R3-ip-pool-v15]network 15.0.0.0 mask 24
[R3]ip pool v10
[R3-ip-pool-v10]gateway-list 192.168.10.1
[R3-ip-pool-v10]network 192.168.10.0 mask 24
[R3]ip pool v20
[R3-ip-pool-v20]gateway-list 192.168.20.1 
[R3-ip-pool-v15]network 192.168.20.0 mask 24
[R3]interface GigabitEthernet0/0/2	
[R3-GigabitEthernet0/0/2]dhcp select global

2.5: host settings

mark

III: experimental verification and summary

3.1: successful experiment

mark

3.2: Experimental summary

  • Production environment, recommend the use of static routing
  • There are two ways to configure DHCP
3.2.1: The first way: Interface Mode
  • DHCP can not set the address range assigned
接口模式
步骤1:
[R1]dhcp enable       '//###全局配置模式开启DHCP功能'

步骤2:
[R1]interface GigabitEthernet0/0/0.10                 '//###进入子接口'
[R1-GigabitEthernet0/0/0.10] dhcp select interface          '//###基于基于接口配置DHCP'
[R1-GigabitEthernet0/0/0.10] dhcp server excluded-ip-address 192.168.10.200 192.168.10.210    '//##192.168.10.200到192.168.10.210不分配地址'
[R1-GigabitEthernet0/0/0.10] dhcp server static-bind ip-address 192.168.20.9 mac-address 28d2-4469-5a55  
'//#### 绑定 IP  192.168.20.9 固定分配给MAC 为28d2-4469-5a55的机器,需池中IP'
[R1-GigabitEthernet0/0/0.10]dhcp server dns-list 8.8.8.8   '//###配置DNS'
3.2.1: The second way: Global Mode.
  • Can assign a fixed address (IP address + MAC address) to the machine (IP address needs to address pool)
全局配置模式
步骤1:
[R1]dhcp enable       '//###全局配置模式开启DHCP功能'

步骤2:
[R1] ip pool v20
[R1-ip-pool-v20]  gateway-list 192.168.20.1
[R1-ip-pool-v20]  network 192.168.20.0 mask 255.255.255.0
[R1-ip-pool-v20]  dns-list 114.114.114.114
[R1-ip-pool-v20]  excluded-ip-address 192.168.10.200 192.168.10.210    '//##192.168.10.200到192.168.10.210不分配地址'
[R1-ip-pool-v20]  static-bind ip-address 192.168.20.9 mac-address 28d2-4469-5a55  
'//#### 绑定 IP  192.168.20.9 固定分配给MAC 为28d2-4469-5a55的机器,需池中IP'
[R1-ip-pool-v20]  lease day 10    '//####租期10天 '

步骤3:
[R1]int g0/0/0.20
[R1-GigabitEthernet0/0/0.20]  dhcp select global	'//选择全局模式分配DHCP'
Published 94 original articles · won praise 60 · views 10000 +

Guess you like

Origin blog.csdn.net/CN_TangZheng/article/details/103490871