Community discussions

MikroTik App
 
User avatar
karo84
Member Candidate
Member Candidate
Topic Author
Posts: 194
Joined: Fri Aug 17, 2007 9:06 am

BGP and OSPF together

Fri Dec 21, 2007 2:59 pm

Hi Everyone.
I want to do such setup, I have made this network, (see the attachment),
I want to do BGP and OSPF together,
I want to do balanceing and failover with having BGP and OSPF options on
I use RB 133 and RB 150 for this stage, but if everything goes well, I am planing to enlarge my network.
When the Router 2 goes down the network's topology changes, BGP changes the routes.
but i want to use OSPF for changing routes using the cost parameter, sometimes it does not.
Every time my default route goes from Router 1 to Router 2 and then it goes to Router 5
If I set th cost the for LIne from Router 1 to Router 2 it does not change anything in my routes

Here my all setup
Router 1
/ ip address 
add address=192.168.12.1/24 network=192.168.12.0 broadcast=192.168.12.255 interface="ether1 1-2" comment="To 2-rd Router" disabled=no 
add address=192.168.14.1/24 network=192.168.14.0 broadcast=192.168.14.255 interface="ether3 1-4" comment="To 4-rd Router" disabled=no 
add address=10.0.246.12/24 network=10.0.246.0 broadcast=10.0.246.255 interface="ether2 net" comment="" disabled=no 


/ routing bgp instance 
set default name="default" as=200 router-id=0.0.0.0 redistribute-connected=yes redistribute-static=yes redistribute-rip=no redistribute-ospf=no \
    redistribute-other-bgp=no out-filter="" client-to-client-reflection=yes ignore-as-path-len=no comment="" disabled=no 
/ routing bgp peer 
add name="peer1" instance=default remote-address=192.168.12.2 remote-as=202 tcp-md5-key="" nexthop-choice=default multihop=no route-reflect=no hold-time=10s \
    ttl=1 in-filter="" out-filter="" comment="" disabled=no 
add name="peer2" instance=default remote-address=192.168.14.4 remote-as=204 tcp-md5-key="" nexthop-choice=default multihop=no route-reflect=no hold-time=10s \
    ttl=1 in-filter="" out-filter="" comment="" disabled=no 

/ routing ospf 
set router-id=0.0.0.0 distribute-default=always-as-type-2 redistribute-connected=as-type-2 redistribute-static=no redistribute-rip=no \
    redistribute-bgp=as-type-1 metric-default=1 metric-connected=1 metric-static=20 metric-rip=20 metric-bgp=20 
/ routing ospf area 
set backbone area-id=0.0.0.0 type=default translator-role=translate-candidate authentication=none disabled=no 
add name="local-246" area-id=0.0.0.246 type=default translator-role=translate-never authentication=none default-cost=1 disabled=no 
add name="local-12" area-id=0.0.0.12 type=default translator-role=translate-never authentication=none default-cost=25 disabled=no 
add name="local-14" area-id=0.0.0.14 type=default translator-role=translate-never authentication=none default-cost=1 disabled=no 
add name="local-52" area-id=0.0.0.52 type=default translator-role=translate-never authentication=none default-cost=1 disabled=no 
add name="local-23" area-id=0.0.0.23 type=default translator-role=translate-never authentication=none default-cost=1 disabled=no 
add name="local-35" area-id=0.0.0.35 type=default translator-role=translate-never authentication=none default-cost=1 disabled=no 
add name="local-34" area-id=0.0.0.34 type=default translator-role=translate-never authentication=none default-cost=1 disabled=no 
add name="local-54" area-id=0.0.0.54 type=default translator-role=translate-never authentication=none default-cost=1 disabled=no 
/ routing ospf network 
add network=10.0.246.0/24 area=backbone disabled=no 
add network=192.168.12.0/24 area=local-12 disabled=no 
add network=192.168.14.0/24 area=local-14 disabled=no 
add network=192.168.52.0/24 area=local-52 disabled=no 
add network=192.168.23.0/24 area=local-23 disabled=no 
add network=192.168.35.0/24 area=local-35 disabled=no 
add network=192.168.34.0/24 area=local-34 disabled=no 
add network=192.168.54.0/24 area=local-54 disabled=no 


