DHCP中继代理[HuaweieNSP]
DHCPRelay(DHCPR)DHCP中继 也叫做DHCP中继代理,如果DHCP客户机与DHCP服务器在同一个物理网段,则客户机可以正确地获得动态分配的ip地址。如果不在同一个物理网段,则需要DHCP Relay Agent(中继代理)。用DHCP Relay代理可以去掉在每个物理的网段都要有DHCP服务器的必要,它可以传递消息到不在同一个物理子网的DHCP服务器,也可以将服务器的消息传回给不在同一个物理子网的DHCP客户机。
为福田等地区用户提供了全套网页设计制作服务,及福田网站建设行业解决方案。主营业务为网站设计、网站制作、福田网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!
实验需求:
C1、C2、C3属于不同的VLAN,分别是VLAN10,20,30;
三层交换实现PC间互通,并通过dhcp中继代理在R2获取IP地址;
R2开启dhcp服务为PC分配IP地址;
实验步骤:
实验所用 :HUAWEI eNsp
1.LSW2交换机 批量添加VLAN 10,20 配置 Ethernet 0/0/3 VLAN 10 让PC1属于VLAN10; 配置Ethernet 0/0/4 PC2属于VLAN20 配置Ethernet 0/0/2 中继TRUNK口;
Enter system view, return user view with Ctrl+Z.
[Huawei]vlan bat 10 20 //批量添加VLAN10,20;
Info: This operation may take a few seconds. Please wait for a moment...done.
Mar 31 2016 19:12:26-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is 4, th
e change loop count is 0, and the maximum number of records is 4095.
[Huawei]int e0/0/3 //进GigabitEthernet0/0/3物理接口;
[Huawei-Ethernet0/0/3]port link-type access //设置为访问口;
[Huawei-Ethernet0/0/3]port default vlan 10 //添加为VLAN10;
[Huawei-Ethernet0/0/3]int e0/0/4 //进GigabitEthernet0/0/4物理接口;
[Huawei-Ethernet0/0/4]port link-type access //设置为访问口;
[Huawei-Ethernet0/0/4]port default vlan 20 //添加为VLAN20;
[Huawei-Ethernet0/0/4]int e0/0/2 //进GigabitEthernet0/0/2物理接口;
[Huawei-Ethernet0/0/2]port link-type trunk //设置为中继TRUNK口;
[Huawei-Ethernet0/0/2]port trunk allow-pass vlan 10 20 //允许VLAN10,20成员的流量通过;
2.LSW1批量添加VLAN10,20 配置VLAN10,20,30 IP地址为PC的网关地址及子网掩码 添加VLAN100 为GigabitEthernet0/0/1 设置IP地址实现上口互联 设置静态路由所有IP地址转发到10.0.0.2 开启dhcp功能并设置dhcp中继;
[Huawei]vlan bat 10 20 //批量添加VLAN10,20;
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]int vlan 10 //进VLAN10接口;
[Huawei-Vlanif10]ip add 192.168.1.1 24 //配置IP地址及子网掩码;
[Huawei-Vlanif10]q
[Huawei]int vlan 20 //进VLAN20接口;
[Huawei-Vlanif20]
Mar 31 2016 19:18:31-08:00 Huawei %%01IFNET/4/IF_STATE(l)[3]:Interface Vlanif20
has turned into UP state.
[Huawei-Vlanif20]ip add 192.168.2.1 24 //配置IP地址、子网掩码;
[Huawei-Vlanif20]q
[Huawei]int vlan 30 //进VLAN30接口;
[Huawei-Vlanif30]
Mar 31 2016 19:18:48-08:00 Huawei %%01IFNET/4/IF_STATE(l)[5]:Interface Vlanif30
has turned into UP state.
[Huawei-Vlanif30]ip add 192.168.3.1 24 //配置IP地址、子网掩码;
[Huawei-Vlanif30]
Mar 31 2016 19:18:55-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[6]:The line protocol
IP on the interface Vlanif30 has entered the UP state.
[Huawei]vlan 100 //创建VLAN100;
[Huawei-vlan100]int vlan 100 //进VLAN100接口;
[Huawei-Vlanif100]ip add 10.0.0.1 24 //配置IP地址及子网掩码;
[Huawei]int g0/0/1 //进GigabitEthernet0/0/1物理接口;
[Huawei-GigabitEthernet0/0/1]port link-type access //设置接口类型为访问口;
[Huawei-GigabitEthernet0/0/1]port default vlan 100 //添加进VLAN100;
[Huawei-GigabitEthernet0/0/1]q
[Huawei]ip route-static 0.0.0.0 0.0.0.0 10.0.0.2 //配置静态路由;
[Huawei]q
PING 12.0.0.3: 56 data bytes, press CTRL_C to break
Request time out
Reply from 12.0.0.3: bytes=56 Sequence=2 ttl=254 time=130 ms
Reply from 12.0.0.3: bytes=56 Sequence=3 ttl=254 time=40 ms
Reply from 12.0.0.3: bytes=56 Sequence=4 ttl=254 time=20 ms
Reply from 12.0.0.3: bytes=56 Sequence=5 ttl=254 time=60 ms
[Huawei]dhcp enable //开启dhcp服务;
Info: The operation may take a few seconds. Please wait for a moment.done.
[Huawei]int vlan 10 //进VLAN10接口;
[Huawei-Vlanif10]dhcp select relay //配置dhcp中继;
[Huawei-Vlanif10]dhcp relay server-ip 12.0.0.3 //设置dhcp中继服务端地址;
[Huawei-Vlanif10]int vlan 20 //进VLAN20接口;
[Huawei-Vlanif20]dhcp select relay //配置dhcp中继;
[Huawei-Vlanif20]dhcp relay server-ip 12.0.0.3 //设置dhcp中继服务端地址;
[Huawei-Vlanif20]int vlan 30 //进VLAN30接口;
[Huawei-Vlanif30]dhcp select relay //配置dhcp中继;
[Huawei-Vlanif30]dhcp relay server-ip 12.0.0.3 //设置dhcp中继服务端地址;
3.路由器AR1配置GigabitEthernet0/0/1 、GigabitEthernet0/0/0 IP地址 设置静态路由实现网络互通;
Enter system view, return user view with Ctrl+Z.
[Huawei]int g0/0/1 //进物理接口GigabitEthernet0/0/1;
[Huawei-GigabitEthernet0/0/1]ip add 10.0.0.2 24 //配置IP地址及子网掩码;
Mar 31 2016 19:19:58-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[0]:The line protocol
IP on the interface GigabitEthernet0/0/1 has entered the UP state.
[Huawei]int g0/0/0 //进接口GigabitEthernet0/0/0;
[Huawei-GigabitEthernet0/0/0]ip add 12.0.0.2 24 //配置IP地址及子网掩码;
[Huawei-GigabitEthernet0/0/0]q
[Huawei]ip route-static 0.0.0.0 0.0.0.0 12.0.0.3 //配置静态路由;
[Huawei]ip route-static 192.168.1.0 255.255.255.0 10.0.0.1
[Huawei]ip route-static 192.168.2.0 255.255.255.0 10.0.0.1
[Huawei]ip route-static 192.168.3.0 255.255.255.0 10.0.0.1
4.路由器AR2配置GigabitEthernet0/0/0 IP地址 配置v10、v20、v30 dhcp服务端为PC分配IP地址、网关、DNS 配置静态路由实现网络互通 进接口GigabitEthernet0/0/0选择全局的地址池给DHCP客户端使用;
Enter system view, return user view with Ctrl+Z.
[Huawei]int g0/0/0 //进物理接口GigabitEthernet0/0/0;
[Huawei-GigabitEthernet0/0/0]ip add 12.0.0.3 24 //配置IP地址及子网掩码;
Mar 31 2016 19:21:30-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[0]:The line protocol
IP on the interface GigabitEthernet0/0/0 has entered the UP state.
[Huawei-GigabitEthernet0/0/0]q //退出;
[Huawei]ip pool v10 //建立v10地址池;
Info: It's successful to create an IP address pool.
[Huawei-ip-pool-v10]network 192.168.1.0 mask 24 //网络段及子网掩码;
[Huawei-ip-pool-v10]gateway-list 192.168.1.1 //网关地址;
[Huawei-ip-pool-v10]dns-list 2.2.2.2 4.4.4.4 //DNS地址;
[Huawei-ip-pool-v10]q
[Huawei]ip pool v20 //建立v20地址池;
Info: It's successful to create an IP address pool.
[Huawei-ip-pool-v20]network 192.168.2.0 mask 24 //网络段及子网掩码;
[Huawei-ip-pool-v20]gateway-list 192.168.2.1 //网关地址;
[Huawei-ip-pool-v20]dns-list 2.2.2.2 // DNS地址;
[Huawei-ip-pool-v20]q
[Huawei]ip pool v30 //建立v30地址池;
Info: It's successful to create an IP address pool.
[Huawei-ip-pool-v30]network 192.168.3.0 mask 24 //网络段及子网掩码;
[Huawei-ip-pool-v30]gateway-list 192.168.3.1 //网关地址;
[Huawei-ip-pool-v30]dns-list 2.2.2.2 // DNS地址;
[Huawei-ip-pool-v30]q
[Huawei]ip route-static 0.0.0.0 0.0.0.0 12.0.0.2 //设置静态路由;
[Huawei]dhcp enable //开启dhcp功能;
Info: The operation may take a few seconds. Please wait for a moment.done.
[Huawei]int g0/0/0 //进物理接口GigabitEthernet0/0/0;
[Huawei-GigabitEthernet0/0/0]dhcp select global //dhcp选择全局地址池;
5.测试PC正常获取IP地址、子网掩码、DNS等信息 测试全网互通;
PC>ipconfig //PC1获取IP地址、子网掩码、DNS等信息;
Link local IPv6 address...........: fe80::5689:98ff:fe2e:78f6
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.1.254
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.1.1
Physical address..................: 54-89-98-2E-78-F6
DNS server........................: 2.2.2.2
4.4.4.4
PC>ipconfig //PC2获取IP地址、子网掩码、DNS等信息;
Link local IPv6 address...........: fe80::5689:98ff:fe5b:5969
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.2.254
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.2.1
Physical address..................: 54-89-98-5B-59-69
DNS server........................: 2.2.2.2
PC>ipconfig //PC3获取IP地址、子网掩码、DNS等信息;
Link local IPv6 address...........: fe80::5689:98ff:fef1:2fe4
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.3.254
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.3.1
Physical address..................: 54-89-98-F1-2F-E4
DNS server........................: 2.2.2.2
PC>ping 192.168.3.254 //测试PC1、PC3连通性;
Ping 192.168.3.254: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.3.254: bytes=32 seq=2 ttl=127 time=78 ms
From 192.168.3.254: bytes=32 seq=3 ttl=127 time=78 ms
From 192.168.3.254: bytes=32 seq=4 ttl=127 time=47 ms
PC>ping 12.0.0.3 //测试PC1、AR2连通性;
Ping 12.0.0.3: 32 data bytes, Press Ctrl_C to break
From 12.0.0.3: bytes=32 seq=1 ttl=253 time=32 ms
From 12.0.0.3: bytes=32 seq=2 ttl=253 time=32 ms
新闻标题:DHCP中继代理[HuaweieNSP]
当前URL:http://azwzsj.com/article/ppsedd.html