H3C - 05-Layer 3 - IP Routing Configuration Examples-H3C - OSPF - Configuration - Examples
H3C - 05-Layer 3 - IP Routing Configuration Examples-H3C - OSPF - Configuration - Examples
Copyright © 2017 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.
The information in this document is subject to change without notice.
Contents
Introduction ····································································································· 1
Prerequisites ··································································································· 1
Example: Configuring OSPF route filtering ····················································· 1
Network configuration ········································································································································ 1
Software versions used ······································································································································ 2
Restrictions and guidelines ································································································································ 2
Procedures ························································································································································· 2
Configuring IP addresses ··························································································································· 2
Configuring OSPF ······································································································································ 2
Configure RIP············································································································································· 3
Configuring route redistribution ·················································································································· 4
Configuring OSPF route filtering ················································································································ 5
Verifying the configuration·························································································································· 5
Configuration files ·············································································································································· 8
Related documentation ················································································· 10
i
Introduction
This document provides OSPF route filtering configuration examples.
Prerequisites
This document is not restricted to specific software or hardware versions.
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.
Area 2 Area 3
Vlan-int200 Vlan-int300
Mkt Dept. 2 R&D Dept. 2
Device C Device D
RIP OSPF
After-sale
Mkt Dept. 1 R&D Dept. 1
Dept.
1
Vlan-int400 10.4.1.1/24
Device C Vlan-int200 10.2.1.2/24 Device D Vlan-int300 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 Vlan-int400 10.4.1.2/24 Device F Vlan-int500 10.5.1.2/24
Vlan-int500 10.5.1.1/24 Loop0 192.168.4.1/24
Loop1 192.168.5.1/24
Procedures
Configuring IP addresses
# Configure an IP address for VLAN-interface 100.
<DeviceA> system-view
[DeviceA] interface vlan-interface 100
[DeviceA-Vlan-interface100] ip address 10.1.1.1 24
# Configure IP addresses for other interfaces, as shown in Figure 1. (Details not shown.)
Configuring OSPF
# Enable OSPF on Device A.
<DeviceA> system-view
[DeviceA] ospf
[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
2
[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
Configure RIP
# Enable RIP on Device E.
<DeviceE> system-view
[DeviceE] rip
[DeviceE-rip-1] version 2
[DeviceE-rip-1] undo summary
[DeviceE-rip-1] network 10.5.1.0 0.0.0.255
3
[DeviceE-rip-1] quit
Destinations : 24 Routes : 24
4
192.168.3.1/32 OSPF 10 2 10.4.1.1 Vlan400
192.168.4.0/24 RIP 100 1 10.5.1.2 Vlan500
192.168.5.0/24 RIP 100 1 10.5.1.2 Vlan500
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.)
Destinations : 22 Routes : 22
5
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 Vlan200
10.2.1.0/24 Direct 0 0 10.2.1.2 Vlan200
10.2.1.0/32 Direct 0 0 10.2.1.2 Vlan200
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 Vlan200
10.3.1.0/24 OSPF 10 3 10.2.1.1 Vlan200
10.4.1.0/24 OSPF 10 2 10.2.1.1 Vlan200
10.5.1.0/24 OSPF 150 1 10.2.1.1 Vlan200
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 Vlan200
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 Vlan200
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
Destinations : 22 Routes : 22
Destinations : 25 Routes : 25
6
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 Vlan300
10.4.1.0/24 OSPF 10 3 10.3.1.1 Vlan300
10.5.1.0/24 OSPF 150 1 10.3.1.1 Vlan300
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 Vlan300
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
The output on Device C and Device D shows that Device E has filtered the route destined for R&D
development 2.
7
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
#
vlan 100
#
vlan 200
#
vlan 400
#
interface Vlan-interface100
ip address 10.1.1.1 255.255.255.0
#
interface Vlan-interface200
ip address 10.2.1.1 255.255.255.0
#
interface Vlan-interface400
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
#
vlan 100
#
vlan 300
#
interface Vlan-interface100
ip address 10.1.1.2 255.255.255.0
#
interface Vlan-interface300
ip address 10.3.1.1 255.255.255.0
#
• Device C:
#
8
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
#
vlan 200
#
interface LoopBack0
ip address 192.168.3.1 255.255.255.0
#
interface Vlan-interface200
ip address 10.2.1.2 255.255.255.0
#
acl basic 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
#
vlan 300
#
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 Vlan-interface300
ip address 10.3.1.2 255.255.255.0
#
acl basic 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
9
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
#
vlan 400
#
vlan 500
#
interface Vlan-interface400
ip address 10.4.1.2 255.255.255.0
#
interface Vlan-interface500
ip address 10.5.1.1 255.255.255.0
#
acl basic 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
#
vlan 500
#
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 Vlan-interface500
ip address 10.5.1.2 255.255.255.0
#
Related documentation
• H3C S7500E-XS Switch Series Layer 3—IP Routing Command Reference-R7536P05
10
• H3C S7500E-XS Switch Series Layer 3—IP Routing Configuration Guide-R7536P05
11