HUAWEI-dhcp-dhcprelay
Huawei-dhcp-dhcprelay
华为设备的DHCP 有些许不同
1 配置方式有两种,一种是全局global ,一种是接口下
2 地址池的下放是由后向前的。
基本上就这两点,
咱们来一一看一下
最普通的网络拓扑下(单纯的局域网)
1)接口下
[r1]dhcp enable //首先要全局开户DHCP 功能 [r1-GigabitEthernet0/0/0]ip add 192.168.1.1 255.255.255.0 [r1-GigabitEthernet0/0/0]dhcp select interface //配置触发模式为interface接口,什么意思呢,就是当这个接口收到有DHCP 请求时,调用interface下的地址池,注意,这个地址池不用我们去手动的创建,他会以这个接口的IP 网段为地址池,另外会以这个接口的IP 为网关. [r1-GigabitEthernet0/0/0]dhcp server dhs-list 8.8.8.8 [r1-GigabitEthernet0/0/0]dhcp server excluded-ip-address 192.168.1.250 192.168.1.254 配置保留地址,由于HUAWEI的DHCP是由后向前下发的,所以在配置的时候一定要留意
下面的PC收到的地址就是从192.168.1.249开始的,
2)全局下配置DHCP
[r1]dhcp enabl //全局开启DHCP [r1]ip pool 1 //创建地址池 [r1-ip-pool-1]network 192.168.1.0 mask 24 //网段及掩码 [r1-ip-pool-1]gateway-list 192.168.1.1 //网关地址 [r1-ip-pool-1]dns-list 8.8.8.8 //DNS地址 [r1-ip-pool-1]excluded-ip-address 192.168.1.100 192.168.1.254 //保留地址 [r1-ip-pool-1]inter g0/0/0 [r1-GigabitEthernet0/0/0]dhcp select global //当接口收到DHCP请求时,调用全局地址池
//注如果现在有多个VLAN的时候呢?别切,那个咱们一会儿说。、
多VLAN下的DHCP
(单臂路由及三层交换机,其实意思都差不多,只不过接口模式不一样)
我只做配置就不做演示了,主要看一下命令即可。
当然这里的子接口也可以配置DHCP
[R1]inter g0/0/0.10 [R1-GigabitEthernet0/0/0.10]dot1q termination vi 10 [R1-GigabitEthernet0/0/0.10]arp broadcast enable [R1-GigabitEthernet0/0/0.10]ip add 192.168.1.1 255.255.255.0 [R1-GigabitEthernet0/0/0.10]q [R1]inter g0/0/0.20 [R1-GigabitEthernet0/0/0.20]dot1q termination vid 20 [R1-GigabitEthernet0/0/0.20]arp broadcast enable [R1-GigabitEthernet0/0/0.20]ip add 192.168.2.1 255.255.255.0 [R1-GigabitEthernet0/0/0.20]q [R1]ip pool 1 [R1-ip-pool-1]network 192.168.1.0 mask 255.255.255.0 [R1-ip-pool-1]gateway-list 192.168.1.1 [R1-ip-pool-1]q [R1]ip pool 2 [R1-ip-pool-2]network 192.168.2.0 mask 24 [R1-ip-pool-2]gateway-list 192.168.2.1 [R1-ip-pool-2]q [R1]dhcp enable Info: The operation may take a few seconds. Please wait for a Moment.done. [R1]inter g0/0/0.10 //进入子接口, [R1-GigabitEthernet0/0/0.10]dhcp select global //触发调用全局DHCP [R1]inter g0/0/0.20 [R1-GigabitEthernet0/0/0.20]dhcp select global [R1-GigabitEthernet0/0/0.20]q
三层交换机配置DHCP 为vlan下发IP地址
其实配置原理都一样,
只不过就是把接口换成了vlan id就OK了
Dhcp enable
ip pool 1 gateway-list 192.168.1.1 network 192.168.1.0 mask 255.255.255.0 # ip pool 2 gateway-list 192.168.2.1 network 192.168.2.0 mask 255.255.255.0 interface Vlanif10 ip address 192.168.1.1 255.255.255.0 dhcp select global # interface Vlanif20 ip address 192.168.2.1 255.255.255.0 dhcp select global
Dhcp relay 中继
由AR1下发IP地址
这里面有几点注意
1 三层交换机上的SVI要配置好IP地址,它是做为VLAN的网关的
2 三层交换机上联口要配置IP,
3 svi的网段要有能够到达GW的路由,双向可以通才OK
配置如下
路由 [gw]inter g0/0/0 [gw-GigabitEthernet0/0/0]ip add 12.0.0.1 255.255.255.0 [gw]ip pool 1 [gw-ip-pool-1]network 192.168.1.0 mask 24 [gw-ip-pool-1]gateway-list 192.168.1.1 [gw-ip-pool-1]q [gw]ip pool 2 [gw-ip-pool-2]network 192.168.2.0 mask 24 [gw-ip-pool-2]gateway-list 192.168.2.1 [gw-ip-pool-2]q
[gw]dhcp enable
[gw]inter g0/0/0
[gw-GigabitEthernet0/0/0]dhcp select global
[gw]ip route-static 192.168.0.0 16 12.0.0.2
三层交换 interface Vlanif10 ip address 192.168.1.1 255.255.255.0 # interface Vlanif20 ip address 192.168.2.1 255.255.255.0 interface GigabitEthernet0/0/2 port link-type trunk port trunk allow-pass vlan 2 to 4094 [Huawei]vlan 100 [Huawei]inter g0/0/1 [Huawei-GigabitEthernet0/0/1]port link acc [Huawei-GigabitEthernet0/0/1]por de vlan 100 [Huawei-GigabitEthernet0/0/1]inter vlan 100 [Huawei-GigabitEthernet0/0/1]ip add 12.0.0.2 255.255.255.0
三层交换机上有直连网段,就不用写了
下面是最主要的relay阶段
[Huawei]dhcp enable //开启DHCP [Huawei]inter vlan 10 //进入VLAN 10 [Huawei-Vlanif20]dhcp select relay //解发为中继 [Huawei-Vlanif10]dhcp relay server-ip 12.0.0.1 //中继的服务器为12.0.0.1 [Huawei]inter vlan 20 [Huawei-Vlanif20]dhcp select relay [Huawei-Vlanif20]dhcp relay server-ip 12.0.0.1
完成
------------------------------------
CCIE成长之路 --- 梅利
从无到有,自有至精