For Router 2
/ ip address 
add address=192.168.52.2/24 network=192.168.52.0 broadcast=192.168.52.255 interface="ether2 2-5" comment="To 5-rd Router" disabled=no 
add address=192.168.23.2/24 network=192.168.23.0 broadcast=192.168.23.255 interface="ether1 2-3" comment="To 3-rd Router" disabled=no 
add address=192.168.12.2/24 network=192.168.12.0 broadcast=192.168.12.255 interface="ether3 2-1" comment="" disabled=no 

/ routing bgp instance 
set default name="default" as=202 router-id=0.0.0.0 redistribute-connected=yes redistribute-static=yes redistribute-rip=no redistribute-ospf=no \
    redistribute-other-bgp=no out-filter="" client-to-client-reflection=yes ignore-as-path-len=no comment="" disabled=no 
/ routing bgp peer 
add name="peer1" instance=default remote-address=192.168.12.1 remote-as=200 tcp-md5-key="" nexthop-choice=default multihop=no route-reflect=no hold-time=10s \
    ttl=1 in-filter="" out-filter="" comment="" disabled=no 
add name="peer2" instance=default remote-address=192.168.52.5 remote-as=205 tcp-md5-key="" nexthop-choice=default multihop=no route-reflect=no hold-time=10s \
    ttl=1 in-filter="" out-filter="" comment="" disabled=no 
add name="peer3" instance=default remote-address=192.168.23.3 remote-as=203 tcp-md5-key="" nexthop-choice=default multihop=no route-reflect=no hold-time=10s \
    ttl=1 in-filter="" out-filter="" comment="" disabled=no 


/ routing ospf 
set router-id=0.0.0.0 distribute-default=always-as-type-2 redistribute-connected=as-type-2 redistribute-static=no redistribute-rip=no \
    redistribute-bgp=as-type-1 metric-default=1 metric-connected=1 metric-static=20 metric-rip=20 metric-bgp=20 
/ routing ospf area 
set backbone area-id=0.0.0.0 type=default translator-role=translate-candidate authentication=none disabled=no 
add name="local-246" area-id=0.0.0.246 type=default translator-role=translate-never authentication=none default-cost=1 disabled=no 
add name="local-12" area-id=0.0.0.12 type=default translator-role=translate-never authentication=none default-cost=1 disabled=no 
add name="local-14" area-id=0.0.0.14 type=default translator-role=translate-never authentication=none default-cost=1 disabled=no 
add name="local-52" area-id=0.0.0.52 type=default translator-role=translate-never authentication=none default-cost=1 disabled=no 
add name="local-23" area-id=0.0.0.23 type=default translator-role=translate-never authentication=none default-cost=1 disabled=no 
add name="local-35" area-id=0.0.0.35 type=default translator-role=translate-never authentication=none default-cost=1 disabled=no 
add name="local-34" area-id=0.0.0.34 type=default translator-role=translate-never authentication=none default-cost=1 disabled=no 
add name="local-54" area-id=0.0.0.54 type=default translator-role=translate-never authentication=none default-cost=1 disabled=no 
/ routing ospf network 
add network=10.0.246.0/24 area=local-246 disabled=no 
add network=192.168.12.0/24 area=local-12 disabled=no 
add network=192.168.14.0/24 area=local-14 disabled=no 
add network=192.168.52.0/24 area=local-52 disabled=no 
add network=192.168.23.0/24 area=local-23 disabled=no 
add network=192.168.35.0/24 area=local-35 disabled=no 
add network=192.168.34.0/24 area=local-34 disabled=no 
add network=192.168.54.0/24 area=local-54 disabled=no 
And the same configurations are on other routers, how can I do the Balancing failover, and all Dynamic routes, Can anybody help me?
Thanks
with Regards Karapet Aznavuryan


Here my tracert result to my main router
Tracing route to 192.168.254.254 over a maximum of 30 hops

