锐捷网管交换机RIP 引入外部路由举例

一、组网需求
如下图,Device B通过RIP和Device A通讯,Device B通过静态路由获取10.3.3.3路由。为了Device A能够获得10.3.3.3路由信息,在Device B上将OSPF路由协议。引入外部路由的可靠性低,设置外部缺省度量值为5。

二、组网图
RIP 引入外部路由配置组网图

三、 配置要点
(1) 配置各接口的IP地址和启动单播路由协议(略)。
(2) Device B配置静态路由。
(3) Device A和Device B配置RIP基本功能(略)。
(4) Device B配置路由重分发,设置重分发路由缺省度量值。

四、 配置步骤
(1) 配置各接口的IP地址和启动单播路由协议(略)。
(2) Device B配置去往10.3.3.3/24的静态路由,下一跳为192.168.23.3。
Device B> enable
Device B# configure terminal
Device B(config)# ip route 10.3.3.3 255.255.255.0 192.168.23.3

(3) Device A和Device B配置RIP基本功能

(4) Device B配置重分发路由缺省度量值为5。
Device B(config)# router rip
Device B(config-router)# default-metric 5
(5) Device B配置重分发静态路由至RIP。
Device B(config-router)# redistribute static

五、 验证配置结果
# Device A上检查路由表,可以查到10.3.3.0/24的RIP路由,度量值为6。
Device A# show ip route rip
R 10.3.3.0/24 [120/6] via 192.168.12.2, 00:06:11, GigabitEthernet 0/1

六、 配置文件
# Device B的配置文件。
!
ip route 10.3.3.3 255.255.255.0 192.168.23.3
!
router rip
default-metric 5
redistribute static
!

锐捷网管交换机快速重路由配置举例

一、组网需求
Device A,Device B和Device C通过静态路由实现互联,Device A默认通过Device C访问Host C。以防Device A和Device C的链路故障,配置快速重路由,在链路故障时能够快速切换至备份链路。

二、 组网图
快速重路由配置组网图
三、配置要点
● 在Device A上配置到达Host C网段的静态路由,出接口下一跳指向Device C。
● 在Device A上配置静态快速重路由,备份路由出接口下一跳指向Device B。

四、 配置步骤
(1) 配置路由器IP地址。
(2) 配置静态路由,使各主机网络互通(略)。
(3) 配置路由图,设置备份路由出接口下一跳指向Device B。
Device A> enable
Device A# configure terminal
Device A(config)# route-map fast-reroute
Device A(config-route-map)# set fast-reroute backup-interface gigabitethernet 0/2 backup-nexthop 1.1.12.2

(4) 配置静态快速充路由。
Device A(config-route-map)# exit
Device A(config)# ip fast-reroute static route-map fast-reroute

五. 验证配置结果
# 显示Device A上的主备路由。
Device A# show ip route fast-reroute
Codes: C – connected, S – static, R – RIP, B – BGP
O – OSPF, IA – OSPF inter area
N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2
E1 – OSPF external type 1, E2 – OSPF external type 2
i – IS-IS, su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2
ia – IS-IS inter area, * – candidate default
Status codes: m – main entry, b – backup entry, a – active entry
Gateway of last resort is no set
S 1.1.3.0 /24 [ma] via 1.1.13.3, GigabitEthernet 0/3
[b] via 1.1.12.2, GigabitEthernet 0/2

六、配置文件
●Device A的配置文件。
!
route-map fast-reroute
set fast-reroute backup-interface gigabitethernet 0/2 backup-nexthop 1.1.12.2
!
ip fast-reroute static route-map fast-reroute
!

七、常见错误
● 接口链路没有Up。
● 未配置静态路由。
● 路由图中未设置match匹配条件,或设置错误。

锐捷网管交换机静态路由联动 BFD 配置举例

1. 组网需求
通过配置静态路由Host A和Host B实现互通,其中Device A-Device B为主链路,通过配置BFD,当主链路故障时,快速切换到Device C进行通讯。

2. 组网图
静态路由联动 BFD 配置组网图

3. 配置要点
● 在Device A、Device B和Device C上配置静态路由,指定出接口/下一跳为互联接口。
● 在Device A、Device B互联接口上配置BFD会话。
● 在Device A、Device B上配置静态路由与BDF联动,检测静态路由下一跳的连通性。

