Dhcp中继ensp

拓扑图

<Huawei>system-view

Huawei\]sysname SW1 \[SW1\]vlan batch 10 20 \[SW1\]int e0/0/1 #配置access接口 \[SW1-Ethernet0/0/1\]port link-type access \[SW1-Ethernet0/0/1\]port default vlan 10 \[SW1-Ethernet0/0/1\]undo shut \[SW1-Ethernet0/0/1\]q \[SW1\]int e0/0/2 #配置access接口 \[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\]int e0/0/3 #配置access接口 \[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\]q \[SW1\]int e0/0/4 #配置access接口 \[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\]q \[SW1\]int g0/0/1 #配置trunk接口 \[SW1-GigabitEthernet0/0/1\]port link-type trunk \[SW1-GigabitEthernet0/0/1\]port trunk allow-pass vlan all \[SW1-GigabitEthernet0/0/1\]undo shutdown \system-view \[Huawei\]sysname R1 #开启dhcp功能 \[R1\]dhcp enable #配置第一个虚拟子接口1.1 \[R1\]int g0/0/1.1 #选择封装类型及vlan \[R1-GigabitEthernet0/0/1.1\]dot1q termination vid 10 #开启arp广播功能 \[R1-GigabitEthernet0/0/1.1\]arp broadcast enable #配置IP地址 \[R1-GigabitEthernet0/0/1.1\]ip add 192.168.10.1 24 #指向DHCP服务器 \[R1-GigabitEthernet0/0/1.1\]dhcp select relay \[R1-GigabitEthernet0/0/1.1\]dhcp relay server-ip 14.0.0.2 \[R1-GigabitEthernet0/0/1.1\]undo shutdown \[R1-GigabitEthernet0/0/1.1\]q #同理配置第二个虚拟接口1.2 \[R1\]int g0/0/1.2 \[R1-GigabitEthernet0/0/1.2\]dot1q termination vid 20 \[R1-GigabitEthernet0/0/1.2\]arp broadcast enable \[R1-GigabitEthernet0/0/1.2\]ip add 192.168.20.1 24 \[R1-GigabitEthernet0/0/1.2\]dhcp select relay \[R1-GigabitEthernet0/0/1.2\]dhcp relay server-ip 14.0.0.2 \[R1-GigabitEthernet0/0/1.2\]q #配置IP地址即可 \[R1\]int g0/0/3 \[R1-GigabitEthernet0/0/3\]ip add 14.0.0.1 24 \[R1-GigabitEthernet0/0/3\]undo shutdown \[R1-GigabitEthernet0/0/3\]q #配置IP地址即可 \[R1\]int g0/0/2 \[R1-GigabitEthernet0/0/2\]ip add 12.0.0.1 24 \[R1-GigabitEthernet0/0/2\]undo shutdown \[R1-GigabitEthernet0/0/2\]q #配置指向PC7的默认路由 \[R1\]ip route-static 0.0.0.0 0.0.0.0 12.0.0.2 \system-view \[Huawei\]sysname R2 #在全局模式下开启dhcp功能 \[R2\]dhcp enable #配置IP地址 \[R2\]int g0/0/2 \[R2-GigabitEthernet0/0/2\]ip add 12.0.0.2 24 \[R2-GigabitEthernet0/0/2\]undo shutdown \[R2-GigabitEthernet0/0/2\]q #配置IP地址、指向DHCP服务器 \[R2\]int g0/0/0 \[R2-GigabitEthernet0/0/0\]ip add 15.0.0.1 24 \sys \[Huawei\]sysname R3 #在全局模式下开启dhcp功能 \[R3\]dhcp enable #配置IP地址、宣告DHCP地址池 \[R3\]interface g0/0/3 \[R3-GigabitEthernet0/0/3\]ip add 14.0.0.2 24 #选择全局的地址池给DHCP客户端使用,而"dhcp select interface"则是选择接口的地址池给DHCP客户端使用 \[R3-GigabitEthernet0/0/3\]dhcp select global \[R3-GigabitEthernet0/0/3\]undo shutdown \[R3-GigabitEthernet0/0/3\]q #配置主机PC7的地址池(名称:pc7) \[R3\]ip pool dhcp-pc7 #设置IP地址网段 \[R3-ip-pool-dhcp-pc7\]network 15.0.0.0 mask 24 #设置网关 \[R3-ip-pool-dhcp-pc7\]gateway-list 15.0.0.1 #DNS服务器地址 \[R3-ip-pool-dhcp-pc7\]dns-list 8.8.8.8 114.114.114.114 \[R3-ip-pool-dhcp-pc7\]q #配置VLAN10的IP地址池 \[R3\]ip pool dhcp-vlan10 \[R3-ip-pool-dhcp-vlan10\]network 192.168.10.0 mask 24 \[R3-ip-pool-dhcp-vlan10\]gateway-list 192.168.10.1 \[R3-ip-pool-dhcp-vlan10\]dns-list 8.8.8.8 114.114.114.114 \[R3-ip-pool-dhcp-vlan10\]q #配置VLAN20的IP地址池 \[R3\]ip pool dhcp-vlan20 \[R3-ip-pool-dhcp-vlan20\]network 192.168.20.0 mask 24 \[R3-ip-pool-dhcp-vlan20\]gateway-list 192.168.20.1 \[R3-ip-pool-dhcp-vlan20\]dns-list 8.8.8.8 114.114.114.114 \[R3-ip-pool-dhcp-vlan20\]q #配置静态路由 \[R3\]ip route-static 192.168.10.0 24 14.0.0.1 \[R3\]ip route-static 192.168.20.0 24 14.0.0.1 \[R3\]ip route-static 15.0.0.0 24 14.0.0.1 #指向DHCP服务器 \[R2-GigabitEthernet0/0/0\]dhcp select relay \[R2-GigabitEthernet0/0/0\]dhcp relay server-ip 14.0.0.2 \[R2-GigabitEthernet0/0/0\]undo shut \[R2-GigabitEthernet0/0/0\]q #配置向左流通的静态路由 \[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 14.0.0.0 24 12.0.0.1 测试pc自动获得IP地址

相关推荐
奋斗者1号4 小时前
《Crawl4AI 爬虫工具部署配置全攻略》
网络·爬虫
courniche5 小时前
VRRP与BFD在冗余设计中的核心区别:从“备用网关”到“毫秒级故障检测”
网络·智能路由器
艾厶烤的鱼5 小时前
架构-信息安全技术基础知识
网络·架构
muxue1787 小时前
centos 7 网络配置(2):ping命令出现问题
linux·网络·centos
山猪打不过家猪9 小时前
(六)RestAPI 毛子(外部导入打卡/游标分页/Refit/Http resilience/批量提交/Quartz后台任务/Hateoas Driven)
网络·缓存
weixin1382339517910 小时前
EN18031测试,EN18031认证,EN18031报告解读
网络
JhonKI10 小时前
【Linux网络】构建与优化HTTP请求处理 - HttpRequest从理解到实现
linux·网络·http
GOATLong11 小时前
网络基础概念
linux·运维·服务器·网络·arm开发·c++
技术liul11 小时前
如何在iStoreOS DHCP中排除特定IP地址
网络·windows·tcp/ip
桃花岛主7011 小时前
NAT穿透
服务器·网络·智能路由器