华为eNSP——DHCP中继配置
admin
2023-03-29 02:21:31
0次

实验拓扑图

华为eNSP——DHCP中继配置

实验环境

R4作为DHCP服务器,R1,R2上做中继服务,实现不同网段的pc获取地址

1,配置sw交换机

sys      ##进入系统视图模式
[Huawei]sysname SW1   ##修改名字
[SW1]vlan bat 10 20      ##创建vlan10 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 access    ##配置为access口
[SW1-Ethernet0/0/1]port default vlan 10      ##将接口放到vlan10中
[SW1-Ethernet0/0/1]un sh                           ##开启
[SW1-Ethernet0/0/1]int e0/0/2                     ##e0/0/2接口
[SW1-Ethernet0/0/2]port link-type access    
[SW1-Ethernet0/0/2]port default vlan 20     ##放到vlan20中
[SW1-Ethernet0/0/2]un sh
[SW1-Ethernet0/0/2]int e0/0/3    
[SW1-Ethernet0/0/3]port link-type access 
[SW1-Ethernet0/0/3]port default vlan 10    
[SW1-Ethernet0/0/3]un sh
[SW1-Ethernet0/0/3]int e0/0/4
[SW1-Ethernet0/0/4]port link-type access
[SW1-Ethernet0/0/4]port default vlan 20
[SW1-Ethernet0/0/4]un sh
[SW1-Ethernet0/0/4]dis vlan    ##查看vlan信息
The total number of vlans is : 3
--------------------------------------------------------------------------------
U: Up;         D: Down;         TG: Tagged;         UT: Untagged;
MP: Vlan-mapping;               ST: Vlan-stacking;
#: ProtocolTransparent-vlan;    *: Management-vlan;
--------------------------------------------------------------------------------
VID  Type    Ports                                                          
--------------------------------------------------------------------------------
1    common  UT:Eth0/0/5(D)     Eth0/0/6(D)     Eth0/0/7(D)     Eth0/0/8(D)     
                Eth0/0/9(D)     Eth0/0/10(D)    Eth0/0/11(D)    Eth0/0/12(D)    
                Eth0/0/13(D)    Eth0/0/14(D)    Eth0/0/15(D)    Eth0/0/16(D)    
                Eth0/0/17(D)    Eth0/0/18(D)    Eth0/0/19(D)    Eth0/0/20(D)    
                Eth0/0/21(D)    Eth0/0/22(D)    GE0/0/1(U)      GE0/0/2(D)      

10   common  UT:Eth0/0/1(U)     Eth0/0/3(U)                                     
20   common  UT:Eth0/0/2(U)     Eth0/0/4(U)                                     

VID  Status  Property      MAC-LRN Statistics Description      
--------------------------------------------------------------------------------
1    enable  default       enable  disable    VLAN 0001                         
10   enable  default       enable  disable    VLAN 0010                         
20   enable  default       enable  disable    VLAN 0020 
[SW1-Ethernet0/0/4]int g0/0/1       ##进入接口
[SW1-GigabitEthernet0/0/1] port link-type trunk   ##设置为trunk口
[SW1-GigabitEthernet0/0/1]port trunk allow-pass vlan all   ##允许所有vlan通过
[SW1-GigabitEthernet0/0/1]un sh  ##开启

2,配置R1路由

[R1]dhcp enable   ##开启dhcp
[R1]int g0/0/1.10    ##进入逻辑子接口
[R1-GigabitEthernet0/0/1.10]dot1q termination vid 10  ##封装协议,该接口对应vlan10
[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]dhcp select relay             ##开启DHCP中继服务
[R1-GigabitEthernet0/0/1.10]dhcp relay server-ip  14.0.0.2  ##指向R1服务器地址
[R1-GigabitEthernet0/0/1.10]int g0/0/1.20      ##进入逻辑子接口
[R1-GigabitEthernet0/0/1.20]dot1q termination vid 20   ##vlan20
[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]dhcp select relay 
[R1-GigabitEthernet0/0/1.20]dhcp relay server-ip 14.0.0.2
[R1-GigabitEthernet0/0/1.20]q
[R1]int g0/0/2   ##配置接口的ip地址
[R1-GigabitEthernet0/0/2]ip add 14.0.0.1 24
[R1-GigabitEthernet0/0/2]un sh
[R1-GigabitEthernet0/0/2]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 12.0.0.1 24
[R1-GigabitEthernet0/0/0]un sh
[R1-GigabitEthernet0/0/0]dis ip int b  ##查看接口ip信息
*down: administratively down
!down: FIB overload down
^down: standby
(l): loopback
(s): spoofing
(d): Dampening Suppressed
The number of interface that is UP in Physical is 6
The number of interface that is DOWN in Physical is 7
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 8
Interface                         IP Address/Mask      Physical   Protocol  
Ethernet0/0/0                     unassigned           down       down      
Ethernet0/0/1                     unassigned           down       down      
GigabitEthernet0/0/0              12.0.0.1/24          up         up        
GigabitEthernet0/0/1              unassigned           up         down      
GigabitEthernet0/0/1.10           192.168.10.1/24      up         up        
GigabitEthernet0/0/1.20           192.168.20.1/24      up         up        
GigabitEthernet0/0/2              14.0.0.1/24          up         up        
GigabitEthernet0/0/3              unassigned           down       down      
NULL0                             unassigned           up         up(s)   
[R1]ip route-static 15.0.0.0 24 12.0.0.2  ##设置静态路由

3,配置R2路由

