07-30-2019 05:37 AM - edited 08-03-2019 09:25 AM
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.
Solved! Go to Solution.
08-01-2019 08:10 AM
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
Give this a try and let us know if it works for you.
HTH
Rick
08-01-2019 06:57 PM
07-30-2019 09:01 AM
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
07-30-2019 08:42 PM
07-31-2019 06:58 AM
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
08-01-2019 06:29 AM
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?
08-01-2019 08:10 AM
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
Give this a try and let us know if it works for you.
HTH
Rick
08-01-2019 09:22 AM
08-01-2019 10:15 AM
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
08-01-2019 06:57 PM
08-03-2019 07:12 AM
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
08-03-2019 09:23 AM - edited 08-03-2019 09:41 AM
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
08-04-2019 05:06 AM
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
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide