DHCP跨网段分配IP地址配置_第1张图片
需求:现有两台电脑需要AR5路由器来分配IP地址
实现:先为路由器的各个接口配好IP地址
给AR5路由器设置个IP route 并测试能否ping通1.254这个网关,测试OK
然后回到视图模式,给DHCP授权
建立网段池,并取个名字
给这池子加网段,子网掩码,网关,DNS
然后回到接口把DHCP设置为全局模式
再回到AR4授权并把0接口设置为中继线路模式
指明DHCP服务器IP地址
然后把PC设置为DHCP就OK了
AR4路由器
system-view
[Huawei]interface GigabitEthernet 0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 192.168.1.254
[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 192.168.2.1 24
[Huawei]dhcp enable
[Huawei-GigabitEthernet0/0/0]dhcp select relay
[Huawei-GigabitEthernet0/0/0]dhcp relay server-ip 192.168.2.2
AR5路由器
system-view
[Huawei]interface GigabitEthernet 0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 192.168.2.2 24
[Huawei-GigabitEthernet0/0/0]dhcp select global
[Huawei]ip route-static 192.168.1.0 24 192.168.2.1
[Huawei]dhcp enable
[Huawei]ip pool a
[Huawei-ip-pool-a]network 192.168.1.0 mask 24
[Huawei-ip-pool-a]gateway-list 192.168.1.254
[Huawei-ip-pool-a]dns-list 8.8.8.8
[Huawei-GigabitEthernet0/0/0]dhcp select global