四、配置步骤
(1) 配置接口IP地址。
(2) 配置静态路由实现网络互通。
# Device A的配置。
Device A> enable
Device A# configure terminal
Device A(config)# ip route 1.1.2.0 255.0.0.0 gigabitethernet 0/1 1.1.12.2
Device A(config)# ip route 1.1.2.0 255.0.0.0 gigabitethernet 0/2 1.1.13.3 40

# Device B的配置。
Device B> enable
Device B# configure terminal
Device B(config)# ip route 1.1.1.0 255.0.0.0 gigabitethernet 0/1 1.1.12.1
Device B(config)# ip route 1.1.1.0 255.0.0.0 gigabitethernet 0/2 1.1.23.3 40

# Device C的配置。
Device C> enable
Device C# configure terminal
Device C(config)# ip route 1.1.1.0 255.0.0.0 gigabitEthernet 0/0 1.1.13.1
Device C(config)# ip route 1.1.2.0 255.0.0.0 gigabitEthernet 0/1 1.1.23.2
(3) 接口下配置BFD。
# Device A的配置。
Device A(config)# interface gigabitethernet 0/1
Device A(config-if-GigabitEthernet 0/1)# bfd interval 100 min_rx 100 multiplier 3
Device A(config-if-GigabitEthernet 0/1)# exit

# Device B的配置。
Device B(config)# interface gigabitethernet 0/1
Device B(config-if-GigabitEthernet 0/1)# bfd interval 100 min_rx 100 multiplier 3
Device B(config-if-GigabitEthernet 0/1)# exit

(4) 静态路由与BFD联动。
# Device A的配置。
Device A(config)# ip route static bfd gigabitethernet 0/1 1.1.12.2
# Device B的配置。
Device B(config)# ip route static bfd gigabitethernet 0/1 1.1.12.1

五、验证配置结果
# 查看BFD邻居状态。
Device A# show bfd neighbors
OurAddr NeighAddr LD/RD RH/RS Holdown(mult) State Int
1.1.12.1 1.1.12.2 8192/0 Up 0(3 ) Up GigabitEthernet 0/1

# 检查设查看BFD邻居状态。
Device A# show ip route static bfd
S 1.1.2.0/24 via 1.1.12.2, GigabitEthernet 0/1, BFD state is Up

六、 配置文件
● Device A的配置文件。
!
interface gigabitethernet 0/1
bfd interval 50 min_rx 50 multiplier 3
!
ip route 1.1.2.0 255.0.0.0 gigabitEthernet 0/1 1.1.12.2
ip route 1.1.2.0 255.0.0.0 gigabitEthernet 0/2 1.1.13.3 40
!
ip route static bfd gigabitEthernet 0/1 1.1.12.2
!
● Device B的配置文件。
!
interface gigabitethernet 0/1
bfd interval 50 min_rx 50 multiplier 3
!
ip route 1.1.1.0 255.0.0.0 gigabitEthernet 0/1 1.1.12.1
ip route 1.1.1.0 255.0.0.0 gigabitEthernet 0/2 1.1.23.3 40
!
ip route static bfd gigabitEthernet 0/1 1.1.12.1
!
● Device C的配置文件。
!
ip route 1.1.1.0 255.0.0.0 gigabitEthernet 0/0 1.1.13.1
ip route 1.1.2.0 255.0.0.0 gigabitEthernet 0/1 1.1.23.2
!

七、 常见错误
● 接口链路没有Up。
●接口没有配置IP地址。
● 没有配置BFD会话参数。
● 没有配置静态路由。

 

 

 

锐捷网管交换机IPv4 静态路由与 Track 联动配置举例

一、组网需求
Device A和Device B通过静态路由实现Host A 1.1.1.2和Host B 1.1.2.2的互联互通,为能够及时获悉链路可达状态,使用Track与静态路由联动功能。

二、组网图
IPv4 静态路由与 Track 联动配置组网图

三、 配置要点
● 在设备各接口上配置地址。
● 在Device A、Device B上配置静态路由,指定出接口/下一跳为互联接口
●在Device A、Device B上配置静态路由与Track联动,检测静态路由下一跳的连通性。

四、 配置步骤
(1) 配置各接口的IP地址和启动单播路由协议。
# Device A的配置。
Device A> enable
Device A# configure terminal
Device A(config)# interface gigabitethernet 0/1
Device A(config-if-GigabitEthernet 0/1)# ip address 1.1.12.1 255.255.255.0
Device A(config-if-GigabitEthernet 0/1)# exit

