五. 验证配置结果
# 显示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
!
五、验证配置结果
# 查看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
五、验证配置结果
# 查看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的路由表。
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
!
# 配置到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
# 配置到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
!
(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
!