cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2991
Views
0
Helpful
11
Replies

IOS XE 16 route-map to dialer interface?

Jamesits
Level 1
Level 1

I have 2 dialer interfaces from 2 ISPs and I want to do a policy based routing setup using a dynamic routing protocol. Is this possible with IOS XE 16.9?

 

route-map seems doesn't allow me to use dialer interface as next-hop, or use the default route in a vrf.

2 Accepted Solutions

Accepted Solutions

Thanks for the information. I am not clear how you will feed the BGP routes to your router, but probably I don't need to understand that. You asked a question about PBR and I have a suggestion. On most platforms implementation of PBR there is an option to set interface (different from set ip next-hop) and I believe that is what you are looking for. Here is a link to some documentation about that

https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/iproute_pi/command/iri-cr-book/iri-cr-s1.html#wp8125902120

 

Give this a try and let us know if it works for you.

 

HTH

 

Rick

HTH

Rick

View solution in original post

Yes I'm doing PBR, but the policy is not static, instead they are controlled dynamically via BGP (if this route has community 100:100 then set outgoing interface to Dialer0, else to Dialer1). Here BGP is not used to actually provide straightforward routing information.

Anyway I found the solution using recursive routes.

ip route 192.0.2.100 255.255.255.255 Dialer 1 10
ip route 192.0.2.200 255.255.255.255 Dialer 0 10

Then in route-map I can use
set ip next-hop 192.0.2.100
to set interface to Dialer1

Thank you Richard!

View solution in original post

11 Replies 11

Richard Burts
Hall of Fame
Hall of Fame

If I am understanding the post correctly you have 2 ISP, and each ISP is reached via its own dialer interface. And you want to use BGP to exchange routes with both ISP. In that case I do not see where route maps come into the issue. You would configure both dialer interfaces with appropriate parameters and would configure BGP with neighbor statements for both ISP. Depending on the dialers and the addressing used it might be needed to have static routes for each BGP neighbor address pointing to the appropriate dialer interface. If I am not correct in my understanding them please provide clarification.

 

HTH

 

Rick

HTH

Rick

Sorry I didn't make that clear. the ISPs don't support BGP so I need to get a full table somewhere else and map the routes using as-path.

I am a bit confused. In the original post you told us that you wanted to use BGP with 2 ISP. Now you tell us that the ISP do not support BGP. In the original post you also stated that you wanted to use dynamic routing. Is that also now not the case?

 

Knowing only the very small amount that we have so far it seems to me that you could configure a set of static routes to send some traffic to one ISP and other traffic to the other ISP. And I still do not understand where route maps would be used.

 

HTH

 

Rick

HTH

Rick

OK let me make this clear. I have 2 ISPs connected to the router via PPPoE. They don't support BGP and they won't let me announce my own IPs, and I need NAT overload on both Dialer interfaces. Still, I want to achieve some sort of load balancing, but network is very complicated here and I cannot just distribute traffic equally to the 2 Dialer interfaces. So here is my plan:

 

1. Get a BGP full table from somewhere else

2. Feed the full table to the router and let the router select which Dialer interface to go for a certain destination IP using a set of pre-defined rules based on AS-PATH regex

 

My problem is: Because the BGP full table is got from somewhere else (multihop), the next-hop will unlikely to work. Thus it is mandatory for me to use route-map to re-set the next-hop to one of the 2 Dialer interfaces based on AS-PATH matching. But since a Dialer with dynamic IP doesn't have a fixed next-hop IP address, I need a way to make a route-map able to set next-hop to a Dialer interface not a fixed IP address. Is there any function I can achieve this?

Thanks for the information. I am not clear how you will feed the BGP routes to your router, but probably I don't need to understand that. You asked a question about PBR and I have a suggestion. On most platforms implementation of PBR there is an option to set interface (different from set ip next-hop) and I believe that is what you are looking for. Here is a link to some documentation about that

https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/iproute_pi/command/iri-cr-book/iri-cr-s1.html#wp8125902120

 

Give this a try and let us know if it works for you.

 

HTH

 

Rick

HTH

Rick

When I'm trying to set that route-map on the BGP neighbor, it says:

%"PBR" used as BGP inbound route-map, set interface not supported