# Device B的配置。
Device B> enable
Device B# configure terminal
Device B(config)# interface gigabitethernet 0/1
Device B(config-if-GigabitEthernet 0/1)# ip address 1.1.12.2 255.255.255.0
Device B(config-if-GigabitEthernet 0/1)# exit

(2) 配置Track功能。
# Device A的配置。
Device A(config)# track 2 interface gigabitethernet 0/1 line-protocol
# Device B的配置。
Device B(config)# track 2 interface gigabitethernet 0/1 line-protocol

(3) 配置静态路由并与Track联动。
# Device A的配置。
Device A(config)# ip route 1.1.2.0 255.0.0.0 gigabitethernet 0/1 1.1.12.2 track 2
# Device B的配置。
Device B(config)# ip route 1.1.1.0 255.0.0.0 gigabitethernet 0/1 1.1.12.1 track 2

五、验证配置结果
# 查看Track 2统计信息。
Device A# show track 2
Track 2
Interface gigabitEthernet 0/1
The state is Up, delayed Down (5 secs remaining)
1 change, current state last: 300 secs
Delay up 0 secs, down 0 secs

# 查看IP路由联动Track信息与状态。
Device A# show ip route track-table
ip route 1.1.2.0 255.0.0.0 GigabitEthernet 0/1 1.1.12.2 track 2 up

六、 配置文件
● Device A的配置文件
!
interface gigabitethernet 0/1
ip address 1.1.12.1 255.255.255.0
!
track 2 interface gigabitethernet 0/1 line-protocol
!
ip route 1.1.2.0 255.0.0.0 gigabitEthernet 0/1 1.1.12.2 track 2
!
● Device B的配置文件
!
interface gigabitethernet 0/1
ip address 1.1.12.2 255.255.255.0
!
track 2 interface gigabitethernet 0/1 line-protocol
!
ip route 1.1.1.0 255.0.0.0 gigabitEthernet 0/1 1.1.12.1 track 2
!

七、常见错误
● 配置静态路由与Track联动,但未配置Track对象。

 

锐捷网管交换机IPv4 静态路由配置举例

一、组网需求
通过配置静态路由实现全网路由可达。

二、组网图
IPv4 静态路由配置组网图

三、配置要点
●在设备各接口上配置地址。
●在设备上配置静态路由。

四、配置步骤
(1) 配置各接口的IP地址。
# Device A的配置。
Device A> enable
Device A# configure terminal
Device A(config)# interface gigabitethernet 0/0
Device A(config-if-GigabitEthernet 0/0)# ip address 1.1.1.1 255.255.255.0
Device A(config-if-GigabitEthernet 0/0)# exit
Device A(config)# interface gigabitethernet 0/2
Device A(config-if-GigabitEthernet 0/2)# ip address 1.1.12.1 255.255.255.0
Device A(config-if-GigabitEthernet 0/2)# exit
Device A(config)# interface gigabitethernet 0/3
Device A(config-if-GigabitEthernet 0/3)# ip address 1.1.13.1 255.255.255.0
Device A(config-if-GigabitEthernet 0/3)# exit

# Device B的配置。
Device B> enable
Device B# configure terminal
Device B(config)# interface gigabitethernet 0/0
Device B(config-if-GigabitEthernet 0/0)# ip address 1.1.2.1 255.255.255.0
Device B(config-if-GigabitEthernet 0/0)# exit
Device B(config)# interface gigabitethernet 0/1
Device B(config-if-GigabitEthernet 0/1)# ip address 1.1.12.2 255.255.255.0
Device B(config-if-GigabitEthernet 0/1)# exit
Device B(config)# interface gigabitethernet 0/3
Device B(config-if-GigabitEthernet 0/3)# ip address 1.1.23.2 255.255.255.0
Device B(config-if-GigabitEthernet 0/3)# exit

# Device C的配置。
Device C> enable
Device C# configure terminal
Device C(config)# interface gigabitethernet 0/0
Device C(config-if-GigabitEthernet 0/0)# ip address 1.1.3.1 255.255.255.0
Device C(config-if-GigabitEthernet 0/0)# exit
Device C(config)# interface gigabitethernet 0/1
Device C(config-if-GigabitEthernet 0/1)# ip address 1.1.13.3 255.255.255.0
Device C(config-if-GigabitEthernet 0/1)# exit
Device C(config)# interface gigabitethernet 0/2
Device C(config-if-GigabitEthernet 0/2)# ip address 1.1.23.3 255.255.255.0
Device C(config-if-GigabitEthernet 0/2)# exit

