- Table of Contents
-
- H3C MSR1000[2600][3600] Routers Configuration Examples All-in-One-R9141-6W100
- 00-Preface
- 01-Local 802.1X Authentication Configuration Examples
- 02-RADIUS-Based 802.1X Authentication Configuration Examples
- 03-AAA Configuration Examples
- 04-ACL Configuration Examples
- 05-MPLS over ADVPN Configuration Examples
- 06-ARP Attack Protection Configuration Examples
- 07-BFD Configuration Examples
- 08-Basic BGP Configuration Examples
- 09-BGP Route Attribute-Based Route Selection Configuration Examples
- 10-EAA Monitor Policy Configuration Examples
- 11-GRE with OSPF Configuration Examples
- 12-HoVPN Configuration Examples
- 13-IGMP Snooping Configuration Examples
- 14-IGMP Configuration Examples
- 15-IPsec Configuration Examples
- 16-IPsec Digital Certificate Authentication Configuration Examples
- 17-IPv6 IS-IS Configuration Examples
- 18-IPv6 over IPv4 GRE Tunnel Configuration Examples
- 19-IPv6 over IPv4 Manual Tunnel with OSPFv3 Configuration Examples
- 20-IS-IS Configuration Examples
- 21-Combined ISATAP Tunnel and 6to4 Tunnel Configuration Examples
- 22-L2TP over IPsec Configuration Examples
- 23-Multi-Instance L2TP Configuration Examples
- 24-L2TP Multidomain Access Configuration Examples
- 25-MPLS L3VPN Configuration Examples
- 26-MPLS OAM Configuration Examples
- 27-MPLS TE Configuration Examples
- 28-Basic MPLS Configuration Examples
- 29-NAT DNS Mapping Configuration Examples
- 30-NetStream Configuration Examples
- 31-NQA Configuration Examples
- 32-NTP Configuration Examples
- 33-OSPFv3 Configuration Examples
- 34-OSPF Configuration Examples
- 35-OSPF Multi-Process Configuration Examples
- 36-OSPF Multi-Instance Configuration Examples
- 37-Portal Configuration Examples
- 38-PPP Configuration Examples
- 39-RBAC Configuration Examples
- 40-RMON Configuration Examples
- 41-IPv4 NetStream Sampling Configuration Examples
- 42-SNMP Configuration Examples
- 43-SRv6 Configuration Examples
- 44-SSH Configuration Examples
- 45-Tcl Commands Configuration Examples
- 46-VLAN Configuration Examples
- 47-VRRP Configuration Examples
- 48-VXLAN over IPsec Configuration Examples
- 49-WLAN AC Configuration Examples
- 50-Small and Medium-Sized Store Configuration Examples
- 51-Cloudnet VPN Configuration Examples
- 52-Ethernet Link Aggregation Configuration Examples
- 53-Ethernet OAM Configuration Examples
- 54-Outbound Bidirectional NAT Configuration Examples
- 55-NAT Hairpin in C-S Mode Configuration Examples
- 56-Load Sharing NAT Server Configuration Examples
- 57-BIDIR-PIM Configuration Examples
- 58-Control Plane-Based QoS Policy Configuration Examples
- 59-Scheduling a Task Configuration Examples
- 60-Client-Initiated L2TP Tunnel Configuration Examples
- 61-LAC-Auto-Initiated L2TP Tunnel Configuration Examples
- 62-Authorized ARP Configuration Examples
- 63-GTS Configuration Examples
- 64-Traffic Policing Configuration Examples
- 65-Traffic Accounting Configuration Examples
- 66-Mobile Communication Modem Management Configuration Examples
- 67-Port Isolation Configuration Examples
- 68-PBR Configuration Examples
- 69-TFTP Client Software Upgrade Configuration Examples
- 70-FTP Client Software Upgrade Configuration Examples
- 71-FTP Server Software Upgrade Configuration Examples
- 72-Routing Policy Configuration Examples
- 73-Software Upgrade from the BootWare Menu Configuration Examples
- 74-Mirroring Configuration Examples
- Related Documents
-
Title | Size | Download |
---|---|---|
34-OSPF Configuration Examples | 121.37 KB |
OSPF Configuration Examples
Copyright © 2024 New H3C Technologies Co., Ltd. All rights reserved.
No part of this manual may be reproduced or transmitted in any form or by any means without prior written consent of New H3C Technologies Co., Ltd.
Except for the trademarks of New H3C Technologies Co., Ltd., any trademarks that may be mentioned in this document are the property of their respective owners.
The information in this document is subject to change without notice.
Contents
Example: Configuring OSPF route filtering
Configuring route redistribution
Configuring OSPF route filtering
Introduction
This document provides OSPF route filtering configuration examples for routers.
Prerequisites
This document applies to Comware 9-based routers. Procedures and information in the examples might be slightly different depending on the software or hardware version of the routers.
The configuration examples in this document were created and verified in a lab environment, and all the devices were started with the factory default configuration. When you are working on a live network, make sure you understand the potential impact of every command on your network.
This document assumes that you have basic knowledge of OSPF route filtering.
Example: Configuring OSPF route filtering
Network configuration
As shown in Figure 1, the devices of an enterprise reside in OSPF and RIP domains. Configure route redistribution between OSPF and RIP to interconnect the devices. Configure route filtering on Device E, Device C, and Device D to meet the following requirements:
· The route destined for R&D department 2 is not redistributed to OSPF.
· Marketing department 1 cannot reach R&D department 1.
· R&D department 1 and the After-sale service department cannot reach Marketing department 2.
Table 1 Interface and IP address assignment
Device |
Interface |
IP address |
Device |
Interface |
IP address |
Device A |
GE1/0/1 |
10.1.1.1/24 |
Device B |
GE1/0/1 |
10.1.1.2/24 |
|
GE1/0/2 |
10.2.1.1/24 |
|
GE1/0/2 |
10.3.1.1/24 |
|
GE1/0/3 |
10.4.1.1/24 |
|
|
|
Device C |
GE1/0/1 |
10.2.1.2/24 |
Device D |
GE1/0/1 |
10.3.1.2/24 |
|
Loop0 |
192.168.3.1/24 |
|
Loop0 |
192.168.1.1/24 |
|
|
|
|
Loop1 |
192.168.2.1/24 |
Device E |
GE1/0/1 |
10.4.1.2/24 |
Device F |
GE1/0/1 |
10.5.1.2/24 |
|
GE1/0/2 |
10.5.1.1/24 |
|
Loop0 |
192.168.4.1/24 |
|
|
|
|
Loop1 |
192.168.5.1/24 |
Software versions used
This configuration example was created and verified on R9141P16 of the MSR2630E-X1 device.
Restrictions and guidelines
· The filter-policy export command that filters redistributed routes takes effect only on an ASBR.
· OSPF filters routes calculated using received LSAs. It does not filter LSAs.
· IP communication is bidirectional. If a router filters a route destined for Network A, the subnets attached to the router cannot reach Network A, and Network A cannot reach the subnets.
· When you configure route filtering by referencing an ACL, configure the rule permit source any item following multiple rule deny source items to allow unmatched routes to pass.
Procedures
Configuring IP addresses
# Configure an IP address for GigabitEthernet 1/0/1.
<DeviceA> system-view
[DeviceA] interface GigabitEthernet 1/0/1
[DeviceA-GigabitEthernet1/0/1] ip address 10.1.1.1 24
[DeviceA-GigabitEthernet1/0/1] quit
# Configure IP addresses for other interfaces. (Details not shown.)
Configuring OSPF
<DeviceA> system-view
[DeviceA] ospf 1
[DeviceA-ospf-1] area 0
[DeviceA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[DeviceA-ospf-1-area-0.0.0.0] quit
[DeviceA-ospf-1] area 2
[DeviceA-ospf-1-area-0.0.0.2] network 10.2.1.0 0.0.0.255
[DeviceA-ospf-1-area-0.0.0.2] quit
[DeviceA-ospf-1] area 1
[DeviceA-ospf-1-area-0.0.0.1] network 10.4.1.0 0.0.0.255
[DeviceA-ospf-1-area-0.0.0.1] quit
[DeviceA-ospf-1] quit
# Enable OSPF on Device B.
<DeviceB> system-view
[DeviceB] ospf 1
[DeviceB-ospf-1] area 0
[DeviceB-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[DeviceB-ospf-1-area-0.0.0.0] quit
[DeviceB-ospf-1] area 3
[DeviceB-ospf-1-area-0.0.0.3] network 10.3.1.0 0.0.0.255
[DeviceB-ospf-1-area-0.0.0.3] quit
[DeviceB-ospf-1] quit
# Enable OSPF on Device C.
<DeviceC> system-view
[DeviceC] ospf 1
[DeviceC-ospf-1] area 2
[DeviceC-ospf-1-area-0.0.0.2] network 10.2.1.0 0.0.0.255
[DeviceC-ospf-1-area-0.0.0.2] network 192.168.3.0 0.0.0.255
[DeviceC-ospf-1-area-0.0.0.2] quit
[DeviceC-ospf-1] quit
# Enable OSPF on Device D.
<DeviceD> system-view
[DeviceD] ospf 1
[DeviceD-ospf-1] area 3
[DeviceD-ospf-1-area-0.0.0.3] network 10.3.1.0 0.0.0.255
[DeviceD-ospf-1-area-0.0.0.3] network 192.168.1.0 0.0.0.255
[DeviceD-ospf-1-area-0.0.0.3] network 192.168.2.0 0.0.0.255
[DeviceD-ospf-1-area-0.0.0.3] quit
[DeviceD-ospf-1] quit
# Enable OSPF on Device E.
<DeviceE> system-view
[DeviceE] ospf 1
[DeviceE-ospf-1] area 1
[DeviceE-ospf-1-area-0.0.0.1] network 10.4.1.0 0.0.0.255
[DeviceE-ospf-1-area-0.0.0.1] quit
[DeviceE-ospf-1] quit
Configuring RIP
# Enable RIP on Device E.
<DeviceE> system-view
[DeviceE] rip 1
[DeviceE-rip-1] version 2
[DeviceE-rip-1] undo summary
[DeviceE-rip-1] network 10.5.1.0 0.0.0.255
[DeviceE-rip-1] quit
# Enable RIP on Device F.
<DeviceF> system-view
[DeviceF] rip 1
[DeviceF-rip-1] version 2
[DeviceF-rip-1] undo summary
[DeviceF-rip-1] network 10.5.1.0 0.0.0.255
[DeviceF-rip-1] network 192.168.4.0 0.0.0.255
[DeviceF-rip-1] network 192.168.5.0 0.0.0.255
[DeviceF-rip-1] quit
Configuring route redistribution
# Configure Device E to redistribute OSPF and direct routes to RIP.
<DeviceE> system-view
[DeviceE] rip 1
[DeviceE-rip-1] import-route direct
[DeviceE-rip-1] import-route ospf
[DeviceE-rip-1] quit
# Configure Device E to redistribute RIP and direct routes to OSPF.
[DeviceE] ospf 1
[DeviceE-ospf-1] import-route direct
[DeviceE-ospf-1] import-route rip
[DeviceE-ospf-1] quit
# Verify that Device E has routes to all networks.
[DeviceE] display ip routing-table
Destinations : 24 Routes : 24
Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
10.1.1.0/24 OSPF 10 2 10.4.1.1 GE1/0/1
10.2.1.0/24 OSPF 10 2 10.4.1.1 GE1/0/1
10.3.1.0/24 OSPF 10 3 10.4.1.1 GE1/0/1
10.4.1.0/24 Direct 0 0 10.4.1.2 GE1/0/1
10.4.1.0/32 Direct 0 0 10.4.1.2 GE1/0/1
10.4.1.2/32 Direct 0 0 127.0.0.1 InLoop0
10.4.1.255/32 Direct 0 0 10.4.1.2 GE1/0/1
10.5.1.0/24 Direct 0 0 10.5.1.1 GE1/0/2
10.5.1.0/32 Direct 0 0 10.5.1.1 GE1/0/2
10.5.1.1/32 Direct 0 0 127.0.0.1 InLoop0
10.5.1.255/32 Direct 0 0 10.5.1.1 GE1/0/2
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.1/32 OSPF 10 3 10.4.1.1 GE1/0/1
192.168.2.1/32 OSPF 10 3 10.4.1.1 GE1/0/1
192.168.3.1/32 OSPF 10 2 10.4.1.1 GE1/0/1
192.168.4.0/24 RIP 100 1 10.5.1.2 GE1/0/2
192.168.5.0/24 RIP 100 1 10.5.1.2 GE1/0/2
224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0
224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0
255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
# Verify that other devices have routes to all networks. (Details not shown.)
Configuring OSPF route filtering
# On Device C, configure IPv4 basic ACL 2000 to deny 192.168.2.0/24.
<DeviceC> system-view
[DeviceC] acl number 2000
[DeviceC-acl-basic-2000] rule 0 deny source 192.168.2.0 0.0.0.255
[DeviceC-acl-basic-2000] rule permit source any
[DeviceC-acl-basic-2000] quit
# On Device C, use ACL 2000 to filter received routes.
[DeviceC] ospf 1
[DeviceC-ospf-1] filter-policy 2000 import
[DeviceC-ospf-1] quit
# On Device D, configure IPv4 basic ACL 2000 to deny 192.168.5.0/24.
<DeviceD> system-view
[DeviceD] acl number 2000
[DeviceD-acl-basic-2000] rule 0 deny source 192.168.5.0 0.0.0.255
[DeviceD-acl-basic-2000] rule permit source any
[DeviceD-acl-basic-2000] quit
# On Device D, use ACL 2000 to filter received routes.
[DeviceD] ospf
[DeviceD-ospf-1] filter-policy 2000 import
[DeviceD-ospf-1] quit
# On Device E, configure IPv4 basic ACL 2000 to deny 192.168.4.0/24.
<DeviceE> system-view
[DeviceE] acl number 2000
[DeviceE-acl-basic-2000] rule 0 deny source 192.168.4.0 0.0.0.255
[DeviceE-acl-basic-2000] rule permit source any
[DeviceE-acl-basic-2000] quit
# On Device E, use ACL 2000 to filter routes redistributed from RIP.
[DeviceE] ospf 1
[DeviceE-ospf-1] filter-policy 2000 export rip 1
[DeviceE-ospf-1] quit
Verifying the configuration
# Verify that Device C does not have a route to 192.168.2.0/24.
[DeviceC] display ip routing-table
Destinations : 22 Routes : 22
Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
10.1.1.0/24 OSPF 10 2 10.2.1.1 GE1/0/1
10.2.1.0/24 Direct 0 0 10.2.1.2 GE1/0/1
10.2.1.0/32 Direct 0 0 10.2.1.2 GE1/0/1
10.2.1.2/32 Direct 0 0 127.0.0.1 InLoop0
10.2.1.255/32 Direct 0 0 10.2.1.2 GE1/0/1
10.3.1.0/24 OSPF 10 3 10.2.1.1 GE1/0/1
10.4.1.0/24 OSPF 10 2 10.2.1.1 GE1/0/1
10.5.1.0/24 OSPF 150 1 10.2.1.1 GE1/0/1
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.1/32 OSPF 10 3 10.2.1.1 GE1/0/1
192.168.3.0/24 Direct 0 0 192.168.3.1 Loop0
192.168.3.0/32 Direct 0 0 192.168.3.1 Loop0
192.168.3.1/32 Direct 0 0 127.0.0.1 InLoop0
192.168.3.255/32 Direct 0 0 192.168.3.1 Loop0
192.168.5.0/24 OSPF 150 1 10.2.1.1 GE1/0/1
224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0
224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0
255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
# Verify that Marketing department 1 cannot reach R&D department 1.
[DeviceC] ping -a 192.168.3.1 192.168.2.1
Ping 192.168.2.1 (192.168.2.1) from 192.168.3.1: 56 data bytes, press CTRL_C to
break
Request time out
Request time out
Request time out
Request time out
Request time out
--- Ping statistics for 192.168.2.1 ---
5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss
# Verify that Device D does not have a route to 192.168.5.0/24.
[DeviceD] display ip routing-table
Destinations : 25 Routes : 25
Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
10.1.1.0/24 OSPF 10 2 10.3.1.1 GE1/0/1
10.2.1.0/24 OSPF 10 3 10.3.1.1 GE1/0/1
10.3.1.0/24 Direct 0 0 10.3.1.2 GE1/0/1
10.3.1.0/32 Direct 0 0 10.3.1.2 GE1/0/1
10.3.1.2/32 Direct 0 0 127.0.0.1 InLoop0
10.3.1.255/32 Direct 0 0 10.3.1.2 GE1/0/1
10.4.1.0/24 OSPF 10 3 10.3.1.1 GE1/0/1
10.5.1.0/24 OSPF 150 1 10.3.1.1 GE1/0/1
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.0/24 Direct 0 0 192.168.1.1 Loop0
192.168.1.0/32 Direct 0 0 192.168.1.1 Loop0
192.168.1.1/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.255/32 Direct 0 0 192.168.1.1 Loop0
192.168.2.0/24 Direct 0 0 192.168.2.1 Loop1
192.168.2.0/32 Direct 0 0 192.168.2.1 Loop1
192.168.2.1/32 Direct 0 0 127.0.0.1 InLoop0
192.168.2.255/32 Direct 0 0 192.168.2.1 Loop1
192.168.3.1/32 OSPF 10 3 10.3.1.1 GE1/0/1
224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0
224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0
255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
# Verify that the After-sale service department cannot reach Marketing department 2.
[DeviceD] ping -a 192.168.1.1 192.168.5.1
Ping 192.168.5.1 (192.168.5.1) from 192.168.1.1: 56 data bytes, press CTRL_C to
break
Request time out
Request time out
Request time out
Request time out
Request time out
--- Ping statistics for 192.168.5.1 ---
5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss
# Verify that R&D department 1 cannot reach Marketing department 2.
[DeviceD] ping -a 192.168.2.1 192.168.5.1
Ping 192.168.5.1 (192.168.5.1) from 192.168.2.1: 56 data bytes, press CTRL_C to
break
Request time out
Request time out
Request time out
Request time out
Request time out
--- Ping statistics for 192.168.5.1 ---
5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss
The output on Device C and Device D shows that Device E has filtered the route destined for R&D development 2.
Configuration files
Device A
#
ospf 1
area 0.0.0.0
network 10.1.1.0 0.0.0.255
area 0.0.0.1
network 10.4.1.0 0.0.0.255
area 0.0.0.2
network 10.2.1.0 0.0.0.255
#
interface GigabitEthernet1/0/1
port link-mode route
ip address 10.1.1.1 255.255.255.0
#
interface GigabitEthernet1/0/2
port link-mode route
ip address 10.2.1.1 255.255.255.0
#
interface GigabitEthernet1/0/3
port link-mode route
ip address 10.4.1.1 255.255.255.0
#
Device B
#
ospf 1
area 0.0.0.0
network 10.1.1.0 0.0.0.255
area 0.0.0.3
network 10.3.1.0 0.0.0.255
#
interface GigabitEthernet1/0/1
port link-mode route
ip address 10.1.1.2 255.255.255.0
#
interface GigabitEthernet1/0/2
port link-mode route
ip address 10.3.1.1 255.255.255.0
#
Device C
#
ospf 1
filter-policy 2000 import
area 0.0.0.2
network 10.2.1.0 0.0.0.255
network 192.168.3.0 0.0.0.255
#
interface LoopBack0
ip address 192.168.3.1 255.255.255.0
#
interface GigabitEthernet1/0/1
port link-mode route
ip address 10.2.1.2 255.255.255.0
#
acl number 2000
rule 0 deny source 192.168.2.0 0.0.0.255
rule 5 permit
#
Device D
#
ospf 1
filter-policy 2000 import
area 0.0.0.3
network 10.3.1.0 0.0.0.255
network 192.168.1.0 0.0.0.255
network 192.168.2.0 0.0.0.255
#
interface LoopBack0
ip address 192.168.1.1 255.255.255.0
#
interface LoopBack1
ip address 192.168.2.1 255.255.255.0
#
interface GigabitEthernet1/0/1
port link-mode route
ip address 10.3.1.2 255.255.255.0
#
acl number 2000
rule 0 deny source 192.168.5.0 0.0.0.255
rule 5 permit
#
Device E
#
ospf 1
import-route direct
import-route rip 1
filter-policy 2000 export rip 1
area 0.0.0.1
network 10.4.1.0 0.0.0.255
#
rip 1
undo summary
version 2
network 10.5.1.0 0.0.0.255
import-route direct
import-route ospf 1
#
interface GigabitEthernet1/0/1
port link-mode route
ip address 10.4.1.2 255.255.255.0
#
interface GigabitEthernet1/0/2
port link-mode route
ip address 10.5.1.1 255.255.255.0
#
acl number 2000
rule 0 deny source 192.168.4.0 0.0.0.255
rule 5 permit
#
Device F
#
rip 1
undo summary
version 2
network 10.5.1.0 0.0.0.255
network 192.168.4.0
network 192.168.5.0
#
interface LoopBack0
ip address 192.168.4.1 255.255.255.0
#
interface LoopBack1
ip address 192.168.5.1 255.255.255.0
#
interface GigabitEthernet1/0/1
port link-mode route
ip address 10.5.1.2 255.255.255.0
#
Related documentation
· Layer 3—IP Routing Configuration Guide in H3C MSR1000[2600][3600] Routers Configuration Guides(V9)
· Layer 3—IP Routing Command Reference in H3C MSR1000[2600][3600] Routers Configuration Guides(V9)