手揣网教程/路由器百科/内容

详细说明DHCP中继设置(DHCP中继设置)

路由器百科2024-09-14 阅读


详细说明DHCP中继设置(DHCP中继设置)

组网要求:

1、Router为DHCP服务器,开启DHCP服务,为PC分配地址。使用的地址池网段为192.168.1.0/24,并且地址池中需排除掉地址192.168.1.254、192.168.1.253,因为这些地址不能分配给PC。同时为客户端分配的网关地址是192.168.1.254,所分配的地址租期为2天。客户端自动获取的DNS服务器地址为8.8.8.8。

2、SW上部署了两个VLAN:分别是vlan10及vlan20;PC属于VLAN10,Router属于VLAN20;

3、要求PC机能够通过DHCP自动获取地址及网关。

一、eNSP详解视频:

视频加载中...

二、IP设置:

PC1:自动获取IP地址,网关自动获取

PC2、自动获取IP地址

SW:vlanif10:192.168.1.254/24

Vlanif20:192.168.2.1/24

Router:192.168.2.2/24

三、配置步骤:

Router的配置如下:

[Router] interface GigabitEthernet 0/0/0

[Router-GigabitEthernet0/0/0] ip address 192.168.2.2 24

[Router] dhcp enable #全局使能DHCP服务

[Router] ip pool dhcppool #创建地址池

[Router-ip-pool-dhcppool] network 192.168.1.0 mask 24

[Router-ip-pool-dhcppool] gateway-list 192.168.1.254

[Router-ip-pool-dhcppool] lease day 2

[Router-ip-pool-dhcppool] dns-list 8.8.8.8

[Router-ip-pool-dhcppool] quit

[Router] interface GigabitEthernet 0/0/0

[Router-GigabitEthernet0/0/0] dhcp select global #使能接口的DHCP服务功能,从该接口从全局地址池分配地址

核心交换机的配置如下:

[SW] vlan batch 10 20

[SW] interface GigabitEthernet 0/0/1

[SW-GigabitEthernet0/0/1] port link-type access

[SW-GigabitEthernet0/0/1] port default vlan 10

[SW] interface GigabitEthernet 0/0/24

[SW-GigabitEthernet0/0/24] port link-type access

[SW-GigabitEthernet0/0/24] port default vlan 20

[SW]interface Vlanif 10

[SW-Vlanif10] ip address 192.168.1.254 24

[SW-Vlanif10] interface vlanif 20

[SW-Vlanif20] ip address 192.168.2.1 24

[SW-Vlanif20] quit

[SW] dhcp enable #交换机首先全局开启DHCP服务

[SW] interface Vlanif 10

[SW-Vlanif10] dhcp select relay #vlanif10使能DHCP中继

[SW-Vlanif10] dhcp relay server-ip 192.168.2.2 #配置DHCP服务器的地址

路由器上增加静态路由:

[Router] ip route-static 192.168.1.0 24 192.168.2.1

完成上述配置后,PC即可正常获取地址。


四、Router的主要配置文件:

#

sysname Router

#

dhcp enable

#

ip pool dhcppool

gateway-list 192.168.1.254

network 192.168.1.0 mask 255.255.255.0

excluded-ip-address 192.168.1.253

lease day 2 hour 0 minute 0

dns-list 8.8.8.8

#

interface GigabitEthernet0/0/0

ip address 192.168.2.2 255.255.255.0

dhcp select global

#

ip route-static 192.168.1.0 255.255.255.0 192.168.2.1

#

return

五、SW的主要配置文件:

#

sysname SW

#

vlan batch 10 20

#

dhcp enable

#

interface Vlanif1

#

interface Vlanif10

ip address 192.168.1.254 255.255.255.0

dhcp select relay

dhcp relay server-ip 192.168.2.2

#

interface Vlanif20

ip address 192.168.2.1 255.255.255.0

#

interface MEth0/0/1

#

interface GigabitEthernet0/0/1

port link-type access

port default vlan 10

#

interface GigabitEthernet0/0/24

port link-type access

port default vlan 20

#

return



六、验证结果

在PC1上使用ipconfig命令查看获取的IP地址等信息。

PC>ipconfig


Link local IPv6 address...........: fe80::5689:98ff:fe14:7494

IPv6 address......................: :: / 128

IPv6 gateway......................: ::

IPv4 address......................: 192.168.1.252

Subnet mask.......................: 255.255.255.0

Gateway...........................: 192.168.1.254

Physical address..................: 54-89-98-14-74-94

DNS server........................: 8.8.8.8

本实验是通过华为模拟器eNSP1.3.00.100版(最新版)完成。该软件还包含CE、CX、NE40E、NE5000E、NE9000E、USG6000V的设备IOS,可完成复杂网络测试,需要该模拟器的朋友,可以转发此文关注小编,私信小编【666】即可获得。

……

相关阅读