(2) 启动IPv4静态路由功能。
# Device A的配置。
Device A(config)# ip route 1.1.2.0 255.255.255.0 gigabitethernet 0/2 1.1.12.2
Device A(config)# ip route 1.1.3.0 255.255.255.0 gigabitethernet 0/3 1.1.13.3

# Device B的配置。
Device B(config)# ip route 1.1.1.0 255.255.255.0 gigabitethernet 0/1 1.1.12.1
Device B(config)# ip route 1.1.3.0 255.255.255.0 gigabitethernet 0/3 1.1.23.3

# Device C的配置。
Device C(config)# ip route 1.1.2.0 255.255.255.0 gigabitethernet 0/2 1.1.23.2
Device C(config)# ip route 1.1.1.0 255.255.255.0 gigabitethernet 0/1 1.1.13.1

五、验证配置结果
检查设备的路由表,确认有静态路由条目。
# Device A的路由表。
Device A# show ip route
Codes: C – Connected, L – Local, S – Static
R – RIP, O – OSPF, B – BGP, I – IS-IS
N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2
E1 – OSPF external type 1, E2 – OSPF external type 2
SU – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2
IA – Inter area, * – candidate default
Gateway of last resort is no set
C 1.1.1.0/24 is directly connected, GigabitEthernet 0/0
C 1.1.1.1/32 is local host.
S 1.1.2.0/24 [1/0] via 1.1.12.2, GigabitEthernet 0/2
S 1.1.3.0/24 [1/0] via 1.1.13.3, GigabitEthernet 0/2
C 1.1.12.0/24 is directly connected, GigabitEthernet 0/2
C 1.1.12.1/32 is local host.
C 1.1.13.0/24 is directly connected, GigabitEthernet 0/3
C 1.1.13.1/32 is local host.
# Device B的路由表。
Device B# show ip route
Codes: C – Connected, L – Local, S – Static
R – RIP, O – OSPF, B – BGP, I – IS-IS
N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2
E1 – OSPF external type 1, E2 – OSPF external type 2
SU – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2
IA – Inter area, * – candidate default
Gateway of last resort is no set
S 1.1.1.0/24 [1/0] via 1.1.12.1, GigabitEthernet 0/0
C 1.1.2.0/24 is directly connected, GigabitEthernet 0/0
C 1.1.2.1/32 is local host.
S 1.1.3.0/24 [1/0] via 1.1.23.3, GigabitEthernet 0/3
C 1.1.12.0/24 is directly connected, GigabitEthernet 0/1
C 1.1.12.2/32 is local host.
C 1.1.23.0/24 is directly connected, GigabitEthernet 0/3
C 1.1.23.2/32 is local host.

# Device C的路由表。
Device C# show ip route
Codes: C – Connected, L – Local, S – Static
R – RIP, O – OSPF, B – BGP, I – IS-IS
N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2
E1 – OSPF external type 1, E2 – OSPF external type 2
SU – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2
IA – Inter area, * – candidate default
Gateway of last resort is no set
S 1.1.1.0/24 [1/0] via 1.1.13.1, GigabitEthernet 0/2
S 1.1.2.0/24 [1/0] via 1.1.23.2, GigabitEthernet 0/2
C 1.1.3.0/24 is directly connected, GigabitEthernet 0/0
C 1.1.3.1/32 is local host.
C 1.1.13.0/24 is directly connected, GigabitEthernet 0/1
C 1.1.13.3/32 is local host.
C 1.1.23.0/24 is directly connected, GigabitEthernet 0/2
C 1.1.23.3/32 is local host.

六、 配置文件
● Device A的配置文件。
!
interface gigabitethernet 0/0
ip address 1.1.1.1 255.255.255.
!
interface gigabitethernet 0/2
ip address 1.1.12.1 255.255.255.0
!
interface gigabitethernet 0/3
ip address 1.1.13.1 255.255.255.0
!
ip route 1.1.2.0 255.255.255.0 GigabitEthernet 0/2 1.1.12.2
ip route 1.1.3.0 255.255.255.0 GigabitEthernet 0/3 1.1.13.3
!
● Device B的配置文件。
!
interface gigabitethernet 0/0
ip address 1.1.2.1 255.255.255.0
!
interface gigabitethernet 0/1
ip address 1.1.12.2 255.255.255.0
!
interface gigabitethernet 0/3
ip address 1.1.23.2 255.255.255.0
!
ip route 1.1.1.0 255.255.255.0 GigabitEthernet 0/1 1.1.12.1
ip route 1.1.3.0 255.255.255.0 GigabitEthernet 0/3 1.1.23.3
!
● Device C的配置文件。
!
interface gigabitethernet 0/0
ip address 1.1.3.1 255.255.255.0
!
interface gigabitethernet 0/1
ip address 1.1.13.3 255.255.255.0
!
interface gigabitethernet 0/2
ip address 1.1.23.3 255.255.255.0
!
ip route 1.1.2.0 255.255.255.0 GigabitEthernet 0/2 1.1.23.2
ip route 1.1.1.0 255.255.255.0 GigabitEthernet 0/1 1.1.13.1
!

