Routing Configuration for Huawei AR Routers
Routing Configuration for Huawei AR Routers
8 Deploying Routing
Applicability
This example applies to all models of AR routers in all versions.
Networking Requirements
In Figure 8-1, users on an enterprise network are divided into different subnets
and these users need to communicate with each other. The enterprise network is
not large in scale and requires simple, secure, reliable, and efficient traffic
forwarding. In this case, static routes can be configured to enable any two hosts
on the network to communicate with each other.
Before configuring IPv4 static routes, configure link layer protocol parameters and
IP addresses for interfaces to ensure that neighboring nodes are reachable at the
network layer.
Procedure
Step 1 Configure RouterA.
#
interface GigabitEthernet1/0/0
ip address [Link] [Link]
#
interface GigabitEthernet2/0/0
ip address [Link] [Link]
#
ip route-static [Link] [Link] [Link] ip route-static [Link] [Link]
[Link] //Configure static routes on RouterA.
#
return
Configuration Notes
● Configure IPv4 addresses for routers' interfaces correctly.
● Configure IP addresses on the same network segment for the interfaces
connecting two routers together.
● Configure IPv4 default gateways for hosts.
Networking Requirements
NQA for static IPv4 routes can quickly detect network faults and control
advertisement of static routes. As shown in Figure 8-2, RouterA connects to
RouterB through GE2/0/0 and connects to RouterC through GE1/0/0. Two links are
available from RouterA to RouterD: RouterA-->RouterB-->RouterD (primary link)
and RouterA-->RouterC-->RouterD (backup link). Configure an NQA ICMP test
instance on RouterA to detect the active link. When the active link becomes faulty,
packets sent from RouterA to RouterD are switched to the standby link.
Figure 8-2 Networking diagram of configuring NQA for static IPv4 routes
Procedure
Step 1 Configure RouterA.
#
sysname RouterA
#
interface GigabitEthernet1/0/0
ip address [Link] [Link]
#
interface GigabitEthernet2/0/0
ip address [Link] [Link]
#
interface GigabitEthernet3/0/0
ip address [Link] [Link]
#
ip route-static [Link] [Link] [Link]
ip route-static [Link] [Link] [Link]
ip route-static [Link] [Link] [Link] preference 100 //Set the preference of static
routes to 100 so that the static routes can be used as backup routes.
ip route-static [Link] [Link] GigabitEthernet2/0/0 [Link] track nqa admin icmp //
Configure a static route to associate it with an NQA test instance.
#
nqa test-instance admin icmp //Configure an NQA test instance named admin icmp.
test-type icmp //Set the test type to ICMP.
destination-address ipv4 [Link] //Set the destination address of the NQA test instance to
[Link].
frequency 10 //Set the interval between two NQA tests to 10s.
probe-count 2 //Set the number of test probes of an NQA test instance to 2.
start now //Start the NQA test instance immediately.
#
# Run the display nqa results test-instance admin icmp command on RouterA
to view the NQA test result. The command output displays "Lost packet ratio:
0 %", indicating that the link status is normal. Run the display ip routing-table
command on RouterA to view the IP routing table. The routing table contains the
static route with destination network segment [Link]/24 and next-hop
address [Link]. There is no static route with preference 100 in the routing
table.
----End
Configuration Notes
● The static route associated with an NQA test instance is deleted from the
routing table only when the NQA test fails. You can run the display nqa
results command to view the NQA test result.
● Before modifying the configuration of an NQA test instance, stop the NQA
test instance.
● If the static route associated with one NQA test instance is associated with
another NQA test instance, the association between the static route and the
former NQA test instance is removed.
● Only the NQA ping test instance is used so that RouterA switches services
based on the test result. There is no requirement for the peer device
configuration.
Networking Requirements
Figure 8-3 shows the IPv6 addresses and masks of hosts and routers' interfaces.
Static routes need to be configured to ensure that any two hosts can
communicate with each other.
Procedure
Step 1 Configure RouterA.
#
ipv6 //Enable IPv6 forwarding.
#
interface GigabitEthernet1/0/0
ipv6 enable //Enable IPv6 on the interface.
ipv6 address 1::1 64
#
interface GigabitEthernet2/0/0
ipv6 enable
ipv6 address 2::2 64
#
ipv6 route-static 3:: 64 2::1
ipv6 route-static 4:: 64 2::1
ipv6 route-static 5:: 64 2::1 //Configure static routes on RouterA.
#
return
#
interface GigabitEthernet1/0/0
ipv6 enable
ipv6 address 3::1 64
#
interface GigabitEthernet2/0/0
ipv6 enable
ipv6 address 2::1 64
#
interface GigabitEthernet3/0/0
ipv6 enable
ipv6 address 4::1 64
#
ipv6 route-static 1:: 64 2::2
ipv6 route-static 5:: 64 4::2
#
return
Set the default gateway of hosts in VLAN 10 to 1::1, default gateway of hosts in
VLAN 20 to 5::1, and default gateway of VLAN 30 to 3::1.
# Run the display ipv6 routing-table command to view the IP routing table.
----End
Configuration Notes
● Before configuring an IPv6 routing protocol, enable IPv6 unicast forwarding
on routers. Before configuring IPv6 features on an interface, enable IPv6 on
the interface.
● Configure IPv6 addresses for routers' interfaces correctly.
● Configure default gateways for hosts.
Applicability
This example applies to all models of AR routers in all versions.
Networking Requirements
On a company's internal network shown in Figure 8-4, there are two forwarding
paths from Router_1 and Router_2 and with next hops Router_2 and Router_3
respectively. Router_1 and Router_2 are far from each other, and the L2 Switch
acts as the relay agent between Router_1 and Router_2. In this example, Router_2
does not support bidirectional forwarding detection (BFD). BFD for IPv4 static
routes needs to be configured on Router_1 to ensure that Router_1 can fast detect
the failure (for example the Down state) of the link between Router_2 and the L2
Switch and switch traffic to the link of Router_3.
Figure 8-4 Networking diagram of configuring BFD for IPv4 static routes
GE2/0/2 [Link]/24
GE2/0/3 [Link]/24
GE2/0/2 [Link]/24
GE2/0/3 [Link]/24
GE2/0/2 [Link]/24
Procedure
Step 1 Configure Router_1.
#
sysname Router_1
#
bfd
#
interface GigabitEthernet2/0/1 //Configure an IP address for GigabitEthernet2/0/1 on Router_1.
ip address [Link] [Link]
#
interface GigabitEthernet2/0/2
ip address [Link] [Link]
#
interface GigabitEthernet2/0/3
ip address [Link] [Link]
#
bfd aa bind peer-ip [Link] interface GigabitEthernet0/0/1 one-arm-echo //Configure the BFD
session between Router_1 and Router_2.
discriminator local 1
min-echo-rx-interval 100
commit
#
ip route-static [Link] 24 GigabitEthernet2/0/1 [Link] track bfd-session aa //Configure a static
route from Router_1 to [Link]/24. Ensure that traffic from Router_1 to Router_2 is first forwarded along
the link Router_1 –> L2 Switch –> Router_2. When the link fails, the traffic is switched to the link Router_1 –
> Router_3 –> Router_2.
ip route-static [Link] 24 GigabitEthernet2/0/2 [Link] preference 65
#
return
Networking Requirements
Figure 8-5 shows IP addresses and masks of hosts and routers' interfaces. Static
routes need to be configured to ensure that any two hosts can communicate with
each other.
Procedure
Step 1 Configure the switch.
#
vlan batch 10 20 100
#
interface vlanif 10
ip address [Link] [Link]
#
interface vlanif 20
ip address [Link] [Link]
#
interface vlanif 100
ip address [Link] [Link]
#
interface gigabitEthernet0/0/1
port link-type access
port default vlan 100 //Add GigabitEthernet0/0/1 to VLAN 100 as an access interface. This interface
connects to the router.
#
interface gigabitEthernet0/0/2
port link-type access
port default vlan 10
#
interface gigabitEthernet0/0/3
port link-type access
port default vlan 20
#
ip route-static [Link] [Link] [Link] //Configure a default static route.
#
return
# Run the display ip routing-table command to view the IP routing table of the
Router.
----End
Configuration Notes
● Configure IPv4 addresses for routers' interfaces correctly.
● Configure IPv4 default gateways for hosts.
Networking Requirements
To ensure network stability and reliability, you can configure fixed IP addresses for
two outbound interfaces in routes. If a route is unreachable, users can still access
the Internet through the other backup route. The active and standby links are
identified based on the priorities of static routes.
Figure 8-6 Configuring fixed IP addresses for two outbound interfaces in IPv4
static routes
Procedure
Step 1 Configure the Router.
#
sysname Router //Change the device name.
#
acl number 2000
rule 5 permit
#
acl number 2001
rule 5 permit
#
interface gigabitethernet 1/0/0
ip address [Link] 24 //Configure the external network interface 1.
nat outbound 2000
#
interface gigabitethernet 2/0/0
ip address [Link] 24 //Configure the external network interface 2.
nat outbound 2001
#
interface gigabitethernet 3/0/0
ip address [Link] 24 //Configure the internal network interface 3.
#
ip route-static [Link] [Link] [Link]
ip route-static [Link] [Link] [Link]
#
# Run the display ip routing-table command to view the IP routing table of the
Router.
----End
Configuration Notes
● Configure an ACL to determine for which network segments NAT needs to be
performed.
● Configure NAT in the outbound interface view.
8.2 RIP
Applicability
This example applies to all models of AR routers in all versions.
Networking Requirements
RIP needs to be configured to ensure that two hosts can communicate with each
other. Figure 8-7 shows the IP addresses and masks of hosts and routers'
interfaces.
Procedure
Step 1 Configure RouterA.
#
interface GigabitEthernet1/0/0
ip address [Link] [Link]
#
interface GigabitEthernet2/0/0
ip address [Link] [Link]
#
rip 1
version 2 //Set the RIP version.
network [Link] //Enable RIP on the specified network segment.
network [Link]
#
return
Set the default gateway of hosts in VLAN 10 to [Link] and the default
gateway of hosts in VLAN 20 to [Link].
# Run the display rip process-id route command to view the RIP routing table.
The RIP routing table shows that the routes advertised by RIPv2 contain accurate
subnet masks.
----End
Configuration Notes
● Configure IPv4 addresses for routers' interfaces correctly.
● Configure IP addresses on the same network segment for interfaces
connecting two routers together.
● Configure IPv4 default gateways for hosts.
● Enable RIP on a natural network segment.
Applicability
This example applies to all models of AR routers in all versions.
Networking Requirements
In Figure 8-8, a company uses a L2 Switch as a relay agent to connect two
departments that are far from each other. Router_1, Router_2, and Router_3 run
Routing Information Protocol (RIP) and establish RIP neighbor relationships to
ensure that they are reachable at the network layer.
Router_3 does not support bidirectional forwarding detection (BFD). The company
wants to configure BFD for RIP on Router_1 and use BFD echo packets to ensure
that BFD can fast detect and notify RIP of the link failure between Router_1 (or
Router_3) and the L2 Switch.
The company wants to configure BFD for RIP on Router_1 and Router_3 to meet
the following requirements:
● Detect the link that passes through the L2 Switch.
● Ensure that the devices can fast detect and notify RIP of the link failure and
switch traffic to the link of Router_2.
GE2/0/2 [Link]/24
GE2/0/3 [Link]/24
GE2/0/2 [Link]/24
GE2/0/2 [Link]/24
GE2/0/3 [Link]/24
Procedure
Step 1 Configure Router_1.
#
sysname Router_1
#
bfd
#
interface GigabitEthernet2/0/1
ip address [Link] [Link]
rip bfd static
#
interface GigabitEthernet2/0/2
ip address [Link] [Link]
#
interface GigabitEthernet2/0/3
ip address [Link] [Link]
#
rip 1 //Configure basic RIP functions on Router_1.
version 2
network [Link]
#
bfd 1 bind peer-ip [Link] interface GigabitEthernet2/0/1 one-arm-echo //Configure the BFD echo
function on Router_1.
discriminator local 1
min-echo-rx-interval 200
commit
#
return
#
return
interface GigabitEthernet2/0/1
ip address [Link] [Link]
#
interface GigabitEthernet2/0/2
ip address [Link] [Link]
#
interface GigabitEthernet2/0/3
ip address [Link] [Link]
#
rip 1 //Configure basic RIP functions on Router_3.
version 2
network [Link]
#
return
----End
8.3 RIPng
Networking Requirements
RIPng needs to be configured to ensure that two hosts can communicate with
each other. Figure 8-9 shows the IPv6 addresses and masks of hosts and routers'
interfaces.
Procedure
Step 1 Configure RouterA.
#
ipv6 //Enable IPv6 forwarding.
#
interface GigabitEthernet1/0/0
ipv6 enable //Enable IPv6 on the interface.
ipv6 address 1::1 64
ripng 1 enable //Enable RIPng on the specified interface.
#
interface GigabitEthernet2/0/0
ipv6 enable
ipv6 address 2::2 64
ripng 1 enable
#
ripng 1 //Enable RIPng process 1.
#
return
Set the default gateway of hosts in VLAN 10 to 1::1 and the default gateway of
hosts in VLAN 20 to 3::1.
Step 4 Configure switches.
Configure switches to allow hosts to communicate with their respective gateways.
Step 5 Verify the configuration.
# Run the display ripng process-id route command to view the RIPng routing
table. The RIPng routing table contains the routes advertised by RIPng.
# Run the ping ipv6 command to verify the router connectivity.
----End
Configuration Notes
● Before configuring an IPv6 routing protocol, enable IPv6 unicast forwarding
on routers. Before configuring IPv6 features on an interface, enable IPv6 on
the interface.
● Configure IPv6 addresses for routers' interfaces.
● Configure IP addresses on the same network segment for interfaces
connecting two routers together.
● Configure default gateways for hosts.
8.4 OSPF
Networking Requirements
An enterprise does not want to spend a large amount of manpower to maintain
network performance, and requires that new routes be calculated based on route
update packets. In this case, OSPF can be deployed to ensure network stability and
interconnection.
Before configuring basic OSPF functions, configure IP addresses for interfaces to
ensure that neighboring nodes are reachable at the network layer.
Procedure
Step 1 Configure RouterA.
#
sysname RouterA
#
router id [Link] //Set the router ID. You are advised to set the IP address of Loopback0 as the router ID.
#
vlan batch 10
#
interface Vlanif10
ip address [Link] [Link]
#
interface Ethernet2/0/0
port link-type trunk
port trunk allow-pass vlan 10
#
interface GigabitEthernet3/0/0
ip address [Link] [Link]
#
interface LoopBack0
ip address [Link] [Link]
#
ospf 2
area [Link]
network [Link] [Link] //Specify the network segment where the interface running OSPF process
2 as [Link]/24 and the area to which the interface belongs as Area 0.
network [Link] [Link]
#
#
interface Ethernet2/0/0
port link-type trunk
port trunk allow-pass vlan 20
#
interface GigabitEthernet3/0/0
ip address [Link] [Link]
#
interface LoopBack0
ip address [Link] [Link]
#
ospf 2
area [Link]
network [Link] [Link]
network [Link] [Link]
#
Set the default gateway of PC1 to [Link] and the default gateway of PC2 to
[Link].
----End
Configuration Notes
● Configure the interface of SwitchA connected to RouterA as a trunk interface
and add it to VLAN 10.
● Configure the interface of SwitchB connected to RouterB as a trunk interface
and add it to VLAN 20.
● Each router ID in an OSPF process must be unique. Otherwise, the OSPF
neighbor relationship cannot be established and the routing information is
incorrect.
● GE3/0/0 interfaces on RouterA and RouterB must belong to the same OSPF
area.
Applicability
This example applies to all versions and AR routers.
Networking Requirements
Area 2 is not directly connected to Area 0. Area 1 functions as a transit area to
connect Area 2 and Area 0. A virtual link needs to be established between RouterA
and RouterB so that RouterA can learn routes from Area 2. OSPF area
authentication needs to be performed on all OSPF neighbors and OSPF interface
authentication needs to be performed on all interfaces.
Procedure
Step 1 Configure RouterA.
#
sysname RouterA
#
router id [Link] //Set the router ID. You are advised to set the IP address of Loopback0 as the router ID.
#
interface GigabitEthernet1/0/0
ip address [Link] [Link]
ospf authentication-mode hmac-sha256 //Set the authentication mode to hmac-sha256 authentication.
#
interface GigabitEthernet2/0/0
ip address [Link] [Link]
ospf authentication-mode hmac-sha256
#
interface LoopBack0
ip address [Link] [Link]
#
ospf 2
area [Link]
authentication-mode hmac-sha256 //Set the authentication mode to hmac-sha256 authentication.
network [Link] [Link] //Specify the network segment where the interface running OSPF process
2 as [Link]/24 and the area to which the interface belongs as Area 0.
area [Link]
authentication-mode hmac-sha256
network [Link] [Link]
vlink-peer [Link] //Create a virtual link with the remote router ID as [Link].
#
area [Link]
authentication-mode hmac-sha256
network [Link] [Link]
vlink-peer [Link]
area [Link]
authentication-mode hmac-sha256
network [Link] [Link]
#
Configuration Notes
● Each router ID in an OSPF process must be unique. Otherwise, the OSPF
neighbor relationship cannot be established and the routing information is
incorrect.
● When area authentication is used, all the routers in an area must have the
same authentication mode and password.
● When interface authentication is used, interfaces on the same network
segment must have the same authentication mode and password. The
interface authentication mode takes precedence over the area authentication
mode.
● Routers on two ends must have the same virtual link authentication mode
and password.
Networking Requirements
RouterA and RouterB run in Area 0, and RouterB and RouterC run in Area 1.
RouterB is an ABR. Area 1 needs to be configured as a stub area so that RouterC
can use the default route advertised by the ABR to access the network outside the
area.
Procedure
Step 1 Configure RouterA.
#
sysname RouterA
#
router id [Link] //Set the router ID. You are advised to set the IP address of Loopback0 as the router ID.
#
interface GigabitEthernet1/0/0
ip address [Link] [Link]
#
interface GigabitEthernet2/0/0
ip address [Link] [Link]
#
interface LoopBack0
ip address [Link] [Link]
#
ospf 2
import-route direct //Configure the router to import direct routes.
area [Link]
network [Link] [Link] //Specify the network segment where the interface running OSPF process
2 as [Link]/24 and the area to which the interface belongs as Area 0.
#
----End
Configuration Notes
● Each router ID in an OSPF process must be unique. Otherwise, the OSPF
neighbor relationship cannot be established and the routing information is
incorrect.
● All the routers in a stub area must be configured with stub attributes.
Networking Requirements
RouterA and RouterB run in Area 0, and RouterB and RouterC run in Area 1.
RouterB is an ABR. Area 1 needs to be configured as an NSSA so that RouterC can
use the default route advertised by the ABR to access the network outside the
area.
Procedure
Step 1 Configure RouterA.
#
sysname RouterA
#
router id [Link] //Set the router ID. You are advised to set the IP address of Loopback0 as the router ID.
#
interface GigabitEthernet1/0/0
ip address [Link] [Link]
#
interface GigabitEthernet2/0/0
ip address [Link] [Link]
#
interface LoopBack0
ip address [Link] [Link]
#
ospf 2
import-route direct //Configure the router to import direct routes.
area [Link]
network [Link] [Link] //Specify the network segment where the interface running OSPF process
2 as [Link]/24 and the area to which the interface belongs as Area 0.
#
# Run the ping command on RouterC. The command output shows that RouterC
can communicate with devices on network segments [Link]/24 and
[Link]/24.
----End
Configuration Notes
● Each router ID in an OSPF process must be unique. Otherwise, the OSPF
neighbor relationship cannot be established and the routing information is
incorrect.
● All the routers in an NSSA must be configured with NSSA attributes.
Networking Requirements
RouterA and RouterB run in Area 0, and RouterB and RouterC run in Area 1.
RouterB is an ABR. RouterB is required to summarize routes of specified network
segments that are learned from RouterA and advertise the summarized routes to
RouterC.
Procedure
Step 1 Configure RouterA.
#
sysname RouterA
#
router id [Link] //Set the router ID. You are advised to set the IP address of Loopback0 as the router ID.
#
interface GigabitEthernet1/0/0
ip address [Link] [Link]
#
interface GigabitEthernet2/0/0
ip address [Link] [Link]
#
interface GigabitEthernet3/0/0
ip address [Link] [Link]
#
interface LoopBack0
ip address [Link] [Link]
#
ospf 2
area [Link]
network [Link] [Link] //Specify the network segment where the interface running OSPF process
2 as [Link]/24 and the area to which the interface belongs as Area 0.
network [Link] [Link]
network [Link] [Link]
#
----End
Configuration Notes
● Each router ID in an OSPF process must be unique. Otherwise, the OSPF
neighbor relationship cannot be established and the routing information is
incorrect.
Networking Requirements
RouterA and RouterB run in Area 0, and RouterB and RouterC run in Area 1.
RouterA is an ASBR and RouterB is an ABR. RouterA is required to summarize
imported direct routes and advertise the summarized routes to other routers in
the same OSPF AS.
Procedure
Step 1 Configure RouterA.
#
sysname RouterA
#
router id [Link] //Set the router ID. You are advised to set the IP address of Loopback0 as the router ID.
#
interface GigabitEthernet1/0/0
ip address [Link] [Link]
#
interface GigabitEthernet2/0/0
ip address [Link] [Link]
#
interface GigabitEthernet3/0/0
ip address [Link] [Link]
#
interface LoopBack0
ip address [Link] [Link]
#
ospf 2
asbr-summary [Link] [Link] //Configure the ASBR to summarize imported routes.
import-route direct //Configure the ASBR to import direct routes.
area [Link]
network [Link] [Link] //Specify the network segment where the interface running OSPF process
2 as [Link]/24 and the area to which the interface belongs as Area 0.
#
----End
Configuration Notes
● Each router ID in an OSPF process must be unique. Otherwise, the OSPF
neighbor relationship cannot be established and the routing information is
incorrect.
● Imported intra-area routes must be summarized by an ASBR but not an ABR.
Applicability
This example applies to all models of AR routers in all versions.
Networking Requirements
As shown in Figure 8-16, Company A uses Open Shortest Path First (OSPF) to
implement interconnection between all devices. Company A merges with
Company B that uses the Routing Information Protocol (RIP), requiring OSPF and
RIP to import routes to each other so that departments can communicate.
Router_1 and Router_2 function as core devices to ensure communication between
departments. To meet service requirements, Company A needs to control and
adjust network routes by taking the following measures:
● Filter the imported routes on Router_5 to prevent R&D department 2 from
accessing Marketing department 1, R&D department 1, and After-sales Service
department.
● Filter routes on Router_3 to prevent Marketing department 1 from accessing
R&D department 1.
● Filter routes on Router_4 to prevent R&D department 1 and After-sales
Service department from accessing Marketing department 2.
GE2/0/3 [Link]/24
GE2/0/3 [Link]/2
4 (network
segment
where R&D
departmen
t 1 resides)
GE2/0/3 [Link]/2
4 (network
segment
where
Marketing
departmen
t 2 resides)
Procedure
Step 1 Configure Router_1.
#
sysname Router_1
#
interface GigabitEthernet2/0/1
ip address [Link] [Link]
#
interface GigabitEthernet2/0/2
ip address [Link] [Link]
#
interface GigabitEthernet2/0/3
----End
Configuration Notes
● When filtering routes, you need to specify the export keyword to filter
imported external routes. This keyword is only applicable to an autonomous
system boundary router (ASBR).
● The route filtering function filters only the routes in routing tables but not the
LSAs advertised in OSPF.
● Routing communication is bidirectional. After you filter routes from a router
to a specified destination network segment, other network segments
connected to the router cannot access devices on the destination network
segment and devices on the destination network segment cannot access
devices on the source network segment.
● When using ACLs to implement the route filtering function, you must set the
last ACL to permit the packets sent from all source addresses to avoid filtering
the routes of all network segments.
Networking Requirements
Figure 8-17 shows a company's network architecture. The company wants to not
only ensure network connectivity at Layer 3, but also quickly detect and monitor
the connectivity of links or IP routes on the network. BFD for OSPF can be
deployed to meet the company's requirements. BFD control packets are
transmitted to quickly detect link failures between Router_1 or Router_3 and the
Layer 2 switch, and BFD will notify OSPF of the link failures.
BFD for OSPF can be configured on Router_1 and Router_3 to meet the following
requirements:
● Detect the status of links along which the Layer 2 switch resides.
● Ensure that devices can quickly detect and notify OSPF of the link failure and
switch traffic to the link of Router_2.
GE2/0/2 [Link]/24
GE2/0/3 [Link]/24
Host A - [Link]/24
GE2/0/2 [Link]/24
GE2/0/2 [Link]/24
GE2/0/3 [Link]/24
Host C - [Link]/24
Procedure
Step 1 Configure Router_1.
#
sysname Router_1
#
bfd
#
interface GigabitEthernet2/0/1
ip address [Link] [Link]
ospf bfd enable //Enable BFD on the interface.
ospf bfd min-tx-interval 100 min-rx-interval 100
#
interface GigabitEthernet2/0/2
# Run the ping command to check whether there are reachable routes from Host
A at [Link] connected to Router_1 to Host C at [Link] connected to
Router_3. The command output shows that there are reachable routes from Host
A to Host C.
# Run the display ospf peer command on Router_1 to check OSPF neighbor
information. The command output shows that Router_1 and Router_3 have
established an OSPF neighbor relationship.
# Run the display ospf bfd session all command on Router_1 and Router_3 to
check BFD session information. The command output shows that a BFD session
has been set up between Router_1 and Router_3 and is in Up state.
# Run the display ip routing-table [Link] verbose command on Router_1 to
check routes to [Link]/24. The command output shows that Router_1 and
Router_3 communicate through the Layer 2 switch.
----End
8.5 OSPFv3
Networking Requirements
OSPFv3 runs on RouterA, RouterB, and RouterC. RouterA and RouterC import
direct routes. PC1 and PC2 connect to RouterA and RouterC respectively. It is
required that PC1 and PC2 successfully ping each other.
Procedure
Step 1 Configure RouterA.
#
sysname RouterA
#
ipv6 //Enable IPv6 unicast forwarding.
#
ospfv3 2
router-id [Link] //Set the router ID of the router running OSPFv3 process 2 to [Link].
import-route direct //Configure the router to import external routes.
#
interface GigabitEthernet1/0/0
ipv6 enable //Enable IPv6 on the interface.
ipv6 address 1999::1/64
#
interface GigabitEthernet2/0/0
ipv6 enable //Enable IPv6 on the interface.
ipv6 address 2000::1/64
ospfv3 2 area [Link] //Configure OSPFv3 process 2 on the interface and specify the area to which the
interface belongs as Area 0.
#
Configuration Notes
● The OSPFv3 router ID must be manually configured. If no router ID is
configured, OSPFv3 cannot run properly.
● The ID of each router in an AS must be unique. If multiple OSPFv3 processes
run on the same router, set a unique router ID for each process.
● Before configuring an IPv6 routing protocol, enable IPv6 unicast forwarding
on routers. Before configuring IPv6 features on an interface, enable IPv6 on
the interface.
Networking Requirements
OSPFv3 process 2 runs on RouterA and RouterB, and OSPFv3 process 3 runs on
RouterB and RouterC. It is required that GE1/0/0 interfaces on RouterA and
RouterC successfully ping each other.
Procedure
Step 1 Configure RouterA.
#
sysname RouterA
#
ipv6 //Enable IPv6 unicast forwarding.
#
ospfv3 2
router-id [Link] //Set the router ID of the router running OSPFv3 process 2 to [Link].
#
interface GigabitEthernet1/0/0
ipv6 enable //Enable IPv6 on the interface.
ipv6 address 1999::1/64
ospfv3 2 area [Link] //Configure OSPFv3 process 2 on the interface and specify the area to which the
# Run the ping ipv6 -a 1999::1 2002::1 command on RouterA. The command
output shows that GE1/0/0 interfaces on RouterA and RouterC successfully ping
each other.
----End
Configuration Notes
● The OSPFv3 router ID must be manually configured. If no router ID is
configured, OSPFv3 cannot run properly.
● You must configure different router IDs for routers in an AS and specify
different router IDs for multiple OSPFv3 processes running on the same
router.
● Before configuring an IPv6 routing protocol, enable IPv6 unicast forwarding
on routers. Before configuring IPv6 features on an interface, enable IPv6 on
the interface.
Networking Requirements
As shown in Figure 8-20, Company A uses Open Shortest Path First version 3
(OSPFv3) to implement interconnection between all devices. Company A merges
with Company B that uses the Routing Information Protocol next generation
(RIPng), requiring OSPFv3 and RIPng to import routes to each other so that
departments can communicate. Router_1 and Router_2 function as core devices to
ensure communication between departments. To meet service requirements,
Company A needs to control and adjust network routes by taking the following
measures:
● Filter the imported routes on Router_5 to prevent R&D department 2 from
accessing Marketing department 1, R&D department 1, and After-sales Service
department.
● Filter routes on Router_3 to prevent Marketing department 1 from accessing
R&D department 1.
● Filter routes on Router_4 to prevent R&D department 1 and After-sales
Service department from accessing Marketing department 2.
GE2/0/3 FC04::1/64
GE2/0/3 FC12::1/64
(network
segment
where R&D
departmen
t 1 resides)
GE2/0/3 FC15::1/64
(network
segment
where
Marketing
departmen
t 2 resides)
Procedure
Step 1 Configure Router_1.
#
sysname Router_1
#
ipv6
#
interface GigabitEthernet2/0/1
ipv6 enable
ipv6 address FC01::1/64
ospfv3 1 area [Link]
#
interface GigabitEthernet2/0/2
ipv6 enable
ipv6 address FC02::1/64
ospfv3 1 area [Link]
#
interface GigabitEthernet2/0/3
ipv6 enable
ipv6 address FC04::1/64
ospfv3 1 area [Link]
#
ospfv3 1 //Create an OSPFv3 process, and enable OSPFv3 on Router_1 interfaces.
router-id [Link]
area [Link]
area [Link]
area [Link]
#
return
#
ipv6
#
interface GigabitEthernet2/0/1
ipv6 enable
ipv6 address FC05::2/64
ripng 1 enable
#
interface GigabitEthernet2/0/2
ipv6 enable
ipv6 address FC14::1/64
ripng 1 enable
#
interface GigabitEthernet2/0/3
ipv6 enable
ipv6 address FC15::1/64
ripng 1 enable
#
ripng 1 //Create a RIPng process, and enable RIPng on Router_6 interfaces.
#
return
----End
Configuration Notes
● When filtering routes, you need to specify the export keyword to filter
imported external routes. This keyword is only applicable to an autonomous
system boundary router (ASBR).
● The route filtering function filters only the routes in routing tables but not the
LSAs advertised in OSPFv3.
● Routing communication is bidirectional. After you filter routes from a router
to a specified destination network segment, other network segments
connected to the router cannot access devices on the destination network
segment and devices on the destination network segment cannot access
devices on the source network segment.
● When using ACLs to implement the route filtering function, you must set the
last ACL to permit the packets sent from all source addresses to avoid filtering
the routes of all network segments.
● When configuring OSPFv3, you must specify the router ID.
Networking Requirements
As shown in Figure 8-21, the company headquarters and branch 1 use
Intermediate System to Intermediate System (IS-IS) for communication. An
independent network has been deployed for the Marketing department and
Finance department in the headquarters. Branch 2 uses Open Shortest Path First
(OSPF). The company has the following requirements:
● The Marketing department and Finance department in the headquarters can
communicate. The route leaking function is configured so that branches can
communicate normally with the headquarters and Marketing department but
cannot communicate with the Finance department and cannot view routes of
the Finance department.
● OSPF routes of branch 2 are imported into the branch network so that the
Marketing department can communicate with branch 2.
● Communication is not interrupted when the IS-IS process of the headquarter
gateway Router_3 restarts.
Procedure
Step 1 Configure Router_1.
#
sysname Router_1
#
isis 1 //Configure basic IS-IS functions.
is-level level-1
network-entity 10.0000.0000.1001.00
#
interface GigabitEthernet2/0/1
ip address [Link] [Link]
isis enable 1
#
interface GigabitEthernet2/0/2
ip address [Link] [Link]
isis enable 1
#
return
#
isis 1 //Configure basic IS-IS functions.
is-level level-2
network-entity 20.0000.0002.0001.00
import-route direct //Configure the IS-IS process to import direct routes.
import-route ospf 1 //Configure the IS-IS process to import routes of the OSPF process.
#
interface GigabitEthernet2/0/1
ip address [Link] [Link]
isis enable 1
#
interface GigabitEthernet2/0/2
ip address [Link] [Link]
isis enable 1
#
ospf 1 //Configure basic OSPF functions.
import-route direct //Configure the OSPF process to import direct routes.
import-route isis 1 //Configure the OSPF process to import routes of the IS-IS process.
area [Link]
network [Link] [Link]
#
return
# Check the IS-IS routing table on Router_4. The routing table contains routes of
the Marketing department ([Link]/24) but does not contain routes of the
Finance department ([Link]/24). This indicates that branches can
communicate only with the Marketing department.
# Check the IS-IS routing table on Router_3. The routing table contains routes of
the network segment [Link]/24. Ping [Link] from Router_3. The ping
operation succeeds, indicating that the Marketing department can communicate
normally with branch 2.
# Ping Router_2 from Router_1, and restart the IS-IS process on Router_3 during
the ping operation. Communication is not interrupted during the restart of the IS-
IS process on Router_3. You can view the IS-IS graceful restart (GR) status on
Router_3 in the display isis graceful-restart status command output.
----End
Configuration Notes
Do not change the network topology during the GR of devices. Otherwise, a
routing blackhole may occur.
Networking Requirements
As shown in Figure 8-22, IS-IS is configured on three routers. RouterA is the
Level-1 router, RouterB is the Level-1-2 router, and RouterA and RouterB belong to
area 10. RouterC is the Level-2 router and belongs to area 20. All routes in area 10
need to be aggregated and sent to RouterC.
Procedure
Step 1 Configure RouterA.
#
sysname RouterA
#
isis 10 //Enable IS-IS process 10.
is-level level-1 //Set the router level to Level-1.
network-entity 10.0000.0000.0001.00 //Set a NET for the IS-IS process.
#
interface GigabitEthernet1/0/0
ip address [Link] [Link]
isis enable 10 //Enable IS-IS on the interface.
#
interface GigabitEthernet2/0/0
ip address [Link] [Link]
isis enable 10
#
interface GigabitEthernet3/0/0
ip address [Link] [Link]
isis enable 10
#
network-entity 10.0000.0000.0002.00
summary [Link] [Link] level-1-2 //Configure IS-IS to aggregate routes.
#
interface GigabitEthernet1/0/0
ip address [Link] [Link]
isis enable 10
#
interface GigabitEthernet2/0/0
ip address [Link] [Link]
isis enable 10
#
----End
Configuration Notes
● When using the network-entity command to set a NET for an IS-IS process,
configure the same area ID for routers in an area.
Networking Requirements
In Figure 8-23, a company uses a L2 Switch as a relay agent to connect two
departments that are far from each other. Router_1, Router_2, and Router_3 run
Intermediate System to Intermediate System (IS-IS) and establish IS-IS neighbor
relationships to ensure that they are reachable to each other at the network layer.
Router_1, Router_2, and Router_3 support bidirectional forwarding detection
(BFD). The company wants to use BFD for IS-IS and BFD control packets to ensure
that BFD can fast detect and notify IS-IS of the failure (for example the Down
state) of the link between Router_1 or Router_3 and the L2 Switch).
The company wants to configure BFD for IS-IS on Router_1 and Router_3 to meet
the following requirements:
● Detect the link that passes through the L2 Switch.
● Ensure that the devices can fast detect and notify IS-IS of the link failure and
switch traffic to the link of Router_2.
GE2/0/2 [Link]/24
GE2/0/3 [Link]/24
GE2/0/2 [Link]/24
GE2/0/2 [Link]/24
GE2/0/3 [Link]/24
Procedure
Step 1 Configure Router_1.
#
sysname Router_1
#
bfd
#
isis 1 //Configure basic IS-IS functions on Router_1, and enable BFD for IS-IS.
is-level level-2
bfd all-interfaces enable
network-entity 10.0000.0000.0001.00
#
interface GigabitEthernet2/0/1
ip address [Link] [Link]
isis enable 1
isis cost 5
isis bfd enable
isis bfd min-tx-interval 100 min-rx-interval 100 //Set the minimum interval for sending and receiving
single-hop BFD control packets to 100 ms.
#
interface GigabitEthernet2/0/2
ip address [Link] [Link]
isis enable 1
#
interface GigabitEthernet2/0/3
ip address [Link] [Link]
#
return
# Run the display isis peer verbose command on Router_1 to check IS-IS
neighbor information. When the State field displays Up, Router_1 and Router_3
have established an IS-IS neighbor relationship.
# Run the display isis bfd session all command on Router_1 and Router_3 to
check BFD session information. The command output shows that a BFD session
has been set up and Session State is in Up state.
# Run the display ip routing-table [Link] verbose command on Router_1 to
check routes to [Link]/24. The command output shows that Router_1 and
Router_3 communicate through the L2 Switch.
----End
Networking Requirements
As shown in Figure 8-24:
● RouterA, RouterB, RouterC, and RouterD belong to the same AS. The four
routers need to run IS-IS to implement IPv6 interworking.
● RouterA, RouterB, and RouterC belong to Area 10, and RouterD belongs to
Area 20.
● RouterA and RouterB are Level-1 routers, RouterC is a Level-1-2 router, and
RouterD is a Level-2 router.
Procedure
Step 1 Configure RouterA.
#
sysname RouterA
#
ipv6 //Enable IPv6 unicast forwarding.
#
isis 1 //Enable IS-IS process 1.
is-level level-1 //Set the router as a Level-1 router.
network-entity 10.0000.0000.0001.00 //Set the NET for IS-IS process 1.
#
ipv6 enable topology standard //Enable the IPv6 capability for IS-IS process 1.
#
#
interface GigabitEthernet1/0/0
ipv6 enable //Enable IPv6 on the interface.
ipv6 address 10:1::2/64 //Configure a global unicast IPv6 address for the interface.
isis ipv6 enable 1 //Enable the IPv6 capability for IS-IS process 1 on the interface.
#
return
ipv6 address 10:2::1/64 //Configure a global unicast IPv6 address for the interface.
isis ipv6 enable 1
#
return
# Run the display isis route command on each router to view IS-IS routes.
----End
Configuration Notes
● IPv6 must be enabled in the system view and interface view.
● The IPv6 capability must be enabled for IS-IS on interfaces.
● When using the network-entity command to set a NET for an IS-IS process,
configure the same area ID for routers in an area.
8.8 BGP
Networking Requirements
Multiple ASs exist in a region. To access each other, these ASs must exchange their
local routes. As multiple routers exist in the ASs, there are a large number of
routes that change frequently. How to efficiently transmit a great deal of routing
information between ASs without consuming lots of bandwidth resources has
become a problem. BGP can be used to solve this problem.
Figure 8-25 shows IP addresses and masks of hosts and routers' interfaces.
RouterC is in AS 200, and RouterA and RouterB are in AS 100. After BGP is
enabled on the routers, the routers can exchange routing information. When
routes of one router change, the router will send update messages carrying only
changed routing information to its peers without having to send its entire routing
table. This implementation greatly reduces bandwidth consumption.
Procedure
Step 1 Configure RouterA.
#
interface GigabitEthernet1/0/0
ip address [Link] [Link]
#
interface GigabitEthernet2/0/0
ip address [Link] [Link]
#
bgp 100 //Enter the BGP view.
router-id [Link] //Set the router ID in routing management.
peer [Link] as-number 100 //Configure an IP address and an AS number for a peer.
#
ipv4-family unicast //Enter the IPv4 unicast address family view.
undo synchronization
network [Link] 24 //Add routes in the local routing table to the BGP routing table statically and
advertise the routes to a peer.
peer [Link] enable
#
return
#
interface GigabitEthernet1/0/0
ip address [Link] [Link]
#
interface GigabitEthernet2/0/0
ip address [Link] [Link]
#
bgp 100
router-id [Link]
peer [Link] as-number 100
peer [Link] as-number 200
#
ipv4-family unicast
undo synchronization
peer [Link] enable
peer [Link] next-hop-local
peer [Link] enable
#
return
Set the default gateway of hosts in VLAN 10 to [Link] and the default gateway
of hosts in VLAN 20 to [Link].
# Run the display bgp routing-table command to view the BGP routing table.
----End
Configuration Notes
● You must configure IP addresses on the same network segment for interfaces
connecting two routers together.
● You must configure IPv4 default gateways for hosts.
● If no mask or mask length is specified in the network command, the IP
address in the network command is considered as a classful address.
● By default, IGP-BGP synchronization is disabled.
● By default, peers are automatically enabled in the BGP-IPv4 unicast address
family view.
Networking Requirements
Figure 8-26 shows IP addresses and masks of hosts and routers' interfaces.
RouterB is a route reflector (RR), RouterC is its client, and RouterA is a non-client.
RouterC does not establish a BGP connection with RouterA but can learn the
routes advertised by RouterA through RouterB.
Procedure
Step 1 Configure RouterA.
#
interface GigabitEthernet1/0/0
ip address [Link] [Link]
#
interface GigabitEthernet2/0/0
ip address [Link] [Link]
#
bgp 100 //Enter the BGP view.
router-id [Link] //Set the router ID in routing management.
peer [Link] as-number 100 //Configure an IP address and an AS number for a peer.
#
ipv4-family unicast //Enter the IPv4 unicast address family view.
undo synchronization
network [Link] 24 //Add routes in the local routing table to the BGP routing table statically and
advertise the routes to a peer.
peer [Link] enable
#
return
#
ipv4-family unicast
undo synchronization
peer [Link] enable
peer [Link] enable
peer [Link] reflect-client //Configure an RR and its clients.
#
return
# Run the display bgp routing-table command on RouterC to view the BGP
routing table. The command output shows that RouterC has learned from RouterB
the routes advertised by RouterA. You can also view the Originator and Cluster_ID
attributes of a specified route.
----End
Configuration Notes
● You must configure IP addresses on the same network segment for interfaces
connecting two routers together.
● If no mask or mask length is specified in the network command, the IP
address in the network command is considered as a classful address.
● By default, IGP-BGP synchronization is disabled.
● By default, peers are automatically enabled in the BGP-IPv4 unicast address
family view.
Networking Requirements
BGP runs on RouterA and RouterB. RouterA imports two static blackhole routes.
RouterB needs to change the local preference and add the community attribute of
routes of [Link]/24.
Procedure
Step 1 Configure RouterA.
#
sysname RouterA
#
interface GigabitEthernet1/0/0
ip address [Link] [Link]
#
interface LoopBack0
ip address [Link] [Link]
#
bgp 10
router-id [Link] //Set the router ID. You are advised to set the IP address of Loopback 0 as the router ID.
peer [Link] as-number 10 //Configure an IP address and an AS number for a peer.
#
ipv4-family unicast
undo synchronization
import-route static //Configure the router to import static routes.
peer [Link] enable
#
ip route-static [Link] [Link] NULL0 //Configure static blackhole routes.
ip route-static [Link] [Link] NULL0
#
route-policy admin permit node 10 //Configure a route-policy admin and set the index of the node in the
route-policy to 10 and the matching mode to permit.
if-match acl 2001 //Configure a matching rule based on ACL 2001.
apply local-preference 120 //Set the local preference of BGP routes to 120.
apply community 10:1 //Set the BGP community attribute of BGP routes to 10:1.
#
route-policy admin permit node 20 //Configure a route-policy admin and set the index of the node in the
route-policy to 20 and the matching mode to permit.
#
----End
Configuration Notes
● By default, IGP-BGP synchronization is disabled.
● By default, peers are automatically enabled in the BGP-IPv4 unicast address
family view.
● A permit node without contents must be appended to a route-policy so that
the routes that do not match the previous nodes can be added to the BGP
routing table.
● The local preference is only used for route selection within an AS and is not
advertised outside the AS. Therefore, the apply local-preference command
does not take effect when a route-policy is configured for an EBGP peer.
Networking Requirements
As shown in Figure 8-28, four routers belong to different ASs and establish EBGP
connections. When RouterD sends routes to RouterA, the AS-Path attribute needs
to be changed so that route from RouterA to [Link]/24 is changed.
Procedure
Step 1 Configure RouterA.
#
sysname RouterA
#
interface GigabitEthernet1/0/0
ip address [Link] [Link]
#
interface GigabitEthernet2/0/0
ip address [Link] [Link]
#
interface LoopBack0
ip address [Link] [Link]
#
bgp 100
router-id [Link] //Set the router ID. You are advised to set the IP address of Loopback 0 as the router ID.
peer [Link] as-number 200 //Specify the peer IP address and AS number.
peer [Link] as-number 400
#
ipv4-family unicast
undo synchronization
peer [Link] enable
peer [Link] enable
#
Configuration Notes
● If no mask or mask length is specified in the network command, the IP
address in the network command is considered as a classful address.
● By default, IGP-BGP synchronization is disabled.
● By default, peers are automatically enabled in the BGP-IPv4 unicast address
family view.
Networking Requirements
As shown in Figure 8-29, RouterB receives a route update from RouterA using
EBGP and forwards the route update to RouterC. RouterC is configured as a route
reflector, which has two clients, RouterB and RouterD.
RouterB and RouterD do not need to establish an IBGP connection. After receiving
a route update from RouterB, RouterC reflects the route update to RouterD.
Similarly, RouterC reflects the route update received from RouterD to RouterB.
Procedure
Step 1 Configure RouterA.
#
ipv6 //Enable IPv6 forwarding.
#
interface GigabitEthernet1/0/0
ipv6 enable //Enable IPv6 on the interface.
ipv6 address 100::1 96
#
bgp 100 //Enter the BGP view.
router-id [Link] //Set the router ID in routing management.
peer 100::2 as-number 200 //Set an IPv6 address and an AS number for a peer.
#
ipv6-family unicast //Enter the IPv6 unicast address family view.
undo synchronization
network 100:: 96 //Add the routes in the local routing table to the BGP routing table statically and
advertise the routes to the peer.
peer 100::2 enable //Enable peers to exchange routing information.
#
return
# Run the display bgp ipv6 routing-table command on RouterD to view the BGP
IPv6 routing table. The routing tables show that RouterD has learned from
RouterC the routes advertised by RouterA.
----End
Configuration Notes
● You must configure IP addresses on the same network segment for interfaces
connecting two routers together.
● If no mask or mask length is specified in the network command, the IP
address in the network command is considered as a classful address.
● By default, IGP-BGP synchronization is disabled.
● After configuring a BGP4+ peer in the BGP view, enable the BGP4+ peer in the
IPv6 unicast address family view.
Applicability
This example applies to all AR models of V200R002C00 and later versions.
Networking Requirements
RouterA establishes EBGP connections with RouterB and RouterC. RouterB and
RouterC import static routes to 3000::/64. Load balancing needs to be
implemented between RouterB and RouterC.
Procedure
Step 1 Configure RouterA.
#
sysname RouterA
#
ipv6 //Enable IPv6 unicast forwarding.
#
interface GigabitEthernet1/0/0
ipv6 enable //Enable IPv6 on the interface.
ipv6 address 1000::1/64
#
interface GigabitEthernet2/0/0
ipv6 enable
ipv6 address 2000::1/64
#
interface LoopBack0
ip address [Link] [Link]
#
bgp 10
router-id [Link] //Set the router ID. You are advised to set the IP address of Loopback 0 as the router ID.
peer 1000::2 as-number 20 //Set an IP address and an AS number for a peer.
peer 2000::2 as-number 20
#
ipv6-family unicast
undo synchronization
maximum load-balancing 2 //Set the maximum number of equal-cost routes to 2.
peer 1000::2 enable //Enable peers to exchange routing information.
peer 2000::2 enable
#
#
ipv6-family unicast
undo synchronization
import-route static //Configure the router to import IPv6 static routes.
peer 2000::1 enable
#
ipv6 route-static 3000:: 64 NULL0 //Configure an IPv6 static route.
#
----End
Configuration Notes
● After configuring a BGP4+ peer in the BGP view, enable the BGP4+ peer in the
IPv6 unicast address family view.
● Before configuring an IPv6 routing protocol, enable IPv6 unicast forwarding
on routers. Before configuring IPv6 features on an interface, enable IPv6 on
the interface.
Networking Requirements
As shown in Figure 8-31. AS 20 is divided into three sub-ASs: AS 65001, AS 65002,
and AS 65003. EBGP and IBGP need to be configured to allow routers in the two
ASs to communicate.
Procedure
Step 1 Configure RouterA.
#
sysname RouterA
#
ipv6 //Enable IPv6 unicast forwarding.
#
interface GigabitEthernet1/0/0
ipv6 enable //Enable IPv6 on the interface.
ipv6 address 1000::1/64
#
interface LoopBack0
ip address [Link] [Link]
#
bgp 10
router-id [Link] //Set the router ID. You are advised to set the IP address of Loopback 0 as the router ID.
peer 1000::2 as-number 20 //Set an IP address and an AS number for a peer.
#
ipv6-family unicast
undo synchronization
peer 1000::2 enable //Enable peers to exchange routing information.
#
#
interface LoopBack0
ip address [Link] [Link]
#
bgp 65002
router-id [Link]
confederation id 20 //Set the confederation ID to 20.
confederation peer-as 65001 65003 //Set the sub-AS number of peers in the confederation.
peer 1000::1 as-number 10
peer 2000::1 as-number 65001
peer 3000::1 as-number 65003
#
ipv6-family unicast
undo synchronization
import-route direct //Configure the router to import direct routes.
peer 1000::1 enable
peer 2000::1 enable
peer 3000::1 enable
#
Configuration Notes
● Before configuring an IPv6 routing protocol, enable IPv6 unicast forwarding
on routers. Before configuring IPv6 features on an interface, enable IPv6 on
the interface.
● After configuring a BGP4+ peer in the BGP view, enable the BGP4+ peer in the
IPv6 unicast address family view.
● RouterB advertises only the existing routes in the local routing table.
Therefore, direct routes must be imported to RouterB using BGP4+. Otherwise,
RouterA, RouterC, and RouterD cannot communicate.
Networking Requirements
As shown in Figure 8-32, Departments A and B of the company are far from each
other. Router_1 and Router_6 function as egress devices of Departments A and B
respectively. Border Gateway Protocol (BGP) has been deployed to ensure that the
two departments can communicate. Router_2 and Router_4 support bidirectional
forwarding detection (BFD). The company wants to use BFD for BGP and use BFD
control packets to detect the active link between autonomous system (AS) 200
and AS 300. When the link between Router_2 and Router_4 fails, for example, the
link becomes Down, BFD can fast detect and notify BGP of the link failure. The
following requirements must be met:
● Use Open Shortest Path First (OSPF) as an Interior Gateway Protocol (IGP) in
AS 100.
● Configure the link Router_2 <->Router_3 <-> Router_4 as the active link that
forwards traffic between Router_1 and Router_6, and use BFD control packets
to detect the active link status.
Procedure
Step 1 Configure Router_1.
#
sysname Router_1
#
interface GigabitEthernet2/0/1
ip address [Link] [Link]
#
bgp 200 //Enable BGP and set the local AS number to 200.
router-id [Link]
peer [Link] as-number 100 //Configure Router_1 and Router_2 to set up an EBGP connection.
#
ipv4-family unicast
undo synchronization
network [Link] [Link]
peer [Link] enable
#
return
# Run the display bgp peer command on Router_2 to check BGP peer
information. The command output shows that Router_2 has set up an Internal
Border Gateway Protocol (IBGP) connection and External Border Gateway Protocol
(EBGP) connection with Router_4 and Router_1 respectively, and the two
connections are in Established state.
# Run the display bgp bfd session all command on Router_2 to check BFD
session information. The command output shows that a BFD session has been set
up and Session State is in Up state.
----End
Applicability
This example applies to all models of AR routers in all versions.
Networking Requirements
In Figure 8-33, by default, the Router forwards the packets that are received from
GE2/0/0 and destined for the Server through the next hop at [Link] according to
the routing table. Local policy-based routing (PBR) needs to be configured on the
Router to meet the following requirements:
● Redirect the packets that are received from GE2/0/0 and destined for the
Server and have the source IP address [Link] to the next hop at [Link]. The
flow policy call for this interface has a higher priority.
● Redirect the HTTP packets that are received from GE2/0/0 and destined for
the Server the next hop at [Link].
Procedure
Step 1 Configure the router.
#
sysname Router
#
acl number 3005 //Create ACL 3005 to permit packets with the source IP address [Link].
rule 0 permit ip source [Link] 0
#
acl number 3006 //Create ACL 3006 to permit HTTP packets.
rule 0 permit tcp destination-port eq www
#
traffic classifier [Link] operator or
if-match acl 3005
traffic classifier www operator or
if-match acl 3006
#
traffic behavior [Link]
redirect ip-nexthop [Link]
traffic behavior www
redirect ip-nexthop [Link]
#
Traffic policy pbr
Classifier [Link] behavior [Link] precedence 5
Classifier www behavior www precedence 10
#
interface GigabitEthernet2/0/0 ////Configure an IP address for GE2/0/0
ip address [Link] [Link]
traffic-policy pbr inbound
#
interface GigabitEthernet2/0/1
ip address [Link] [Link]
#
interface GigabitEthernet2/0/2
ip address [Link] [Link]
#
interface GigabitEthernet2/0/3
ip address [Link] [Link]
#
ip route-static [Link] 24 [Link] //Configure static routes and ensure that the three paths are
reachable and the default next hop is at [Link]
ip route-static [Link] 24 [Link] preference 40
ip route-static [Link] 24 [Link]
#
return
----End
Networking Requirements
An enterprise wants to allow network administrators to make user-defined policies
for routing packet, allow different data flows to be forwarded on different links,
which improves flexibility of route selection, increases link usage and reduces the
cost of enterprise data services. In this case, SPR can be deployed to ensure.
As shown in Figure 8-34, RouterA, RouterB, and RouterC use OSPF to ensure
routes between them are reachable. In the routing table of RouterA, the next-hop
address of the route to [Link] is the IP address of GE1/0/0 on RouterC.
PBR is configured on RouterA so that traffic from RouterA to [Link]/24 is
redirected to RouterB.
Procedure
Step 1 Configure RouterA.
#
acl number 3001 //Define an ACL rule to match packets with the destination IP address [Link]/24 and
destination IP address [Link]/24.
rule 5 permit ip source [Link] [Link] destination [Link] [Link]
#
traffic classifier rdt operator or //Configure a traffic classifier.
if-match acl 3001
#
traffic behavior rdt //Configure a traffic behavior, with the next hop address as the IP address of GE1/0/0
on RouterB.
redirect ip-nexthop [Link]
#
traffic policy rdt //Bind the traffic policy.
classifier rdt behavior rdt
#
interface GigabitEthernet 1/0/0
ip address [Link] [Link]
#
interface GigabitEthernet 2/0/0
ip address [Link] [Link]
#
interface GigabitEthernet 3/0/0
ip address [Link] [Link]
traffic-policy rdt inbound //The traffic sent from [Link]/24 to [Link]/24 is redirected to RouterB.
#
ospf 1 //Configure OSPF.
area [Link]
network [Link] [Link]
network [Link] [Link]
network [Link] [Link]
#
return
----End
Context
Applicability
This example applies to all models of AR routers in all versions.
Networking Requirements
As shown in Figure 8-35, Departments A and B of the company are far from each
other. Router_1 and Router_6 function as egress devices of Departments A and B
respectively. Devices in AS 100 use Open Shortest Path First (OSPF) as an Interior
Gateway Protocol (IGP). The company has the following requirements:
● The Border Gateway Protocol (BGP) is deployed to enable Departments A and
B to communicate.
● A route-policy is configured to make the link Router_2 <-> Router_3 <->
Router_4 become the active link that forwards traffic between Router_1 and
Router_6. When the active link is disconnected, traffic is automatically
switched to the standby link Router_2 <-> Router_5 <-> Router_4.
Procedure
Step 1 Configure Router_1.
#
sysname Router_1
#
interface GigabitEthernet1/0/1
ip address [Link] [Link]
#
interface GigabitEthernet2/0/1
ip address [Link] [Link]
#
bgp 200 //Enable BGP, set the local AS number to 200, and set the BGP router ID to [Link].
router-id [Link]
peer [Link] as-number 100 //Configure Router_1 and Router_2 to set up an EBGP connection.
#
ipv4-family unicast
undo synchronization
network [Link] [Link] //In the BGP IPv4 unicast address family view, add routes to the
network segment [Link]/24 in the IP routing table to the BGP routing table.
peer [Link] enable
#
return
#
ospf 1
import-route direct
import-route bgp
area [Link]
network [Link] [Link]
network [Link] [Link]
#
route-policy local-pre permit node 10 //Configure a route-policy to advertise the routes learned from the
peer at [Link] to the peer at [Link], and set the local priority to 200.
if-match ip route-source acl 2000
apply local-preference 200
#
return
import-route bgp
area [Link]
network [Link] [Link]
network [Link] [Link]
#
route-policy local-pre permit node 10 //Configure a route-policy to advertise the routes learned from the
peer at [Link] to the peer at [Link], and set the local priority to 200.
if-match ip route-source acl 2000
apply local-preference 200
#
return
# Ping PC_6 from PC_1. The ping operation succeeds, indicating that PC_1 and
PC_6 can communicate.
# Run the display bgp routing-table command on Router_2 to check the BGP
routing table. The BGP routing table contains two routes with the destination
network segment [Link]/24 and local route priority 100 and 200.
# Run the tracert command on PC_1 to check its connectivity to PC_6. Packets are
transmitted along the link Router_1 <-> Router_2 <-> Router_3 <-> Router_4 <->
Router_6.
# Check the BGP routing table of Router_2 after the active link is disconnected.
The BGP routing table contains only one route to [Link]/24.
# Run the tracert command on PC_1 to check its connectivity to PC_6 again.
Packets are transmitted along the link Router_1 <-> Router_2 <-> Router_5 <->
Router_4 <-> Router_6. This indicates that traffic has been successfully switched
from the active link to the standby link.
----End