Example for Importing Routes to RIP
Networking Requirements
As shown in Figure 3-10, two RIP processes, RIP100 and RIP200, run on SwitchB. SwitchA needs to communicate with network segment 192.168.3.0/24.
Configuration Roadmap
The configuration roadmap is as follows:
Enable RIP on each switch to implement network connections between processes.
On SwitchB, import routes between RIP100 and RIP200 and set the default metric of routes imported from RIP200 to 3.
Configure an ACL on SwitchB to filter route 192.168.4.0/24 imported from RIP200.
Procedure
- Name the device. The configuration procedure is not provided here.
- Configure a VLAN and an IP address for each interface. The configuration procedure is not provided here.
- Configure basic RIP functions.
# Enable RIP100 on SwitchA.
[~SwitchA] rip 100
[*SwitchA-rip-100] network 192.168.0.0
[*SwitchA-rip-100] network 192.168.1.0
[*SwitchA-rip-100] commit
[~SwitchA-rip-100] quit
# Enable RIP100 and RIP200 on SwitchB.
[~SwitchB] rip 100
[*SwitchB-rip-100] network 192.168.1.0
[*SwitchB-rip-100] commit
[~SwitchB-rip-100] quit
[~SwitchB] rip 200
[*SwitchB-rip-200] network 192.168.2.0
[*SwitchB-rip-200] commit
[~SwitchB-rip-200] quit
# Enable RIP200 on SwitchC.
[~SwitchC] rip 200
[*SwitchC-rip-200] network 192.168.2.0
[*SwitchC-rip-200] network 192.168.3.0
[*SwitchC-rip-200] network 192.168.4.0
[*SwitchC-rip-200] commit
[~SwitchC-rip-200] quit
# Display the routing table of SwitchA.
[~SwitchA] display ip routing-table
Proto: Protocol Pre: Preference Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route
------------------------------------------------------------------------------
Routing Table: _public_
Destinations : 10 Routes : 10
Destination/Mask Proto Pre Cost Flags NextHop Interface
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.0.0/24 Direct 0 0 D 192.168.0.1 Vlanif50
192.168.0.1/32 Direct 0 0 D 127.0.0.1 Vlanif50
192.168.0.255/32 Direct 0 0 D 127.0.0.1 Vlanif50
192.168.1.0/24 Direct 0 0 D 192.168.1.1 Vlanif10
192.168.1.1/32 Direct 0 0 D 127.0.0.1 Vlanif10
192.168.1.255/32 Direct 0 0 D 127.0.0.1 Vlanif10
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
The routing table of SwitchA does not contain the routes imported from other processes.
- Configure RIP to import external routes.
# On SwitchB, set the default metric of imported routes to 3 and configure the RIP processes to import routes into each other's routing table.
[~SwitchB] rip 100
[~SwitchB-rip-100] default-cost 3
[*SwitchB-rip-100] import-route rip 200
[*SwitchB-rip-100] quit
[*SwitchB] rip 200
[*SwitchB-rip-200] import-route rip 100
[*SwitchB-rip-200] quit
[*SwitchB] commit
# Display the routing table of SwitchA after the routes are imported.
[~SwitchA] display ip routing-table
Proto: Protocol Pre: Preference Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route
------------------------------------------------------------------------------
Routing Table: _public_
Destinations : 13 Routes : 13
Destination/Mask Proto Pre Cost Flags NextHop Interface
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.0.0/24 Direct 0 0 D 192.168.0.1 Vlanif50
192.168.0.1/32 Direct 0 0 D 127.0.0.1 Vlanif50
192.168.0.255/32 Direct 0 0 D 127.0.0.1 Vlanif50
192.168.1.0/24 Direct 0 0 D 192.168.1.1 Vlanif10
192.168.1.1/32 Direct 0 0 D 127.0.0.1 Vlanif10
192.168.1.255/32 Direct 0 0 D 127.0.0.1 Vlanif10
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.2.0/24 RIP 100 4 D 192.168.1.2 Vlanif10
192.168.3.0/24 RIP 100 4 D 192.168.1.2 Vlanif10
192.168.4.0/24 RIP 100 4 D 192.168.1.2 Vlanif10
The RIP routing table of SwitchA contains routes 192.168.2.0/24, 192.168.3.0/24, and 192.168.4.0/24, which are learned by RIP200 on SwitchB.
- Configure RIP to filter imported routes.
# Configure an ACL on SwitchB and add a rule to the ACL. The rule denies the packets sent from 192.168.4.0/24.
[~SwitchB] acl 2000
[*SwitchB-acl4-basic-2000] rule deny source 192.168.4.0 0.0.0.255
[*SwitchB-acl4-basic-2000] rule permit
[*SwitchB-acl4-basic-2000] quit
# Configure SwitchB to filter route 192.168.4.0/24 imported from RIP200.
[*SwitchB] rip 100
[*SwitchB-rip-100] filter-policy 2000 export
[*SwitchB-rip-100] quit
[*SwitchB] commit
- Verify the configuration.
# Display the RIP routing table of SwitchA after the routes are filtered.
[~SwitchA] display ip routing-table
Proto: Protocol Pre: Preference Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route
------------------------------------------------------------------------------
Routing Table: _public_
Destinations : 12 Routes : 12
Destination/Mask Proto Pre Cost Flags NextHop Interface
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.0.0/24 Direct 0 0 D 192.168.0.1 Vlanif50
192.168.0.1/32 Direct 0 0 D 127.0.0.1 Vlanif50
192.168.0.255/32 Direct 0 0 D 127.0.0.1 Vlanif50
192.168.1.0/24 Direct 0 0 D 192.168.1.1 Vlanif10
192.168.1.1/32 Direct 0 0 D 127.0.0.1 Vlanif10
192.168.1.255/32 Direct 0 0 D 127.0.0.1 Vlanif10
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.2.0/24 RIP 100 4 D 192.168.1.2 Vlanif10
192.168.3.0/24 RIP 100 4 D 192.168.1.2 Vlanif10
The RIP routing table of SwitchA does not contain the route originating from 192.168.4.0/24.
Configuration Files
# Configuration file of SwitchA
#
sysname SwitchA
#
vlan batch 10 50
#
interface Vlanif10
ip address 192.168.1.1 255.255.255.0
#
interface Vlanif50
ip address 192.168.0.1 255.255.255.0
#
interface 10GE1/0/1
port link-type trunk
port trunk allow-pass vlan 50
#
interface 10GE1/0/2
port link-type trunk
port trunk allow-pass vlan 10
#
rip 100
network 192.168.0.0
network 192.168.1.0
#
return
# Configuration file of SwitchB
#
sysname SwitchB
#
vlan batch 10 20
#
acl number 2000
rule 5 deny source 192.168.4.0 0.0.0.255
rule 10 permit
#
interface Vlanif10
ip address 192.168.1.2 255.255.255.0
#
interface Vlanif20
ip address 192.168.2.1 255.255.255.0
#
interface 10GE1/0/1
port link-type trunk
port trunk allow-pass vlan 20
#
interface 10GE1/0/2
port link-type trunk
port trunk allow-pass vlan 10
#
rip 100
default-cost 3
network 192.168.1.0
filter-policy 2000 export
import-route rip 200
#
rip 200
network 192.168.2.0
import-route rip 100
#
return
# Configuration file of SwitchC
#
sysname SwitchC
#
vlan batch 20 30 40
#
interface Vlanif20
ip address 192.168.2.2 255.255.255.0
#
interface Vlanif30
ip address 192.168.3.1 255.255.255.0
#
interface Vlanif40
ip address 192.168.4.1 255.255.255.0
#
interface 10GE1/0/1
port link-type trunk
port trunk allow-pass vlan 20
#
interface 10GE1/0/2
port link-type trunk
port trunk allow-pass vlan 30
#
interface 10GE1/0/3
port link-type trunk
port trunk allow-pass vlan 40
#
rip 200
network 192.168.2.0
network 192.168.3.0
network 192.168.4.0
#
return