七、 常见错误
● 接口链路没有Up。
●接口没有配置地址。

锐捷网管交换机DHCP Snooping 基本功能配置举例

一、 组网需求
DHCP客户端用户可以通过合法DHCP服务器动态获取IP地址。

二、组网图
DHCP Snooping 基本功能配置组网图

三、配置要点
●在接入设备Device上开启DHCP Snooping功能。
●将上连口GigabitEthernet 0/1设置为TRUST口。

四、 配置步骤
# 配置Device。
Device> enable
Device# configure terminal
Device(config)# ip dhcp snooping
Device(config)# interface gigabitethernet 0/1
Device(config-if-GigabitEthernet 0/1)# ip dhcp snooping trust

五、验证配置结果
# 查看Device的DHCP Snooping配置情况,关注点为TRUST口是否正确。
Device# show ip dhcp snooping
Switch DHCP snooping status : ENABLE
DHCP snooping verify hardware address status : DISABLE
DHCP snooping database write-delay time : 0 seconds
DHCP snooping option 82 status : DISABLE
DHCP snooping Support bootp bind status : DISABLE
Interface Trusted Rate limit (pps)
———————— ——- —————-
GigabitEthernet 0/1 YES unlimited
# 查看Device生成的表项信息。
Device# show ip dhcp snooping binding
Total number of bindings: 1
NO. MACADDRESS IPADDRESS LEASE(SEC) TYPE VLAN INTERFACE
1 0013.2049.9014 172.16.1.2 86207 DHCP-Snooping 1 GigabitEthernet 0/1

六、配置文件
Device的配置文件
hostname Device
!
ip dhcp snooping
!
interface GigabitEthernet 0/1
ip dhcp snooping trust
!
end

七、 常见错误
● 没有将上连口设置为DHCP TRUST口。
●在上连口上配置了其他的接入安全选项,导致配置DHCP TRUST口失败。

锐捷网管交换机DHCP 客户端基本功能配置举例

一、组网需求
如图所示,Device A的接口GigabitEthernet 0/1通过DHCP协议,从Device B(DHCP服务器)获取IP地址和DNS服务器地址20.1.1.1/24。
DHCP 客户端基本功能配置组网图

二、 配置要点
● 开启Device A接口GigabitEthernet 0/1上的DHCP客户端功能。
● 开启Device B的DHCP服务器功能,并按要求配置地址池参数。

三、配置步骤
(1) 配置Device A
# 配置在接口GigabitEthernet 0/1上启用DHCP Client服务。
DeviceA> enable
DeviceA# configure terminal
DeviceA(config)# interface gigabitethernet 0/1
DeviceA(config-if-GigabitEthernet 0/1)# ip address dhcp

(2) 配置Device B
# 启用DHCP Server服务。
DeviceB> enable
DeviceB# configure terminal
DeviceB(config)# service dhcp

# 配置与客户端连接的接口IP地址。
DeviceB(config)# interface gigabitethernet 0/1
DeviceB(config-if-GigabitEthernet 0/1)# ip address 20.1.1.2 255.255.255.0
DeviceB(config-if-GigabitEthernet 0/1)# exit

# 配置与DNS服务器连接的接口IP地址。
DeviceB(config)# interface gigabitethernet 0/2
DeviceB(config-if-GigabitEthernet 0/2)# ip address 20.1.2.2 255.255.255.0
DeviceB(config-if-GigabitEthernet 0/2)# exit

# 配置动态地址池。
DeviceB(config)# ip dhcp pool User
DeviceB(dhcp-config)# network 20.1.1.0 255.255.255.0
DeviceB(dhcp-config)# dns-server 20.1.2.1
DeviceB(dhcp-config)# exit

