华为DHCP全局、端口、中继配置
- 格式:docx
- 大小:71.72 KB
- 文档页数:6
华为交换机DHCP snooping配置教程DHCP Snooping是一种DHCP平安特性,在配置DHCP Snooping各平安功能之前需首先使能DHCP Snooping功能。
使能DHCP Snooping功能的顺序是先使能全局下的DHCP Snooping功能,再使能接口或VLAN下的DHCP Snooping功能。
图1配置DHCP Snooping根本功能组网图如上图1所示,Switch_1是二层接入设备,将用户PC的DHCP请求转发给DHCP 效劳器。
以Switch_1为例,在使能DHCP Snooping功能时需要注意:使能DHCP Snooping功能之前,必须已使用命令dhcp enable使能了设备的DHCP功能。
全局使能DHCP Snooping功能后,还需要在连接用户的接口〔如图中的接口if1、if2和if3〕或其所属VLAN〔如图中的VLAN 10〕使能DHCP Snooping功能。
当存在多个用户PC属于同一个VLAN时,为了简化配置,可以在这个VLAN 使能DHCP Snooping功能。
请在二层网络中的接入设备或第一个DHCP Relay上执行以下步骤。
1、使能DHCP Snooping功能[Huawei]dhcp snooping enable ?ipv4DHCPv4 Snoopingipv6DHCPv6 Snoopingvlan Virtual LAN<cr>或[Huawei]dhcp snooping over-vpls enable#使能设备在VPLS网络中的DHCP Snooping功能或[Huawei-vlan2]dhcp snooping enable[Huawei-GigabitEthernet0/0/3]dhcp snooping enable2、配置接口信任状态[Huawei-GigabitEthernet0/0/2]dhcp snooping trusted或[Huawei-vlan3]dhcp snooping trusted interface GigabitEthernet 0/0/63、去使能DHCP Snooping用户位置迁移功能在移动应用场景中,假设某一用户由接口A上线后,切换到接口B重新上线,用户将发送DHCP Discover报文申请IP地址。
拓扑说明:比较简单的三层环境,防火墙进来后接三层交换机s5700,然后接的几台二层交换机s2700,本文只对几个主要的应用配置做个描述1.vlan、gvrp相关配置举例:三层交换机:[5700]vlan 11 创建VLAN11[5700-vlan11]description xxx 加入描述信息xxx[5700-vlan11]quit[5700]gvrp 要用gvrp的话,全局模式下必须开启gvrp [5700]interface g0/0/23 进入与2层交换机连接的端口准备配置中继[5700-GigabitEthernet0/0/23]gvrp 中继端口下开启gvrp[5700-GigabitEthernet0/0/23]port link-type trunk 端口类型设置为trunk[5700-GigabitEthernet0/0/23]port trunk allow-pass vlan all 设置允许通过的vlan为所有,也可设为指定的vlan[5700-GigabitEthernet0/0/23]quit二层交换机:发现华为上不能批量进入端口,只有通过先创建端口组,再把响应端口加入组的方式来实现批量管理,比如我们要在2700上把千兆口都设为trunk口:[2700]port-group trunk 创建名为turnk的端口组,也可取其他名字。
如果已有此名,则会直接进入此端口组[2700-1-port-group-trunk]group-member g0/0/1 to g0/0/4 宣告组成员为G0/0/1到G0/0/4[2700-1-port-group-trunk]port link-type trunk 此组设为中继,即G0/0/1到G0/0/4都为中继[2700-1-port-group-trunk]port trunk allow-pass vlan all 这几步都和三层的配置一样,不同的是我们这里是进行的批量配置[2700-1-port-group-trunk]gvrp[2700-1-port-group-trunk]quit下面把相应端口加入vlan,这里我觉得端口组以vlan命名较为合适[2700]port group vlan11[2700-1-port-group- vlan11]group-member e0/0/1 to e0/0/4 [2700-1-port-group- vlan11]port link-type access 端口设置为access口[2700-1-port-group- vlan11]port default vlan 11 把E0/0/1-4口加入vlan11[2700-1-port-group- vlan11]quit以上VLAN的配置基本完成。
华为技术命令(三)dhcp中继配置命令DHCP 中继配置命令【命令】debugging ip relay protocol【视图】所有视图【参数】无【描述】debugging ip relay protocol 命令用来打开DHCP 中继和透传调试信息开关。
【命令】display ip relay protocol【视图】所有视图【参数】无【描述】display ip relay protocol 命令用来显示当前透传转发协议的运行情况。
命令】display ip relay-address【视图】所有视图【参数】无【描述】display ip relay-address 命令用来显示各接口的辅助地址的配置情况。
【举例】无【命令】ip relay protocol udp portundo ip relay protocol udp [ port ]【视图】系统视图【参数】port:转发UDP 报文的端口号。
【描述】ip relay protocol udp 命令用来配置透传转发协议及其使用的端口号,undoip relay protocol udp 命令用来取消透传转发协议及其端口号。
对于DHCP 中继来说,IP 辅助地址指定的是DHCP 服务器的地址。
配置辅助IP 地址后,从该接口上收到的广播报文,会发送到该服务器上去。
能够配置IP 辅助地址的接口应当支持广播方式。
每个接口最多可配置20 个辅助地址。
命令】ip relay-address ip-addressundo ip relay-address [ ip-address ]视图】以太网接口视图【参数】ip-address:为地址池起始IP 地址.【描述】ip relay-address 命令用来配置以太网口进行透传转发的辅助地址,undo ipITrelay-address 命令用来取消已配置的辅助地址。
缺省情况下,以太网口未配置辅助IP 地址。
华为DHCP全局、端⼝、中继配置LSW1全局配置DHCPundo terminal monitorInfo: Current terminal monitor is off.system-viewEnter system view, return user view with Ctrl+Z.[Huawei]vlan batch 10 11Info: This operation may take a few seconds. Please wait for a moment...done.[Huawei]dhcp enableInfo: The operation may take a few seconds. Please wait for a moment.done. [Huawei]ip pool 110(创建地址池) Info:It's successful to create an IP address pool.[Huawei-ip-pool-110]network 192.168.0.0 mask 24[Huawei-ip-pool-110]gateway-list 192.168.0.1[Huawei-ip-pool-110]dns-list 8.8.8.8[Huawei-ip-pool-110]lease day 0 hour 2[Huawei-ip-pool-110]excluded-ip-address 192.168.0.250 192.168.0.254 [Huawei-ip-pool-110]qui [Huawei]int e0/0/3[Huawei-Ethernet0/0/3]qui[Huawei]vlan batch 2 3Info: This operation may take a few seconds. Please wait for a moment...done.[Huawei]vlan 10[Huawei-vlan10]aggregate-vlan[Huawei-vlan10]access-vlan 2 3[Huawei]int vlanif 10[Huawei-Vlanif10]ip address 192.168.0.1 24[Huawei-Vlanif10]dhcp select global[Huawei-Vlanif10]qui[Huawei]int vlanif 11[Huawei-Vlanif11]ip add 10.0.0.1 30[Huawei-Vlanif11]qui[Huawei]int e0/0/3[Huawei-Ethernet0/0/3]port link-type trunk[Huawei-Ethernet0/0/3]port trunk allow-pass vlan 2 3[Huawei-Ethernet0/0/3]int e0/0/1[Huawei-Ethernet0/0/1]port link-type access[Huawei-Ethernet0/0/1]port default vlan 11[Huawei-Ethernet0/0/1]qui[Huawei]ip route-static 192.168.1.0 24 10.0.0.2[Huawei]ip route-static 192.168.2.0 24 10.0.0.2[Huawei]ip route-static 10.0.0.4 30 10.0.0.2[Huawei]ip route-static 10.0.0.8 30 10.0.0.2[Huawei]LSW2undo terminal monitorInfo: Current terminal monitor is off.system-viewEnter system view, return user view with Ctrl+Z.[Huawei]vlan batch 2 3Info: This operation may take a few seconds. Please wait for a moment...done. [Huawei]int e0/0/1[Huawei-Ethernet0/0/1]port link-type access[Huawei-Ethernet0/0/1]port default vlan 2[Huawei-Ethernet0/0/1]int e0/0/2[Huawei-Ethernet0/0/2]port link-type access[Huawei-Ethernet0/0/2]port default vlan 3[Huawei-Ethernet0/0/2]int e0/0/3[Huawei-Ethernet0/0/3]port link-type trunk[Huawei-Ethernet0/0/3] User interface con0 is availableLSW3端⼝配置DHCPundo terminal monitorInfo: Current terminal monitor is off.sysEnter system view, return user view with Ctrl+Z.[Huawei]vlan batch 11 20 21 5 6Info: This operation may take a few seconds. Please wait for a moment...done.[Huawei]int vlanif 11[Huawei-Vlanif11]ip add 10.0.0.2 30[Huawei-Vlanif11]int vlanif 21[Huawei-Vlanif21]ip add 10.0.0.5 30[Huawei-Vlanif21]qui[Huawei]vlan 20[Huawei-vlan20]aggregate-vlan[Huawei-vlan20]access-vlan 5 6[Huawei-vlan20]qui[Huawei]dhcp enableInfo: The operation may take a few seconds. Please wait for a moment.done. [Huawei]int vlanif 20 [Huawei-Vlanif20]ip add 192.168.1.1 24[Huawei-Vlanif20]dhcp select interface[Huawei-Vlanif20]dhcp server dns-list 8.8.8.8[Huawei-Vlanif20]dhcp server lease day 0 hour 3[Huawei-Vlanif20]dhcp server excluded-ip-address 192.168.1.250192.168.1.254[Huawei-Vlanif20]qui[Huawei]int e0/0/1[Huawei-Ethernet0/0/1]port link-type access[Huawei-Ethernet0/0/1]port default vlan 11[Huawei-Ethernet0/0/1]int e0/0/2[Huawei-Ethernet0/0/2]port link-type access[Huawei-Ethernet0/0/2]port default vlan 21[Huawei-Ethernet0/0/2]int e0/0/3[Huawei-Ethernet0/0/3]qui[Huawei]ip route-static 192.168.1.0 24 10.0.0.1[Huawei]undo ip route-static 192.168.1.0 24 10.0.0.1[Huawei]ip route-static 192.168.0.0 24 10.0.0.1[Huawei]ip route-static 192.168.2.0 24 10.0.0.6[Huawei]ip route-static 10.0.0.8 24 10.0.0.6Info: The destination address and mask of the configured static route mismatched , and the static route 10.0.0.0/24 was generated.[Huawei]ip route-static 10.0.0.8 30 10.0.0.6[Huawei] User interface con0 is availableLSW4Huawei>undo terminal monitorInfo: Current terminal monitor is off.sysEnter system view, return user view with Ctrl+Z.[Huawei]vlan batch 5 6Info: This operation may take a few seconds. Please wait for a moment...done. [Huawei]int e0/0/1[Huawei-Ethernet0/0/1]port link-type access[Huawei-Ethernet0/0/1]port default vlan 5[Huawei-Ethernet0/0/1]int e0/0/2[Huawei-Ethernet0/0/2]port link-type access[Huawei-Ethernet0/0/2]port default vlan 6[Huawei-Ethernet0/0/2]int e0/0/3[Huawei-Ethernet0/0/3]port link-type trunk[Huawei-Ethernet0/0/3]port trunk allow-pass vlan 5 6[Huawei-Ethernet0/0/3] User interface con0 is availableLSW5中继配置DHCPundo ter mInfo: Current terminal monitor is off.sysEnter system view, return user view with Ctrl+Z.[Huawei]vlan batch 21 30[Huawei][Huawei]dhcp enableInfo: The operation may take a few seconds. Please wait for a moment.done. [Huawei]int vlanif 21[Huawei-Vlanif21]ip add 10.0.0.6 30[Huawei-Vlanif21]int vlanif 30[Huawei-Vlanif30]ip add 10.0.0.9 30[Huawei-Vlanif30]qui[Huawei]int vlanif 30[Huawei-Vlanif30][Huawei-Vlanif30] dhcp select global[Huawei-Vlanif30]qui[Huawei]ip pool 300Info:It's successful to create an IP address pool. [Huawei-ip-pool-300]network 192.168.2.0 mask 24 [Huawei-ip-pool-300]gateway-list 192.168.2.1[Huawei-ip-pool-300]dns-list 8.8.8.8[Huawei-ip-pool-300]lease day 0 hour 2[Huawei-ip-pool-300]qui[Huawei]int e0/0/1[Huawei-Ethernet0/0/1]port link-type access[Huawei-Ethernet0/0/1]port defaul vlan 30[Huawei-Ethernet0/0/1]int e0/0/2[Huawei-Ethernet0/0/2]port link-type access[Huawei-Ethernet0/0/2]port defaul vlan 21[Huawei-Ethernet0/0/2] User interface con0 is available [Huawei]ip route-static 192.168.0.0 24 10.0.0.5 [Huawei]ip route-static 192.168.1.0 24 10.0.0.5 [Huawei]ip route-static 10.0.0.0 30 10.0.0.5[Huawei]ip route-static 192.168.2.0 24 10.0.0.10LSW6undo terminal monitorInfo: Current terminal monitor is off.langu chineseChange language mode, confirm? [Y/N] y提⽰:改变语⾔模式成功。
华为交换机配置DHCP中继
很多情况下我们需要在三层交换机上配置一下DHCP中继服务;
用以为下面的客户机提供DHCP中继服务;
就是说三层交换机上可以为DHCP端口转发数据到指定的DHCP服务器上;而不会因为是跨VLAN就导致客户机获取不到DHCP分配的IP地址;
方法/步骤
请先确保你的电脑和华为交换机连接成功
进入管理视图
<Quidway> system-view
接着dhcp enable 开启交换机的DHCP服务
接着进入虚拟vlan 视图
[Quidway]interface Vlanif 100
配置一个IP地址
[Quidway-Vlanif100] ip address 192.168.104.253 255.255.255.0
然后开始dhcp中继功能
[Quidway-Vlanif100]dhcp select relay
配置DHCP服务器IP地址
[Quidway-Vlanif100]ip relay address 10.10.100.171
到此华为交换机的DHCP中继功能就配置完成了
记得要save保存配置。
华为dhcp命令详解和配置案例整理必选配置system-view进入系统视图dhcp enable开启DHCP服务interface vlanif 1VLANIF 1 接口视图ip address 192.168.1.1VLANIF接口的IP地址dhcp select global能接口的DHCP服务功能,指定DHCP服务器从全局地址池分配地址。
(可以加在接口或VLAN下)quit离开当前视图ip pool bg进入全局地址池bgnetwork mask 255.255.250.0配置地址池下的IP地址范围gateway-list 192.168.1.1DHCP的网关可选配置domain-name XXX配置分配给DHCP客户端的DNS域名后缀(可选中的可选)dns-list 202.106.0.20 8.8.4.4配置DNS主和备lease day 1 hour 1 minute 1配置IP地址租期,此配置为一天一小时一分钟,默认为一天,unlimited为无限excluded-ip-address 192.168.1.100 192.168.1.254excluded-ip-address 192.168.1.1配置地址池中不参与自动分配的IP地址,多次执行该命令,可以配置多个不参与自动分配的IP地址段。
static-bind ip-address 172.16.35.253 mac-address 28d2-4469-5a55当一个用户需要固定的IP地址时,可以将地址池中没有在使用的IP地址与用户的MAC地址绑定。
DHCP中继当客户端与DHCP服务器不在同一网段时,通过在DHCP中继设备转发客户端到DHCP服务器的请求。
dhcp enable开启DHCP功能interface vlanif 1VLANIF 1 接口视图ip address 192.168.1.1VLANIF接口的IP地址dhcp select relay启动VLANIF接口的DHCP中继功能。
华为s5700交换机配置全局地址池dhcpSW1配置如下:<Huawei><Huawei>sy<Huawei>system-view (进入全局模式)Enter system view, return user view with Ctrl+Z.[Huawei]sy[Huawei]sysname SW1 ( 设备命名)[SW1][SW1]d[SW1]dhcp en[SW1]dhcp enable (使用DHCP功能)Info: The operation may take a few seconds. Please wait for a moment.done.[SW1][SW1]ip pool 10 (创建全局地址池,同时进入全局地址池视图)Info:It's successful to create an IP address pool.[SW1-ip-pool-10]netw[SW1-ip-pool-10]network 192.168.10.0 m [SW1-ip-pool-10]network 192.168.10.0 mask 24(配置全局地址池可动态分配的IP地址范围)[SW1-ip-pool-10][SW1-ip-pool-10]dns-list 8.8.8.8 (配置DNS )[SW1-ip-pool-10][SW1-ip-pool-10]gateway-list 192.168.10.1 (配置网关)[SW1-ip-pool-10]ex[SW1-ip-pool-10]excluded-ip-address192.168.10.201 192.168.10.254 (保留不被分配的地址)[SW1-ip-pool-10][SW1-ip-pool-10]lease d[SW1-ip-pool-10]lease day 7 (IP租约期限)[SW1-ip-pool-10][SW1-ip-pool-10]dis this (查询当前模式的配置)#ip pool 10gateway-list 192.168.10.1 (网关)network 192.168.10.0 mask 255.255.255.0 (IP地址范围)excluded-ip-address 192.168.10.201 192.168.10.254 (保留IP地址范围)lease day 7 hour 0 minute 0 (IP租约周期) dns-list 8.8.8.8#return[SW1-ip-pool-10][SW1-ip-pool-10][SW1-ip-pool-10]quit (退出)[SW1][SW1][SW1][SW1]ip pool 20Info:It's successful to create an IP address pool.[SW1-ip-pool-20][SW1-ip-pool-20][SW1-ip-pool-20]netw[SW1-ip-pool-20]network 192.168.20.0 m [SW1-ip-pool-20]network 192.168.20.0 mask 24[SW1-ip-pool-20][SW1-ip-pool-20][SW1-ip-pool-20]d[SW1-ip-pool-20]dns-list 8.8.8.8[SW1-ip-pool-20][SW1-ip-pool-20]g[SW1-ip-pool-20]gateway-list 192.168.20.1 [SW1-ip-pool-20][SW1-ip-pool-20][SW1-ip-pool-20]ex[SW1-ip-pool-20]excluded-ip-address192.168.20.201 192.168.20.254[SW1-ip-pool-20][SW1-ip-pool-20][SW1-ip-pool-20]l[SW1-ip-pool-20]lease d[SW1-ip-pool-20]lease day 7[SW1-ip-pool-20][SW1-ip-pool-20][SW1-ip-pool-20][SW1-ip-pool-20][SW1-ip-pool-20]dis this#ip pool 20gateway-list 192.168.20.1network 192.168.20.0 mask 255.255.255.0 excluded-ip-address 192.168.20.201 192.168.20.254lease day 7 hour 0 minute 0dns-list 8.8.8.8#return[SW1-ip-pool-20][SW1-ip-pool-20][SW1-ip-pool-20]q[SW1][SW1][SW1]v[SW1]vlan b[SW1]vlan batch 10 20 (批量创建vlan)Info: This operation may take a few seconds. Please wait for a moment...done.[SW1][SW1][SW1]int[SW1]interface g[SW1]interface GigabitEthernet 0/0/1 (进入port 1)[SW1-GigabitEthernet0/0/1]por[SW1-GigabitEthernet0/0/1]port l[SW1-GigabitEthernet0/0/1]port link-t[SW1-GigabitEthernet0/0/1]port link-type a[SW1-GigabitEthernet0/0/1]port link-type access (配置port 1 类型)[SW1-GigabitEthernet0/0/1][SW1-GigabitEthernet0/0/1][SW1-GigabitEthernet0/0/1]port[SW1-GigabitEthernet0/0/1]port def[SW1-GigabitEthernet0/0/1]port default v[SW1-GigabitEthernet0/0/1]port default vlan 10 (配置port 1 vlan)[SW1-GigabitEthernet0/0/1][SW1-GigabitEthernet0/0/1]quit (退出)[SW1][SW1]int[SW1]interface g[SW1]interface GigabitEthernet 0/0/2 [SW1-GigabitEthernet0/0/2][SW1-GigabitEthernet0/0/2][SW1-GigabitEthernet0/0/2][SW1-GigabitEthernet0/0/2]por[SW1-GigabitEthernet0/0/2]port l[SW1-GigabitEthernet0/0/2]port link-t [SW1-GigabitEthernet0/0/2]port link-type a[SW1-GigabitEthernet0/0/2]port link-type access[SW1-GigabitEthernet0/0/2][SW1-GigabitEthernet0/0/2]por[SW1-GigabitEthernet0/0/2]port def[SW1-GigabitEthernet0/0/2]port default v[SW1-GigabitEthernet0/0/2]port default vlan 20[SW1-GigabitEthernet0/0/2][SW1-GigabitEthernet0/0/2]quit[SW1][SW1][SW1][SW1]int[SW1]interface v (配置VLANIF10接口下的客户端从全局地址池中获取IP地址)[SW1]interface Vlanif 10 (创建vlanif 10) [SW1-Vlanif10][SW1-Vlanif10][SW1-Vlanif10]ip add[SW1-Vlanif10]ip address 192.168.10.1 24 (配置IP地址)[SW1-Vlanif10][SW1-Vlanif10]dhcp sel[SW1-Vlanif10]dhcp select g[SW1-Vlanif10]dhcp select global (在vlanif 10模式下调用全局地址池)[SW1-Vlanif10][SW1-Vlanif10][SW1-Vlanif10]dis[SW1-Vlanif10]display this (查询当前配置参数)#interface Vlanif10ip address 192.168.10.1 255.255.255.0dhcp select global#return[SW1-Vlanif10][SW1-Vlanif10][SW1-Vlanif10]quit[SW1][SW1][SW1]int[SW1]interface v[SW1]interface Vlanif 20[SW1-Vlanif20][SW1-Vlanif20][SW1-Vlanif20]ip add[SW1-Vlanif20]ip address 192.168.20.1 24 [SW1-Vlanif20][SW1-Vlanif20]dhcp[SW1-Vlanif20]dhcp sel[SW1-Vlanif20]dhcp select g[SW1-Vlanif20]dhcp select global[SW1-Vlanif20][SW1-Vlanif20]dis this#interface Vlanif20ip address 192.168.20.1 255.255.255.0dhcp select global#return[SW1-Vlanif20][SW1-Vlanif20][SW1-Vlanif20]quit[SW1][SW1]dis[SW1]display ip pool (查看IP地址池配置情况)-----------------------------------------------------------------------Pool-name : 10Pool-No : 0Position : Local Status : UnlockedGateway-0 : 192.168.10.1Mask : 255.255.255.0VPN instance : -------------------------------------------------------------------------Pool-name : 20Pool-No : 1Position : Local Status : UnlockedGateway-0 : 192.168.20.1Mask : 255.255.255.0VPN instance : --IP address StatisticTotal :506Used :0 Idle :398Expired :0 Conflict :0 Disable :108[SW1][SW1][SW1]quit<SW1><SW1><SW1>save (保存配置,写入设备)The current configuration will be written to the device.Are you sure to continue?[Y/N]yNow saving the current configuration to the slot 0.Mar 18 2017 13:30:47-08:00 SW1 %%01CFM/4/SAVE(l)[63]:The user chose Y when deciding whether to save the configuration to the device.Save the configuration successfully.<SW1>PC情况如下。
华为路由器DHCP中继(DHCP Relay)配置实例路由器配置实例早期的DHCP协议只适用于DHCP客户端和服务器处于同一个网段内的情况,不能跨网段。
因此,为进行动态主机配置,需要在每个网段置一个DHCP服务器,这显然是很不经济的。
DHCP 中继(DHCP Relay)功能的引入解决了这一难题:客户端可以通过DHCP中继与其他网段的DHCP服务器通信,最终取得合法的IP地址。
这样,多个网段的DHCP客户端可以使用同一个DHCP服务器,既节省了成本,又便于进行集中管理。
一般来说,DHCP中继既可以是主机,也可以是路由器,只要在设备上启动DHCP中继代理的服务程序即可。
DHCP Relay工作原理如下:1、当DHCP Client启动并进行DHCP初始化时,它会在本地网络广播配置请求报文。
2、如果本地网络存在DHCP Server,则可以直接进行DHCP配置,不需要DHCP Relay。
3、如果本地网络没有DHCP Server,则与本地网络相连的具有DHCP Relay功能的网络设备收到该广播报文后,将进行适当处理并转发给指定的其它网络上的DHCP Server。
4、DHCP Server根据DHCP Client提供的信息进行相应的配置,并通过DHCP Relay将配置信息发送给DHCP Client,完成对DHCP Client的动态配置。
事实上,从开始配置到最终完成配置,可能存在多次这样的交互过程。
下面为大家介绍一个在华为路由器上实现DHCP中继的配置实例。
一、组网需求如下图,DHCP客户端所在的网段为10.100.0.0/16,而DHCP服务器所在的网段为202.40.0.0/16。
需要通过带DHCP中继功能的路由设备中继DHCP报文,使得DHCP客户端可以从DHCP服务器上申请到IP地址等相关配置信息。
DHCP服务器应当配置一个10.100.0.0/16网段的IP地址池,DNS服务器地址为10.100.1.2/16,NetBIOS服务器地址10.100.1.3/16,出口网关地址10.100.1.4,并且DHCP 服务器上应当配置有到10.100.0.0/16网段的路由。
华为DHCP relay(中继)配置教程如果DHCP客户端和DHCP服务器不在同一网段内,需要DHCP中继负责DHCP服务器与DHCP客户端之间的DHCP报文转发,这样可以避免在每个网段部署DHCP服务器,节约成本,方便管理。
DHCP服务器和DHCP客户端之间的DHCP报文中继次数不能超过16次,否则DHCP报文将被丢弃。
设备作为DHCP中继时,如果使能了STP功能,可能会造成地址分配较慢。
STP功能缺省处于使能状态,如果确认不需要使能STP功能,可以执行命令undo stp enable去使能STP功能。
当DHCP客户端与DHCP服务器经过三层设备相连时(不在同一网段),需要DHCP中继设备在中间担当一个代理角色,负责转发DHCP客户端与DHCP 服务器之间的通信。
DHCP中继必须与DHCP客户端所在网段直连,但不一定要与DHCP服务器所在网段直连,但要与DHCP服务器所在网段路由通畅。
DHCP中继模式仅可工作在三层模式的接口,DHCP中继设备必须使能DHCP功能1、使能DHCP功能[Huawei]dhcp en2、配置DHCP中继的轮询功能[Huawei]ip relay address cycle仅当dhcp中继设备向多个DHCP服务器转发报文时才需要配置。
当配置多个DHCP服务器后,DHCP中继默认向所有服务器转发DHCP discover报文,会加重中继设备负担。
使能该功能后,中继设备只会选择一个DHCP服务器转发,如果这个服务器没响应,再向另一个转发。
3、配置中继接口的IP地址[Huawei-GigabitEthernet0/0/2]ip address 10.1.1.2 24IP地址必须为DHCP地址池配置的网关地址;中继接口必须为与客户端在同一网段4、启动接口的DHCP中继功能[Huawei-GigabitEthernet0/0/1]dhcp select relay子接口工作在DHCP中继模式时,需要在子接口上配置arp broadcast enable命令,使能终结子接口的ARP广播功能。
华为技术命令(三)dhcp中继配置命令DHCP 中继配置命令【命令】debugging ip relay protocol【视图】所有视图【参数】无【描述】debugging ip relay protocol 命令用来打开DHCP 中继和透传调试信息开关。
【命令】display ip relay protocol【视图】所有视图【参数】无【描述】display ip relay protocol 命令用来显示当前透传转发协议的运行情况。
命令】display ip relay-address【视图】所有视图【参数】无【描述】display ip relay-address 命令用来显示各接口的辅助地址的配置情况。
【举例】无【命令】ip relay protocol udp portundo ip relay protocol udp [ port ]【视图】系统视图【参数】port:转发UDP 报文的端口号。
【描述】ip relay protocol udp 命令用来配置透传转发协议及其使用的端口号,undoip relay protocol udp 命令用来取消透传转发协议及其端口号。
对于DHCP 中继来说,IP 辅助地址指定的是DHCP 服务器的地址。
配置辅助IP 地址后,从该接口上收到的广播报文,会发送到该服务器上去。
能够配置IP 辅助地址的接口应当支持广播方式。
每个接口最多可配置20 个辅助地址。
命令】ip relay-address ip-addressundo ip relay-address [ ip-address ]视图】以太网接口视图【参数】ip-address:为地址池起始IP 地址.【描述】ip relay-address 命令用来配置以太网口进行透传转发的辅助地址,undo ipITrelay-address 命令用来取消已配置的辅助地址。
缺省情况下,以太网口未配置辅助IP 地址。
华为s3700交换机DHCP配置命令有哪些网络交换器是一个扩大网络的设备,能为子网中提供更多的连接端口,以便连接更多的电脑。
随着通信业的发展以及国民经济信息化的推进,网络交换机市场呈稳步上升态势。
下面是给大家整理的一些有关华为s3700交换机DHCP配置命令,希望对大家有帮助!华为s3700交换机DHCP配置命令1.0快速浏览开启DHCP服务后,必须在接口下配置dhcp select global或者dhcp select interfaceS3700 支持DHCP 服务器,DHCP客户端和DHCP 中继的功能。
其中DHCP服务器可基于全局地支持,也可以基于VLANIF接口的地址。
1.1同网段内配置基于全局地址池的DHCP 服务器示例某公司有两个处于同一网络内的办公室,为了节省网络资源,两个办公室内的PC 机由一台交换机作为服务器统一分配IP 地址。
如图所示,SwitchA 应用为DHCP 服务器,SwitchB 和SwitchC 为用户接入交换机。
可在SwitchA 上配置基于全局的地址池和接口的地址池,下面以全局地址池为例配置SwitchA 为同一网段中的客户端动态分配IP地址。
地址池网段10.1.1.0/24 分为两个网段:10.1.1.0/25 和10.1.1.128/25。
DHCP 服务器两个VLANIF 接口的IP 地址分别为10.1.1.1/25 和10.1.1.129/25。
网段10.1.1.0/25 内的PC 机数量比较少且位置比较固定,地址租用期限配置为10 天,DNS 地址为10.1.1.2,无NetBIOS 地址,出口网关地址为10.1.1.126。
网段10.1.1.128/25 内的PC 机数量较多但经常外借,地址租用期限配置为2 天,DNS 地址为10.1.1.2,NetBIOS 地址为10.1.1.4,出口网关地址为10.1.1.254 步骤1 启动DHCP 服务。
SW1配置如下:<Huawei><Huawei>sy<Huawei>system-view (进入全局模式)Enter system view, return user view with Ctrl+Z.[Huawei]sy[Huawei]sysname SW1 ( 设备命名)[SW1][SW1]d[SW1]dhcp en[SW1]dhcp enable (使用DHCP功能)Info: The operation may take a few seconds. Please wait for a moment.done.[SW1][SW1]ip pool 10 (创建全局地址池,同时进入全局地址池视图)Info:It's successful to create an IP address pool.[SW1-ip-pool-10]netw[SW1-ip-pool-10]network 192.168.10.0 m[SW1-ip-pool-10]network 192.168.10.0 mask 24(配置全局地址池可动态分配的IP地址范围)[SW1-ip-pool-10][SW1-ip-pool-10]dns-list 8.8.8.8 (配置DNS )[SW1-ip-pool-10][SW1-ip-pool-10]gateway-list 192.168.10.1 (配置网关)[SW1-ip-pool-10]ex[SW1-ip-pool-10]excluded-ip-address 192.168.10.201 192.168.10.254 (保留不被分配的地址)[SW1-ip-pool-10][SW1-ip-pool-10]lease d[SW1-ip-pool-10]lease day 7 (IP租约期限)[SW1-ip-pool-10][SW1-ip-pool-10]dis this (查询当前模式的配置)#ip pool 10gateway-list 192.168.10.1 (网关)network 192.168.10.0 mask 255.255.255.0 (IP地址范围)excluded-ip-address 192.168.10.201 192.168.10.254 (保留IP地址范围)lease day 7 hour 0 minute 0 (IP租约周期)dns-list 8.8.8.8#return[SW1-ip-pool-10][SW1-ip-pool-10][SW1-ip-pool-10]quit (退出)[SW1][SW1][SW1][SW1]ip pool 20Info:It's successful to create an IP address pool.[SW1-ip-pool-20][SW1-ip-pool-20][SW1-ip-pool-20]netw[SW1-ip-pool-20]network 192.168.20.0 m[SW1-ip-pool-20]network 192.168.20.0 mask 24[SW1-ip-pool-20][SW1-ip-pool-20][SW1-ip-pool-20]d[SW1-ip-pool-20]dns-list 8.8.8.8[SW1-ip-pool-20][SW1-ip-pool-20]g[SW1-ip-pool-20]gateway-list 192.168.20.1[SW1-ip-pool-20][SW1-ip-pool-20][SW1-ip-pool-20]ex[SW1-ip-pool-20]excluded-ip-address 192.168.20.201 192.168.20.254 [SW1-ip-pool-20][SW1-ip-pool-20][SW1-ip-pool-20]l[SW1-ip-pool-20]lease d[SW1-ip-pool-20]lease day 7[SW1-ip-pool-20][SW1-ip-pool-20][SW1-ip-pool-20][SW1-ip-pool-20][SW1-ip-pool-20]dis this#ip pool 20gateway-list 192.168.20.1network 192.168.20.0 mask 255.255.255.0excluded-ip-address 192.168.20.201 192.168.20.254lease day 7 hour 0 minute 0dns-list 8.8.8.8#return[SW1-ip-pool-20][SW1-ip-pool-20][SW1-ip-pool-20]q[SW1][SW1][SW1]v[SW1]vlan b[SW1]vlan batch 10 20 (批量创建vlan)Info: This operation may take a few seconds. Please wait for a moment...done. [SW1][SW1][SW1]int[SW1]interface g[SW1]interface GigabitEthernet 0/0/1 (进入port 1)[SW1-GigabitEthernet0/0/1]por[SW1-GigabitEthernet0/0/1]port l[SW1-GigabitEthernet0/0/1]port link-t[SW1-GigabitEthernet0/0/1]port link-type a[SW1-GigabitEthernet0/0/1]port link-type access (配置port 1 类型)[SW1-GigabitEthernet0/0/1][SW1-GigabitEthernet0/0/1][SW1-GigabitEthernet0/0/1]port[SW1-GigabitEthernet0/0/1]port def[SW1-GigabitEthernet0/0/1]port default v[SW1-GigabitEthernet0/0/1]port default vlan 10 (配置port 1 vlan) [SW1-GigabitEthernet0/0/1][SW1-GigabitEthernet0/0/1]quit (退出)[SW1][SW1]int[SW1]interface g[SW1]interface GigabitEthernet 0/0/2[SW1-GigabitEthernet0/0/2][SW1-GigabitEthernet0/0/2][SW1-GigabitEthernet0/0/2][SW1-GigabitEthernet0/0/2]por[SW1-GigabitEthernet0/0/2]port l[SW1-GigabitEthernet0/0/2]port link-t[SW1-GigabitEthernet0/0/2]port link-type a[SW1-GigabitEthernet0/0/2]port link-type access[SW1-GigabitEthernet0/0/2][SW1-GigabitEthernet0/0/2]por[SW1-GigabitEthernet0/0/2]port def[SW1-GigabitEthernet0/0/2]port default v[SW1-GigabitEthernet0/0/2]port default vlan 20[SW1-GigabitEthernet0/0/2][SW1-GigabitEthernet0/0/2]quit[SW1][SW1][SW1][SW1]int[SW1]interface v (配置VLANIF10接口下的客户端从全局地址池中获取IP地址)[SW1]interface Vlanif 10 (创建vlanif 10)[SW1-Vlanif10][SW1-Vlanif10][SW1-Vlanif10]ip add[SW1-Vlanif10]ip address 192.168.10.1 24 (配置IP地址)[SW1-Vlanif10][SW1-Vlanif10]dhcp sel[SW1-Vlanif10]dhcp select g[SW1-Vlanif10]dhcp select global (在vlanif 10模式下调用全局地址池)[SW1-Vlanif10][SW1-Vlanif10][SW1-Vlanif10]dis[SW1-Vlanif10]display this (查询当前配置参数)#interface Vlanif10ip address 192.168.10.1 255.255.255.0dhcp select global#return[SW1-Vlanif10][SW1-Vlanif10][SW1-Vlanif10]quit[SW1][SW1][SW1]int[SW1]interface v[SW1]interface Vlanif 20[SW1-Vlanif20][SW1-Vlanif20][SW1-Vlanif20]ip add[SW1-Vlanif20]ip address 192.168.20.1 24 [SW1-Vlanif20][SW1-Vlanif20]dhcp[SW1-Vlanif20]dhcp sel[SW1-Vlanif20]dhcp select g[SW1-Vlanif20]dhcp select global[SW1-Vlanif20][SW1-Vlanif20]dis this#interface Vlanif20ip address 192.168.20.1 255.255.255.0dhcp select global#return[SW1-Vlanif20][SW1-Vlanif20][SW1-Vlanif20]quit[SW1][SW1]dis[SW1]display ip pool (查看IP地址池配置情况)-----------------------------------------------------------------------Pool-name : 10Pool-No : 0Position : Local Status : UnlockedGateway-0 : 192.168.10.1Mask : 255.255.255.0VPN instance : -------------------------------------------------------------------------Pool-name : 20Pool-No : 1Position : Local Status : Unlocked Gateway-0 : 192.168.20.1Mask : 255.255.255.0VPN instance : --IP address StatisticTotal :506Used :0 Idle :398Expired :0 Conflict :0 Disable :108 [SW1][SW1][SW1]quit<SW1><SW1><SW1>save (保存配置,写入设备)The current configuration will be written to the device.Are you sure to continue?[Y/N]yNow saving the current configuration to the slot 0.Mar 18 2017 13:30:47-08:00 SW1 %%01CFM/4/SAVE(l)[63]:The user chose Y when deciding whether to save the configuration to the device.Save the configuration successfully.<SW1>PC情况如下。
LSW1全局配置DHCP<Huawei><Huawei>undo terminal monitorInfo: Current terminal monitor is off.<Huawei>system-viewEnter system view, return user view with Ctrl+Z.[Huawei]vlan batch 10 11Info: This operation may take a few seconds. Please wait for a moment...done.[Huawei]dhcp enableInfo: The operation may take a few seconds. Please wait for a moment.done. [Huawei]ip pool 110(创建地址池)Info:It's successful to create an IP address pool.[Huawei-ip-pool-110]network 192.168.0.0 mask 24[Huawei-ip-pool-110]gateway-list 192.168.0.1[Huawei-ip-pool-110]dns-list 8.8.8.8[Huawei-ip-pool-110]lease day 0 hour 2[Huawei-ip-pool-110]excluded-ip-address 192.168.0.250 192.168.0.254 [Huawei-ip-pool-110]qui[Huawei]int e0/0/3[Huawei-Ethernet0/0/3]qui[Huawei]vlan batch 2 3Info: This operation may take a few seconds. Please wait for a moment...done.[Huawei]vlan 10[Huawei-vlan10]aggregate-vlan[Huawei-vlan10]access-vlan 2 3[Huawei-vlan10]qui[Huawei]int vlanif 10[Huawei-Vlanif10]ip address 192.168.0.1 24[Huawei-Vlanif10]dhcp select global[Huawei-Vlanif10]qui[Huawei]int vlanif 11[Huawei-Vlanif11]ip add 10.0.0.1 30[Huawei-Vlanif11]qui[Huawei]int e0/0/3[Huawei-Ethernet0/0/3]port link-type trunk[Huawei-Ethernet0/0/3]port trunk allow-pass vlan 2 3[Huawei-Ethernet0/0/3]int e0/0/1[Huawei-Ethernet0/0/1]port link-type access[Huawei-Ethernet0/0/1]port default vlan 11[Huawei-Ethernet0/0/1]qui[Huawei]ip route-static 192.168.1.0 24 10.0.0.2[Huawei]ip route-static 192.168.2.0 24 10.0.0.2[Huawei]ip route-static 10.0.0.4 30 10.0.0.2[Huawei]ip route-static 10.0.0.8 30 10.0.0.2[Huawei]LSW2<Huawei><Huawei>undo terminal monitorInfo: Current terminal monitor is off.<Huawei>system-viewEnter system view, return user view with Ctrl+Z.[Huawei]vlan batch 2 3Info: This operation may take a few seconds. Please wait for a moment...done.[Huawei]int e0/0/1[Huawei-Ethernet0/0/1]port link-type access[Huawei-Ethernet0/0/1]port default vlan 2[Huawei-Ethernet0/0/1]int e0/0/2[Huawei-Ethernet0/0/2]port link-type access[Huawei-Ethernet0/0/2]port default vlan 3[Huawei-Ethernet0/0/2]int e0/0/3[Huawei-Ethernet0/0/3]port link-type trunk[Huawei-Ethernet0/0/3]port trunk allow[Huawei-Ethernet0/0/3]port trunk allow-pass vlan 2 3[Huawei-Ethernet0/0/3] User interface con0 is availableLSW3端口配置DHCP<Huawei>undo terminal monitorInfo: Current terminal monitor is off.<Huawei>sysEnter system view, return user view with Ctrl+Z.[Huawei]vlan batch 11 20 21 5 6Info: This operation may take a few seconds. Please wait for a moment...done.[Huawei]int vlanif 11[Huawei-Vlanif11]ip add 10.0.0.2 30[Huawei-Vlanif11]int vlanif 21[Huawei-Vlanif21]ip add 10.0.0.5 30[Huawei-Vlanif21]qui[Huawei]vlan 20[Huawei-vlan20]aggregate-vlan[Huawei-vlan20]access-vlan 5 6[Huawei-vlan20]qui[Huawei]dhcp enableInfo: The operation may take a few seconds. Please wait for a moment.done. [Huawei]int vlanif 20[Huawei-Vlanif20]ip add 192.168.1.1 24[Huawei-Vlanif20]dhcp select interface[Huawei-Vlanif20]dhcp server dns-list 8.8.8.8[Huawei-Vlanif20]dhcp server lease day 0 hour 3[Huawei-Vlanif20]dhcp server excluded-ip-address 192.168.1.250192.168.1.254[Huawei-Vlanif20]qui[Huawei]int e0/0/1[Huawei-Ethernet0/0/1]port link-type access[Huawei-Ethernet0/0/1]port default vlan 11[Huawei-Ethernet0/0/1]int e0/0/2[Huawei-Ethernet0/0/2]port link-type access[Huawei-Ethernet0/0/2]port default vlan 21[Huawei-Ethernet0/0/2]int e0/0/3[Huawei-Ethernet0/0/3]port link-type trunk[Huawei-Ethernet0/0/3]port trunk allow-pass vlan 5 6[Huawei-Ethernet0/0/3]qui[Huawei]ip route-static 192.168.1.0 24 10.0.0.1[Huawei]undo ip route-static 192.168.1.0 24 10.0.0.1[Huawei]ip route-static 192.168.0.0 24 10.0.0.1[Huawei]ip route-static 192.168.2.0 24 10.0.0.6[Huawei]ip route-static 10.0.0.8 24 10.0.0.6Info: The destination address and mask of the configured static route mismatched, and the static route 10.0.0.0/24 was generated.[Huawei]ip route-static 10.0.0.8 30 10.0.0.6[Huawei] User interface con0 is availableLSW4Huawei>undo terminal monitorInfo: Current terminal monitor is off.<Huawei>sysEnter system view, return user view with Ctrl+Z.[Huawei]vlan batch 5 6Info: This operation may take a few seconds. Please wait for a moment...done.[Huawei]int e0/0/1[Huawei-Ethernet0/0/1]port link-type access[Huawei-Ethernet0/0/1]port default vlan 5[Huawei-Ethernet0/0/1]int e0/0/2[Huawei-Ethernet0/0/2]port link-type access[Huawei-Ethernet0/0/2]port default vlan 6[Huawei-Ethernet0/0/2]int e0/0/3[Huawei-Ethernet0/0/3]port link-type trunk[Huawei-Ethernet0/0/3]port trunk allow-pass vlan 5 6[Huawei-Ethernet0/0/3] User interface con0 is availableLSW5中继配置DHCP<Huawei>undo ter mInfo: Current terminal monitor is off.<Huawei>sysEnter system view, return user view with Ctrl+Z.[Huawei]vlan batch 21 30Info: This operation may take a few seconds. Please wait for a moment...done.[Huawei][Huawei]dhcp enableInfo: The operation may take a few seconds. Please wait for a moment.done. [Huawei]int vlanif 21[Huawei-Vlanif21]ip add 10.0.0.6 30[Huawei-Vlanif21]int vlanif 30[Huawei-Vlanif30]ip add 10.0.0.9 30[Huawei-Vlanif30]qui[Huawei]int vlanif 30[Huawei-Vlanif30][Huawei-Vlanif30] dhcp select global[Huawei-Vlanif30]qui[Huawei]ip pool 300Info:It's successful to create an IP address pool. [Huawei-ip-pool-300]network 192.168.2.0 mask 24 [Huawei-ip-pool-300]gateway-list 192.168.2.1[Huawei-ip-pool-300]dns-list 8.8.8.8[Huawei-ip-pool-300]lease day 0 hour 2[Huawei-ip-pool-300]qui[Huawei]int e0/0/1[Huawei-Ethernet0/0/1]port link-type access[Huawei-Ethernet0/0/1]port defaul vlan 30[Huawei-Ethernet0/0/1]int e0/0/2[Huawei-Ethernet0/0/2]port link-type access[Huawei-Ethernet0/0/2]port defaul vlan 21[Huawei-Ethernet0/0/2] User interface con0 is available [Huawei]ip route-static 192.168.0.0 24 10.0.0.5 [Huawei]ip route-static 192.168.1.0 24 10.0.0.5 [Huawei]ip route-static 10.0.0.0 30 10.0.0.5[Huawei]ip route-static 192.168.2.0 24 10.0.0.10LSW6<Huawei>undo terminal monitorInfo: Current terminal monitor is off.<Huawei>langu chineseChange language mode, confirm? [Y/N] y提示:改变语言模式成功。