osrg / gobgp

BGP implemented in the Go Programming Language
https://osrg.github.io/gobgp/
Apache License 2.0
3.59k stars 684 forks source link

Need to advertise non-existent route #2382

Open na1k3 opened 3 years ago

na1k3 commented 3 years ago

Hi there! The task is - I want to advertise some route, which my server doesn't know. And I can do it by command gobgp global rib -a ipv4 add 172.16.100.0/30 origin igp

BUT - it advertises it to ALL neighbors. I need to advertise it to only a particular neighbor. It can be done by set an export policy. To use the policy I need to declare that neighbor a route-server-client. But when I apply it - the neighbor stops to take a prefix from global rib to announce! So how I can declare and advertise the prefix which my server don`t know from other routing protocols?

root@debian:~# gobgp global rib
   Network              Next Hop             AS_PATH              Age        Attrs
*> 172.16.100.0/30      0.0.0.0                                   03:26:42   [{Origin: i}]

root@debian:~# gobgp neighbor 198.18.91.1 policy
Export policy:
    Default: ACCEPT
    Name grt-export:
        StatementName grt-export_stmt0:
          Conditions:
            PrefixSet: any export-grt-prefix 
          Actions:
             accept

root@debian:~# gobgp policy prefix export-grt-prefix
NAME               PREFIX
export-grt-prefix  172.16.100.0/30 30..30

root@debian:~#  gobgp neighbor 198.18.91.1 | grep Advertised:
    Advertised:             0
mkhachfeh commented 3 years ago

It depends on how you configure the policy and apply it.

I have a similar design, and works for me by using export policy