# 配置排除地址。
DeviceB(config)# ip dhcp excluded-address 20.1.1.2

(3) 配置DNS Server
# 配置DNS Server的IP地址为20.1.2.1/24。

四、验证配置结果
# 在Device B上通过show dhcp lease查看接口获取IP地址信息。
DeviceB# show dhcp lease
Temp IP addr: 20.1.1.1 for peer on Interface: GigabitEthernet 0/1
Temp sub net mask: 255.255.255.0
DHCP Lease server: 20.1.1.2, state: 7 Bound
DHCP transaction id: ca811331
Lease: 14400 secs, Renewal: 7200 secs, Rebind: 12600 secs
Next timer fires after: 4916 secs
Retry count: 0 Client-ID: 0158696cc59347
# 在Device A上通过show hosts查看接口获取DNS服务器信息。
DeviceA# show hosts
Name servers are:
20.1.2.1 dynamic from DHCP
Host type Address TTL(sec)

五、 配置文件
● Device A的配置文件
hostname DeviceA
!
interface gigabitethernet 0/1
ip address dhcp
!
● Device B的配置文件
hostname DeviceB
!
service dhcp
ip dhcp excluded-address 20.1.1.2
!
interface gigabitethernet 0/1
ip address 20.1.1.2 255.255.255.0
!
interface gigabitethernet 0/2
ip address 20.1.2.2 255.255.255.0
!
ip dhcp pool User
network 20.1.1.0 255.255.255.0
dns-server 20.1.2.1
!

锐捷网管交换机DHCP按用户类分配地址配置举例

一、组网需求
如图所示,Device A作为DHCP服务器为客户端分配IP地址和其他网络配置参数;Device B作为DHCP中继在客户端与服务器之间转发DHCP报文。现要求实现:如果Device A接收到的请求报文中带有Option 82,则为该客户端分配地址范围192.1.1.200到192.1.1.254的IP地址;否则,为该客户端分配地址范围192.1.1.1到192.1.1.199的IP地址。
按用户类分配地址配置组网图

二、 配置要点
●配置Device A
○ 配置接口的IP地址。
○ 开启DHCP中继功能。
○ 开启Option82功能。

● 配置Device B
○ 配置接口的IP地址。
○ 配置从Device B到Device A的接口GigabitEthernet 0/1的路由。
○ 开启DHCP Server服务,配置地址池的参数。
○ 添加指定的用户类规则。

三、配置步骤
(1) 配置Device A
# 配置接口的IP地址。
DeviceA> enable
DeviceA# configure terminal
DeviceA(config)# interface gigabitethernet 0/1
DeviceA(config-if-GigabitEthernet 0/1)# ip address 192.1.1.1 255.255.255.0
DeviceA(config-if-GigabitEthernet 0/1)# exit
DeviceA(config)# interface gigabitethernet 0/2
DeviceA(config-if-GigabitEthernet 0/2)# ip address 172.2.2.2 255.255.255.0
DeviceA(config-if-GigabitEthernet 0/2)# exit

# 开启DHCP中继功能。
DeviceA(config)# service dhcp

# 添加DHCP服务器的地址。
DeviceA(config)# ip helper-address 172.2.2.1

# 开启Option82功能。
DeviceA(config)# ip dhcp relay information option82

(2) 配置Device B
# 配置接口的IP地址。
DeviceB> enable
DeviceB# configure terminal
DeviceB(config)# interface gigabitethernet 0/1
DeviceB(config-if-GigabitEthernet 0/1)# ip address 172.2.2.1 255.255.255.0
DeviceB(config-if-GigabitEthernet 0/1)# exit

# 配置到192.1.1.0/24网段的静态路由。
DeviceB(config)# ip route 192.1.1.0 255.255.255.0 gigabitethernet 0/1

# 启用DHCP Server功能。
DeviceB(config)# service dhcp

# 配置用户类规则。
DeviceB(config)# ip dhcp class myclass
DeviceB(config-dhcp-class)# relay agent information
DeviceB(config-dhcp-class-relayinfo)# relay-information hex 060223*

# 创建地址池并配置相关网络参数。
DeviceB(config)# ip dhcp pool pool1
DeviceB(dhcp-config)# network 192.1.1.0 255.255.255.0
DeviceB(dhcp-config)# default-router 192.1.1.1
DeviceB(dhcp-config)# dns-server 192.1.1.2