sys
[Huawei]sysname R2
[R2]int g0/0/0    ##配置接口IP地址
[R2-GigabitEthernet0/0/0]ip add 12.0.0.2 24
[R2-GigabitEthernet0/0/0]un sh
[R2-GigabitEthernet0/0/0]q
[R2]dhcp enable    ##开启dhcp
[R2]int g0/0/1    ##进接口
[R2-GigabitEthernet0/0/1]ip add 15.0.0.1 24   ##配置接口ip
[R2-GigabitEthernet0/0/1]dhcp select relay     ##开启中继
[R2-GigabitEthernet0/0/1]dhcp relay server-ip 14.0.0.2  ##指向服务器地址
[R2-GigabitEthernet0/0/1]un sh
[R2-GigabitEthernet0/0/1]q  
[R2]ip route-static 0.0.0.0 0.0.0.0 12.0.0.1   ##设置默认路由
[R2]dis ip int b    ##查看接口ip信息
*down: administratively down
!down: FIB overload down
^down: standby
(l): loopback
(s): spoofing
(d): Dampening Suppressed
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 8
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 8
Interface                         IP Address/Mask      Physical   Protocol  
Ethernet0/0/0                     unassigned           down       down      
Ethernet0/0/1                     unassigned           down       down      
GigabitEthernet0/0/0              12.0.0.2/24          up         up        
GigabitEthernet0/0/1              15.0.0.1/24          up         up        
GigabitEthernet0/0/2              unassigned           down       down      
GigabitEthernet0/0/3              unassigned           down       down      
NULL0                             unassigned           up         up(s)

4,配置R4路由

[R4]dhcp enable   ##开启dhcp
[R4]int g0/0/0   ##进入接口
[R4-GigabitEthernet0/0/0]ip add 14.0.0.2 24  ##配置ip地址
[R4-GigabitEthernet0/0/0]dhcp select global   ##设置全局
[R4-GigabitEthernet0/0/0]un sh
[R4-GigabitEthernet0/0/0]q
[R4]ip route-static 0.0.0.0 0.0.0.0 14.0.0.1  ##设置默认路由
[R4]ip pool dhcp15   ##创建15网段的地址池
[R4-ip-pool-dhcp15]network 15.0.0.0 mask 24  ##设置ip地址段和子网掩码
[R4-ip-pool-dhcp15]gateway-list 15.0.0.1          ##设置网关
[R4-ip-pool-dhcp15]dns-list 8.8.8.8 2.2.2.2       ##设置dns地址
[R4-ip-pool-dhcp15]q
[R4]ip pool dhcpvlan10     ##创建vlan10的地址池
[R4-ip-pool-dhcpvlan10]network 192.168.10.0 mask 24
[R4-ip-pool-dhcpvlan10]gateway-list 192.168.10.1
[R4-ip-pool-dhcpvlan10]dns-list 8.8.8.8 2.2.2.2
[R4-ip-pool-dhcpvlan10]excluded-ip-address 192.168.10.100 192.168.10.254  ##排除的地址
[R4-ip-pool-dhcpvlan10]static-bind ip-address 192.168.10.88 mac-address 5489-9820-62fb ##设置固定ip
[R4-ip-pool-dhcpvlan10]q    
[R4]ip pool dhcpvlan20    ##创建vlan20地址池
[R4-ip-pool-dhcpvlan20]network 192.168.20.0 mask 24 
[R4-ip-pool-dhcpvlan20]gateway-list 192.168.20.1
[R4-ip-pool-dhcpvlan20]dns-list 8.8.8.8 2.2.2.2
[R4-ip-pool-dhcpvlan20]q

5,查看pc机能否获取ip地址

华为eNSP——DHCP中继配置

谢谢阅读!

相关内容

热门资讯

空调连续工作多久需要停机休息 空调连续工作的时间取决于多个因素,包括空调的型号、功率、使用环境和维护情况等。一般来说,空调可以连续...
空调哪个符号是除湿的 空调除湿功能通常用一个水滴形状的符号表示。不同品牌和型号的空调遥控器可能会有所差异,但一般来说,除湿...
格力空调多长时间加一次氟利昂 1、一般情况下,空调对氟利昂的使用量是非常小的,所以在空调使用了四年左右的时候再考虑加也没问题。2、...
空调用多长时间需要加氟一次 一般情况下是五年。当出现以下这几种情况时,空调才需要加氟。1、空调的室内机和室外机各有两个接口,当接...
格调生活·C标思享荟:卡萨帝在... 9月12日的郑州龙湖金融岛,夜风轻拂,灯光璀璨。“C标时刻共传奇——卡萨帝思享荟暨20周年品牌盛典郑...
品牌价值破千亿、高端份额持续领... 9月12日,“C标时刻共传奇——卡萨帝思享荟暨20周年品牌盛典郑州站”在郑州龙湖金融岛举办。2026...
空调主板坏了修800还是换新的 空调主板坏了是修还是换新,需要考虑多个因素,以下是一些建议:1. 维修成本:如果维修费用较低,比如 ...
空调开多久需要休息多长时间 问题:空调开多久需要休息多长时间回答:1、在使用空调的过程中,一般空调开7~8个小时左右需要休息2~...
中央空调多长时间清洗一次 1、一般空调开机前清洗一次即可,空调开机中间时段再清洗一次,空调关机时清洗一次,这样比较合理。2、空...
中央空调氟利昂多久加一次 看空调制热和制冷程度,很多人的观点认为氟利昂必须一年放一次,其实这个观点是错误的,理解上面有点偏差,...