Setting MED (?) for a specific BGP route
Hi guys I've got a network with two BGP routers (60.234.a.b and 121.98.a.b) with a single upstream ISP for both. I also have an OSPF setup between the routers. Both runing Bird 1.3.4. Each router has a "local" directly attached DMZ subnet (60.234.x.224/28 and 121.98.x.208/28) and exports that to BGP. It also receives the other router's DMZ address through OSPF and re-exports that to BGP as well. I'm not very familiar with BGP but it seems to work pretty well. From outside the traffic to DMZ 60 goes straight to router 60 and the traffic to DMZ 121 goes straight to router 121. Now I moved part of the 60 subnet (one /32 for now) to the 121 DMZ and here's what the routers export: router 60 birdc> show route export bgp_orcon 60.234.x.224/28 dev eth1 [direct1 Mar13] * (240) 60.234.x.236/32 via 172.31.253.2 on tunO2Oorc4 [ospf_eit Mar16] * E2 (150/10/10000) [121.98.a.b] 121.98.x.208/28 via 172.31.253.2 on tunO2Oorc4 [ospf_eit Mar13] * E2 (150/10/10000) [121.98.a.b] router 121 birdc> show route export bgp_orcon 60.234.x.224/28 via 172.31.253.1 on tunO2Oorc4 [ospf_eit Mar13] * E2 (150/10/10000) [60.234.a.b] 60.234.x.236/32 via 121.98.x.221 on vlan121 [kernel1 Mar20] * (10) 121.98.x.208/28 dev vlan121 [direct1 Mar13] * (240) The ISP is happy to accept /32's from us but for some reason traceroute to 60.234.x.236/32 still goes to the router 60 instead of router 121. The ISP suggested to alter MED or prepend our ASN once again to the /32 announcements on the router 60 to give precedence to the router 121. I tried prepending the ASN on router 60 with: export filter { if source = RTS_OSPF then { bgp_path.prepend(64526); } [...] } But that didn't make any difference. Now I've got these questions: 1. How do I alter MED for a specific route on one of the routers? 2. How can I get more details about the exported routes? Like the MED, BGP path, etc? Just to make sure my filters do what I want them to do. Thanks for any pointers! Michal
On Mon, Apr 02, 2012 at 03:26:51PM +1200, Michal Ludvig wrote:
export filter { if source = RTS_OSPF then { bgp_path.prepend(64526); } [...] } But that didn't make any difference.
Just quick answer:
Now I've got these questions: 1. How do I alter MED for a specific route on one of the routers?
import filter { if net = 1.2.3.4/24 then { bgp_med = xxx; } [...] }
2. How can I get more details about the exported routes? Like the MED, BGP path, etc? Just to make sure my filters do what I want them to do.
Add 'all' to the show route command: show route all show route 1.2.3.4/24 all -- Elen sila lumenn' omentielvo Ondrej 'SanTiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
On 04/03/2012 04:30 AM, Ondrej Zajicek wrote:
Now I've got these questions: 1. How do I alter MED for a specific route on one of the routers? import filter { if net = 1.2.3.4/24 then { bgp_med = xxx; } [...] }
Is there any way to autogenerate MED from IGP? For instance in my case I've got: if source = RTS_OSPF then { bgp_med = 200; } That works for now with this hardcoded value. However we're going to add one more POP with OSPF+BGP and then I want the MED to reflect the internal distance to the given subnet. Like this: [POP1] --- [POP2] --- [POP3] The prefix local to POP1 should be announced from all POPs to our BGP upstream with the lowest MED from POP1, higher from POP2 and the highest MED from POP3. Can I somehow do that automatically?
2. How can I get more details about the exported routes? Like the MED, BGP path, etc? Just to make sure my filters do what I want them to do. Add 'all' to the show route command:
show route all show route 1.2.3.4/24 all
That's the one, thanks! Michal
On 04/03/2012 10:38 AM, Michal Ludvig wrote:
Is there any way to autogenerate MED from IGP? For instance in my case I've got: if source = RTS_OSPF then { bgp_med = 200; }
That works for now with this hardcoded value. However we're going to add one more POP with OSPF+BGP and then I want the MED to reflect the internal distance to the given subnet.
Like this: [POP1] --- [POP2] --- [POP3]
The prefix local to POP1 should be announced from all POPs to our BGP upstream with the lowest MED from POP1, higher from POP2 and the highest MED from POP3. Can I somehow do that automatically?
Just found one way: if source = RTS_OSPF_EXT2 then { bgp_med = ospf_metric1; } It seems to work but is it a good idea? Thx Michal
On Tue, Apr 03, 2012 at 10:58:20AM +1200, Michal Ludvig wrote:
On 04/03/2012 10:38 AM, Michal Ludvig wrote:
Is there any way to autogenerate MED from IGP? For instance in my case I've got: if source = RTS_OSPF then { bgp_med = 200; }
That works for now with this hardcoded value. However we're going to add one more POP with OSPF+BGP and then I want the MED to reflect the internal distance to the given subnet.
Like this: [POP1] --- [POP2] --- [POP3]
The prefix local to POP1 should be announced from all POPs to our BGP upstream with the lowest MED from POP1, higher from POP2 and the highest MED from POP3. Can I somehow do that automatically?
Just found one way: if source = RTS_OSPF_EXT2 then { bgp_med = ospf_metric1; }
It seems to work but is it a good idea?
This is a good way (assuming that you are aware that you use metric _1_ for EXT _2_ routes, which is probably not officially documented, but it contains OSPF metric to the router originating that EXT2 route, regardless of its ospf_metric2 value). One possible problem is that local prefix is probably from static protocol, so you would need a separate case. -- Elen sila lumenn' omentielvo Ondrej 'SanTiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
participants (2)
-
Michal Ludvig -
Ondrej Zajicek