# 设置匹配用户类时分配地址网段。
DeviceB(dhcp-config)# class myclass
DeviceB(config-dhcp-pool-class)# address range 192.1.1.200 192.1.1.254
DeviceB(config-dhcp-pool-class)# exit

(3) 配置Host启动DHCP获取地址的功能。

四、验证配置结果
在Device B捕获报文,查看匹配用户类规则的终端申请到的IP地址范围为192.1.1.200~192.1.1.254;不匹配时,申请到的IP地址范围为192.1.1.1~192.1.1.199。

五、配置文件
●Device A的配置文件
hostname DeviceA
!
service dhcp
ip helper-address 172.2.2.1
ip dhcp relay information option82
!

interface gigabitethernet 0/1
ip address 192.1.1.1 255.255.255.0
exit
interface gigabitethernet 0/2
ip address 172.2.2.2 255.255.255.0
!
● Device B的配置文件
hostname DeviceB
!
ip route 192.1.1.0 255.255.255.0 gigabitethernet 0/1
service dhcp
!
interface gigabitethernet 0/1
ip address 172.2.2.1 255.255.255.0
!
ip dhcp class myclass
relay agent information
relay-information hex 060223*
!
ip dhcp pool pool1
network 192.1.1.0 255.255.255.0
default-router 192.1.1.1
dns-server 192.1.1.2
class myclass
address range 192.1.1.200 192.1.1.254
!

六、常见错误
● 没有启动DHCP Relay功能。
●没有配置DHCP Relay与DHCP Server之间的路由。
●没有配置DHCP 服务器IP地址。

锐捷网管交换机DHCP中继配置举例

一、 组网需求
如图所示,DHCP客户端Host所在网段为192.1.1.0/24,Device A为网关设备,Device B为DHCP服务器。DHCP客户端要想向DHCP服务器申请到IP地址等相关配置信息,需要将网关作为DHCP中继,使得DHCP报文能够被中继转发给DHCP服务器。
DHCP 中继配置组网图

二、 配置要点
● 配置Device A。
○配置接口的IP地址。
○开启DHCP中继功能。

●配置Device B。
○ 配置接口的IP地址。
○ 配置从Device B到Device A的接口GigabitEthernet 0/1的路由。
○ 开启DHCP Server服务,配置地址池的参数。

三、配置步骤
(1) 配置Device A
# 配置接口的IP地址。
DeviceA> enable
DeviceA# configure terminal
DeviceA(config)# interface gigabitethernet 0/1
DeviceA(config-if-GigabitEthernet 0/1)# ip address 192.1.1.1 255.255.255.0
DeviceA(config-if-GigabitEthernet 0/1)# exit
DeviceA(config)# interface gigabitethernet 0/2
DeviceA(config-if-GigabitEthernet 0/2)# ip address 172.2.2.2 255.255.255.0
DeviceA(config-if-GigabitEthernet 0/2)# exit

# 开启DHCP中继功能。
DeviceA(config)# service dhcp

# 添加DHCP服务器的地址。
DeviceA(config)# ip helper-address 172.2.2.1

(2) 配置Device B
# 配置接口的IP地址。
DeviceB> enable
DeviceB# configure terminal
DeviceB(config)# interface gigabitethernet 0/1
DeviceB(config-if-GigabitEthernet 0/1)# ip address 172.2.2.1 255.255.255.0
DeviceB(config-if-GigabitEthernet 0/1)# exit

# 配置到192.1.1.0/24网段的静态路由。
DeviceB(config)# ip route 192.1.1.0 255.255.255.0 gigabitethernet 0/1

# 启用DHCP Server功能。
DeviceB(config)# service dhcp

# 配置地址池pool1的网络参数。
DeviceB(config)# ip dhcp pool pool1
DeviceB(dhcp-config)# network 192.1.1.0 255.255.255.0
DeviceB(dhcp-config)# default-router 192.1.1.1
DeviceB(dhcp-config)# dns-server 192.1.1.2
DeviceB(dhcp-config)# exit

(3) 配置Host启动DHCP获取地址的功能。

5. 验证配置结果
# Host申请到192.1.1.0/24网段的地址。
# 在Device B通过show ip dhcp pool命令查看地址池配置及使用情况。
DeviceB(config)# show ip dhcp pool
Pool name Total Distributed Remained Percentage
———— ———– ———– ——– ———–
pool1 126 1 125 0.99206

