Tuesday, October 6, 2015

Configure bgp peering between cisco and mikrotik

**** information ****
cisco:
- AS Number: 13001
- ip address: 192.168.202.24
- prefix to advertise: 192.168.1.0/24 and 192.168.0.0/24

mikrotik:
- AS Number: 13002
- ip address: 192.168.202.102
- prefix to advertise: 192.168.4.0/24 and 192.168.5.0/24



1- Cisco router running configuration

!        
interface FastEthernet0/0
 ip address 192.168.202.24 255.255.255.0
 duplex auto
 speed auto
!        
interface FastEthernet0/1
 ip address 192.168.0.1 255.255.255.0
 duplex auto
 speed auto
!        
interface FastEthernet1/0
 ip address 192.168.1.1 255.255.255.0
 duplex auto
 speed auto
!        
!        
router bgp 13001
 bgp always-compare-med
 no bgp enforce-first-as
 bgp log-neighbor-changes
 neighbor MK-RS peer-group
 neighbor MK-RS remote-as 13002
 neighbor MK-RS version 4
 neighbor 192.168.202.102 peer-group MK-RS
 !       
 address-family ipv4
 neighbor MK-RS next-hop-self
 neighbor MK-RS soft-reconfiguration inbound
 neighbor MK-RS route-map TO-MK-RS out
 neighbor 192.168.202.102 activate
 no auto-summary
 no synchronization
 network 192.168.0.0
 network 192.168.1.0
 exit-address-family
!        
!        
!        
ip http server
no ip http secure-server
!        
!        
ip prefix-list TO-MK-RS seq 10 permit 192.168.0.0/24
ip prefix-list TO-MK-RS seq 20 permit 192.168.1.0/24
!        
route-map TO-MK-RS permit 10
 match ip address prefix-list TO-MK-RS




 2- Mikrotik bgp command

/routing bgp instance
set default as=13002


/routing bgp network
add network=192.168.5.0/24 synchronize=no
add network=192.168.4.0/24 synchronize=no


/routing bgp peer
add in-filter=CS-IN name=CS-RS out-filter=CS-OUT remote-address=\
    192.168.202.24 remote-as=13001 ttl=default


/routing filter
add action=accept chain=CS-IN
add action=accept chain=CS-OUT prefix=192.168.5.0/24
add action=accept chain=CS-OUT prefix=192.168.4.0/24
add action=discard chain=CS-OUT


3- route show

ip route print
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
 #      DST-ADDRESS        PREF-SRC        GATEWAY            DISTANCE
 0 A S  0.0.0.0/0                          192.168.202.1             1
 1 ADb  192.168.0.0/24                     192.168.202.24           20
 2 ADb  192.168.1.0/24                     192.168.202.24           20
 3 ADC  192.168.5.0/24     192.168.5.254   ether4                    0
 4 ADC  192.168.5.254/32   192.168.5.254   vrrp1                     0
 5 ADC  192.168.202.0/24   192.168.202.102 ether1                    0


----------------------------------------------------------

show ip route
Codes: 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

Gateway of last resort is not set

B    192.168.4.0/24 [20/0] via 192.168.202.102, 00:09:21
B    192.168.5.0/24 [20/0] via 192.168.202.102, 00:18:33
C    192.168.202.0/24 is directly connected, FastEthernet0/0
C    192.168.0.0/24 is directly connected, FastEthernet0/1
C    192.168.1.0/24 is directly connected, FastEthernet1/0


No comments:

Post a Comment