1 1 ms <1 ms <1 ms 10.0.246.12 Router 1
2 2 ms 1 ms 1 ms 192.168.12.2 Router 2
3 2 ms 1 ms 1 ms 192.168.52.5 Router 5
4 2 ms 1 ms 1 ms 192.168.254.254 Router Main

Trace complete.
You do not have the required permissions to view the files attached to this post.
 
awsmith
newbie
Posts: 45
Joined: Wed May 31, 2006 8:18 am

Re: BGP and OSPF together

Wed Jan 02, 2008 11:12 am

If I am understanding your question correctly, you want to know why making changes to the OSPF default cost on area local-12 does not have an affect on your routing.

Without looking at the actual routing tables, my guess is that your problem is that none of your OSPF routes are active as you are doing eBGP between the routers and eBGP has a lower (more preferred) administrative distance than OSPF. None of the OSPF changes you make will be reflected in your routers routing tables if there is an eBGP route for the same prefix.

As for a solution, I first need to ask "What is the problem that you are trying to solve?".

Why are you using BGP (and, for that matter, eBGP) and OSPF, and having them carry the same routes?

If you do not have a need for BGP, I would suggest removing it entirely. If you do have a need for BGP, I would recommend changing to iBGP (have all routers be in the same AS, either a real one assigned to you, or a private ASN between 64512-65534) and go for a full-mesh with peering between a loopback IP (create a bridge called "loopback1" and put a /32 on it) on each router and have OSPF carry reachability for the loopback addresses by creating a network statement for that /32 or redistributing connected. It's also generally good practice to use that IP as the OSPF and BGP router id's. iBGP also has a higher administrative distance than OSPF, and will let OSPF routes be used in your routing table if they are duplicated in iBGP.

As far as your OSPF configuration goes, there is a key distinction to learn there. The "network" statement does not mean "which netblocks can I carry" or "which netblocks are in which areas", it means "which IP interfaces will I speak on and what area will that interface be in".

Instead of trying to manage the interface cost between router 1 and router 2 via the area default cost mechanism, change your OSPF interface list from an "all" entry to an individual entry for each interface you wish to speak OSPF on, and modify the cost on ether3 on router 2 and ether1 on router 1. I also highly suggest using MD5 authentication on your OSPF areas to prevent rogue devices from accidentally creating adjacencies with your routers.

I also wonder why you have each link as it's own separate OSPF area. Each area is supposed to be directly connected to the backbone (area 0.0.0.0) or have a virtual-link back to the backbone. Unless this is some tail network that connects to a larger network that you operate at either then "Router Main" location or the "Network" location where you are learning a large amount of routes, I'd say that you should place all of these routers and their interfaces that connect to each other in area 0.0.0.0 (and the loopback interfaces should you choose that option), redistribute connected and static (if needed) as metric-type-1 (type 2 does not add the hop-by-hop OSPF path cost).

In short, it looks like you're trying to learn, and thats a fantastic thing, but, you do need to make sure that the tools that you are using are there to solve a problem that you have, not decide ahead of time that you want to use OSPF and BGP, and then try to fit them into the network regardless of need.

If you are wanting to learn more about BGP, I highly recommend Bassam Halabi's "Internet Routing Architectures" book. It's taught me most of what I know about BGP.
 
User avatar
karo84
Member Candidate
Member Candidate
Topic Author
Posts: 194
Joined: Fri Aug 17, 2007 9:06 am

Re: BGP and OSPF together

Wed Jan 02, 2008 12:28 pm

Thanks Very Much for attention,
I have large network like the such that I have attached, so I need BGP for dinamicaly change routes when changes the network's architechture and OSPF for finding the shortest path to the Main Router,
Please give me the Link Bassam Halabi's "Internet Routing Architectures" if You can, so I'll know much about BGP,

Thanks Very Much and Happy New Year :)
 
awsmith
newbie
Posts: 45
Joined: Wed May 31, 2006 8:18 am

Re: BGP and OSPF together

Wed Jan 02, 2008 1:08 pm

Who is online

Users browsing this forum: GoogleOther [Bot], matbcvo, PI07R3K, RiStaR, syahpian and 91 guests