Wednesday, February 19, 2020

Cisco Offset-List Command

When you run a routing protocol like EIGRP or OSPF you can influence the metric of the routing protocol by changing the bandwidth (OSPF or EIGRP) or by changing the delay (EIGRP). RIP uses hop count so you need to add some extra routers in between to increase the hop count.
Instead of changing these parameters to influence your routing, you can also use an offset-list.
The offset-list lets you increase the metric when you send a routing update to your neighbor or when you receive it.
You can use this for RIP or EIGRP, it is not supported for OSPF.
Let me show you an example to see what I mean:
R1 R2 Cisco RIP
We have two routers running RIP version 2. The router on the left (R1) has two loopback interfaces that have been advertised in RIP. Here’s what the routing table of R2 looks like:
R2#show ip route rip 
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       + - replicated route, % - next hop override

Gateway of last resort is not set

      1.0.0.0/24 is subnetted, 1 subnets
R        1.1.1.0 [120/1] via 192.168.12.1, 00:00:17, FastEthernet0/0
      11.0.0.0/24 is subnetted, 1 subnets
R        11.11.11.0 [120/1] via 192.168.12.1, 00:00:17, FastEthernet0/0
Nothing special here, we see the two prefixes with a hop count of 1. Let’s increase the hop count of the first prefix by using an outbound offset-list on R1:
R1(config)#router rip
R1(config-router)#offset-list ? 
  <0-99>       Access list of networks to apply offset (0 selects all networks)
  <1300-1999>  Access list of networks to apply offset (expanded range)
  WORD         Access-list name
You need to enter the routing protocol configuration and use the offset-list command. I can choose between all networks or use a standard access-list to make a selection. Let’s use an ACL:
R1(config-router)#offset-list 1 ?
  in   Perform offset on incoming updates
  out  Perform offset on outgoing updates
Once you pick the access-list you have to decide whether the offset-list is in- or outbound. I’ll use outbound so that R2 receives a higher hop count from R1. The last option lets you set the metric:
R1(config-router)#offset-list 1 out ?
  <0-16>  Offset
When you use RIP we don’t have a lot of choice. Let’s try a hop count of 5:
R1(config-router)#offset-list 1 out 5
Last but not least, don’t forget to create the access-list or the offset-list will apply to all prefixes:
R1(config)#access-list 1 permit 1.1.1.0 0.0.0.255
Here’s the result:
R2#show ip route rip 
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       + - replicated route, % - next hop override

Gateway of last resort is not set

      1.0.0.0/24 is subnetted, 1 subnets
R        1.1.1.0 [120/6] via 192.168.12.1, 00:00:17, FastEthernet0/0
      11.0.0.0/24 is subnetted, 1 subnets
R        11.11.11.0 [120/1] via 192.168.12.1, 00:00:17, FastEthernet0/0
Above you can see that prefix 1.1.1.0 /24 has its hop count increase by 5, it’s now 6 in total.
You have now seen the outbound offset-list, let’s try the inbound one. I’ll create an access-list on R2 that increases the hop count of the 11.11.11.0 /24 prefix:
R2(config)#access-list 2 permit 11.11.11.0 0.0.0.255
That’s the access-list, and here’s the offset-list:
R2(config-router)#offset-list 2 in 10
It should increase the hop count of this prefix by 10 whenever R2 learns about this prefix, here’s the routing table of R2:
R2#show ip route rip 
*Aug 21 12:48:19.211: %SYS-5-CONFIG_I: Configured from console by console
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       + - replicated route, % - next hop override

Gateway of last resort is not set

      1.0.0.0/24 is subnetted, 1 subnets
R        1.1.1.0 [120/6] via 192.168.12.1, 00:00:26, FastEthernet0/0
      11.0.0.0/24 is subnetted, 1 subnets
R        11.11.11.0 [120/11] via 192.168.12.1, 00:00:26, FastEthernet0/0
Great! You can see that the total hop count is now 11.
There’s one more little thing I’d like to share about the offset-list. By default the offset-list will be applied to all interfaces, if you only want to influence the metric of routing updates that you receive from a particular interface then you need to specify this. Here’s how:
R2(config-router)#offset-list 2 in 10 ?
  Async               Async interface
  Auto-Template       Auto-Template interface
  BVI                 Bridge-Group Virtual Interface
  CDMA-Ix             CDMA Ix interface
  CTunnel             CTunnel interface
  Dialer              Dialer interface
  FastEthernet        FastEthernet IEEE 802.3
  [output omitted]
When you configure the offset-list you can specify the interface after the metric, here’s an example:
R2(config-router)#offset-list 2 in 10 FastEthernet 0/0
This tells the router only to increase the metric for routing updates that we receive on the FastEthernet 0/0 interface.
hostname R1
!
interface FastEthernet0/0
 ip address 192.168.12.1 255.255.255.0
!
interface Loopback1
 ip address 1.1.1.1 255.255.255.0
!
interface Loopback2
 ip address 11.11.11.11 255.255.255.0
!
router rip
 offset-list 1 out 5
!
access-list 1 permit 1.1.1.0 0.0.0.255
!
end
hostname R2
!
interface FastEthernet0/0
 ip address 192.168.12.2 255.255.255.0
!
router rip
 offset-list 2 in 10
 offset-list 2 in 10 FastEthernet 0/0
!
access-list 2 permit 11.11.11.0 0.0.0.255
!
end
That’s it, that’s all I have to share about the offset-list. I hope this has been helpful, if you have any questions…feel free to leave a comment!

No comments:

Post a Comment