Here is what we did to get the peering going:-
Recipe for Cogent Peering (A & B) IPV4 on a Mikrotik Router.
First:-
add a loopback bridge you can name it what you like, we did 'cogent-loopback' assign it the /32 IP address as provided by Cogent
add another loopback for your own router ID, and assign it a ip address from your own prefix range (/32)
Second:
Add your Network Prefix as well as the /32 for the loop back to be advertised.
/routing bgp network
38.127.xx.0/yy no
38.xx.xx.169/32 no
Third:- (add your filters and bgp config).
Add the default instance,
name="default" as=40xxx router-id=(your selected Router Loopback iP) redistribute-connected=no redistribute-static=no redistribute-rip=no redistribute-ospf=no redistribute-other-bgp=no out-filter=hiq-redistribute client-to-client-reflection=no ignore-as-path-len=no routing-table=""
<<<<<<<<<<<<<<<<<You can change redistribute connected / redistribute static as needed, we are using an out filter to control that).>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Add the two Peers for Cogent, Peer A is for sending out the routes, and only recieving a single /32, which Peer B is going to use for Recieving Routes.
Remote Address of Peer B is the /32 sent back from Cogent. (loopback address on the router sending the full table on Cogent Side).
/routing bgp peer
name="COG-MIA1" instance=default remote-address=38.122.xx.5 remote-as=174 tcp-md5-key="" nexthop-choice=default multihop=no route-reflect=no hold-time=3m ttl=default
in-filter=cog-in out-filter=cog-out address-families=ip update-source=cogent-loopback default-originate=never remove-private-as=yes as-override=no passive=no use-bfd=no
name="COG-MIA2" instance=default remote-address=38.xx.xx.168 remote-as=174 tcp-md5-key="" nexthop-choice=force-self multihop=yes route-reflect=no hold-time=3m ttl=default
in-filter=cog-in out-filter=cog-b-out address-families=ip update-source=cogent-loopback default-originate=never remove-private-as=yes as-override=no passive=no use-bfd=no
Since we are using filters and setting some bgp communities, here is our filters that go with the above config.
chain=cog-in match-chain=junk invert-match=no action=discard
chain=cog-in prefix=38.xx.66.168 invert-match=no action=accept
chain=cog-in match-chain=not-to-specific invert-match=no action=accept set-in-nexthop=38.122.xx.5 set-bgp-prepend=1 append-bgp-communities=40xxx:666
<<<<< the specific prefixes are defined in the chains being referenced, since we have a bunch, and we re-use them, but you can simplify the config, by specifying prefix in the filter rather than making a reference to another chain. Additionally we are changing the default gateway of incoming bgp table to the outgoing interface of the connected router>>>>>>>>>>>>
chain=cog-out prefix=38.xx.xx.169 invert-match=no action=accept
chain=cog-out match-chain=HQD-40xxx invert-match=no action=accept
chain=cog-out match-chain=SDF-11xxx invert-match=no action=accept
chain=cog-out match-chain=SDG-10xxx invert-match=no action=accept
chain=cog-out bgp-communities=4xxxx4:115 invert-match=no action=accept
chain=cog-out invert-match=no action=discard
<<<<< (above) is how we are advertising routes>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
chain=cog-b-out invert-match=no action=discard
<<<<<<<<<<< this is to make sure we don't sent the routing table out again on Peer B>>>>>>>>>>>>>>>>>>>>>>
Open to suggestion and comments for improvements..
Thanks.