四、 配置文件
● Device A的配置文件
hostname DeviceA
!
interface gigabitethernet 0/1
ip address 192.1.1.1 255.255.255.0
!
interface gigabitethernet 0/2
!
service dhcp
ip helper-address 172.2.2.1
!

● Device B的配置文件
hostname DeviceB
!
interface gigabitethernet 0/1
ip address 172.2.2.1 255.255.255.0
!
ip route 192.1.1.0 255.255.255.0 gigabitethernet 0/1
service dhcp
!
ip dhcp pool pool1
network 192.1.1.0 255.255.255.0
default-router 192.1.1.1
dns-server 192.1.1.2
!

六、常见错误
●DHCP中继没有启动DHCP Relay功能。
●没有配置DHCP Relay与DHCP Service之间的路由。
● 在DHCP中继上没有配置DHCP服务器IP地址。

锐捷网管交换机DHCP动态分配地址配置举例

一、组网需求
如图所示,Device A作为DHCP服务器为同一网段中的客户端动态分配IP地址,地址池分为两个网段:192.1.1.0/25和192.1.1.128/25。
网段192.1.1.0/25内的IP地址租用期限为5天,域名后缀名为test.com,DNS服务器地址为192.1.1.130,网关地址为192.1.1.1;网段10.1.1.128/25内的IP地址租用期限为3天,域名后缀名为test.com,DNS服务器地址为192.1.1.130,网关地址为192.1.1.129。
动态分配地址配置组网图

二、配置要点
配置Device A:
●配置接口的IP地址。
●开启DHCP Server服务,配置2个地址池的参数。

三、 配置步骤
(1) 配置Device A
# 配置接口的IP地址。
DeviceA> enable
DeviceA # configure terminal
DeviceA(config)# interface gigabitethernet 0/1
DeviceA(config-if-GigabitEthernet 0/1)# ip address 192.1.1.1 255.255.255.128
DeviceA(config-if-GigabitEthernet 0/1)# exit
DeviceA(config)# interface gigabitethernet 0/2
DeviceA(config-if-GigabitEthernet 0/2)# ip address 192.1.1.129 255.255.255.128
DeviceA(config-if-GigabitEthernet 0/2)# exit

# 启用DHCP Server服务。
DeviceA(config)# service dhcp

# 配置地址池pool1的网络参数。
DeviceA(config)# ip dhcp pool pool1
DeviceA(dhcp-config)# network 192.1.1.0 255.255.255.128
DeviceA(dhcp-config)# default-router 192.1.1.1
DeviceA(dhcp-config)# dns-server 192.1.1.130
DeviceA(dhcp-config)# domain-name test.com
DeviceA(dhcp-config)# lease 5
DeviceA(dhcp-config)# exit

# 配置地址池pool2的网络参数。
DeviceA(config)# ip dhcp pool pool2
DeviceA(dhcp-config)# network 192.1.1.128 255.255.255.128
DeviceA(dhcp-config)# default-router 192.1.1.129
DeviceA(dhcp-config)# dns-server 192.1.1.130
DeviceA(dhcp-config)# domain-name test.com
DeviceA(dhcp-config)# lease 3

(2) 配置DNS Server
# 配置DNS Server的IP地址为192.1.1.130/25。

(3) 配置Host
# 配置Host A、Host B、Host C启动DHCP获取地址的功能。

四、验证配置结果
# Host A和Host B申请到192.1.1.0/25网段的地址。
# Host C申请到192.1.1.128/25网段的地址。
# 在Device A通过show ip dhcp pool命令查看地址池配置及使用情况。
DeviceA(config)# show ip dhcp pool
Pool name Total Distributed Remained Percentage
———— ———– ———– ——– ———–
pool1 126 2 124 0.98413
pool2 126 1 125 0.99206

五、 配置文件
Device A的配置文件
hostname DeviceA
!

interface gigabitethernet 0/1
ip address 192.1.1.1 255.255.255.128
!
interface gigabitethernet 0/2
ip address 192.1.1.129 255.255.255.128
!
service dhcp
!
ip dhcp pool pool1
network 192.1.1.0 255.255.255.128
default-router 192.1.1.1
dns-server 192.1.1.130
domain-name test.com
lease 5
!
ip dhcp pool pool2
network 192.1.1.128 255.255.255.128
default-router 192.1.1.129
dns-server 192.1.1.130
domain-name test.com
lease 3
!

六、 常见错误
●未配置地址池。
●未开启DHCP Server服务。

ICP备案号:晋ICP备18007549号-1
站长微信:13613567205