So I guess the straightforward way doesn't work. Is there any workaround on this?

I certainly did not correctly understand what you were trying to do with the route map. set ip next-hop and set interface are used in route maps when they are used for Policy Based Routing. So I assumed that you were using PBR to change the interface for traffic on its way out of your network. Now I understand that you are using the route map on a BGP neighbor. I do not believe that there is any way to change the next hop parameter in a route advertisement in BGP.

 

HTH

 

Rick

HTH

Rick

Yes I'm doing PBR, but the policy is not static, instead they are controlled dynamically via BGP (if this route has community 100:100 then set outgoing interface to Dialer0, else to Dialer1). Here BGP is not used to actually provide straightforward routing information.

Anyway I found the solution using recursive routes.

ip route 192.0.2.100 255.255.255.255 Dialer 1 10
ip route 192.0.2.200 255.255.255.255 Dialer 0 10

Then in route-map I can use
set ip next-hop 192.0.2.100
to set interface to Dialer1

Thank you Richard!

That certainly is a creative solution. I am glad that my suggestions were helpful. I am concerned about how it will work when you apply it to inbound BGP advertisements. If you do get it to work please send us an update to confirm how you did it.

 

HTH

 

Rick

HTH

Rick

It does work as expected. I have a blog post on the whole setup: https://blog.swineson.me/bgp-at-home-1-multi-isp-policy-routing/  (written in Chinese). I'll describe my setup here in English if anyone in the future is interested in this.

 

Problem: PBR on 2 Dialer interfaces, but the policy is auto-generated from a BGP full table using AS-PATH filters

Solution:

 

Step 1. Get a BGP full table

I have an ASN so it is easy for me to get a BGP full table on some cloud VPS (lots of providers can do this). Then I established an iBGP session between the VPS and a VM in my LAN. (Since my LAN outbound IP is dynamically allocated, I used a TCP forwarder service to avoid reconfiguring BGP peer IP every time; any tunnel/VPN can achieve this too.)

 

Step 2. Write policies

In this step, we encode the rules we need into BGP communities. I used Bird 2 as the BGP daemon since they provide an intuitive config format. A simplified version of my filter rules for demo purposes:

define cmcc_asn = [
        56041
];
define chinanet_asn = [
        4809,
        4134
];
filter policy_routing {
        if source != RTS_BGP then reject;
        # CMCC
        if bgp_path.last ~ cmcc_asn then {
                bgp_community = -empty-;
                bgp_community.add((100,100));
                accept;
        }
        # ChinaNet
        if bgp_path.last ~ chinanet_asn then {
                bgp_community = -empty-;
                bgp_community.add((200,200));
                accept;
        }
        reject;
}

Note: we drop (reject) unused routes since my IOS XE router has only 4GiB RAM and a full table cannot fit in that. (Shame on you, Cisco!)

Step 3. Feed the BGP rules to the router

Set up the BGP daemon on the LAN VM as a route reflector, and establish another iBGP session with the gateway router (IOS XE).

Step 4. Apply dynamic route selection on the router

This is very straightforward.

! recursive route to set interface
ip route 192.0.2.100 255.255.255.255 Dialer 1 10
ip route 192.0.2.200 255.255.255.255 Dialer 0 10
! community list ip community-list standard PBR_CMCC permit 100:100 ip community-list standard PBR_CT permit 200:200
! map community list to actual route selection policy route-map PBR permit 10 match community PBR_CMCC set ip next-hop 192.0.2.100 route-map PBR permit 20 match community PBR_CT set ip next-hop 192.0.2.200
! BGP session router bgp <asn> bgp log-neighbor-changes neighbor <lan-bgp-rr-ip> remote-as <asn> neighbor <lan-bgp-rr-ip> description BGP Controller address-family ipv4 neighbor <lan-bgp-rr-ip> activate neighbor <lan-bgp-rr-ip> soft-reconfiguration inbound neighbor <lan-bgp-rr-ip> route-map PBR in exit-address-family

 

Thank you for the description of how you did this. I believe that some other participants in the community will find it interesting and useful.

 

HTH

 

Rick

HTH

Rick
Review Cisco Networking for a $25 gift card