Jump to content
Калькуляторы

bgp quagga странности debian soft router

Вобщем ночером попробовал воплотить в жизнь описанное выше.

Текущий конфиг

router bgp 206538
 bgp router-id 188.130.171.1
 bgp log-neighbor-changes
 network 188.130.171.0/24
 redistribute static
 neighbor 62.141.99.89 remote-as 3216
 neighbor 62.141.99.89 description Bee
 neighbor 62.141.99.89 update-source 62.141.99.90
 neighbor 62.141.99.89 weight 1000
 neighbor 62.141.99.89 soft-reconfiguration inbound
 neighbor 62.141.99.89 route-map Bee-in in
 neighbor 62.141.99.89 route-map Bee-out out
 neighbor 77.95.132.140 remote-as 65002
 neighbor 77.95.132.140 description RKN
 neighbor 77.95.132.140 ebgp-multihop 255
 neighbor 77.95.132.140 update-source 188.130.171.1
 neighbor 77.95.132.140 soft-reconfiguration inbound
 neighbor 77.95.132.140 prefix-list DENY-ANY-PREFIXES in
 neighbor 89.237.47.73 remote-as 28745
 neighbor 89.237.47.73 description TTK
 neighbor 89.237.47.73 update-source 89.237.47.74
 neighbor 89.237.47.73 weight 2000
 neighbor 89.237.47.73 soft-reconfiguration inbound
 neighbor 89.237.47.73 route-map TT-in in
 neighbor 89.237.47.73 route-map TT-out out
 neighbor 188.130.171.2 remote-as 65001
 neighbor 188.130.171.2 description CarbonReductor
 neighbor 188.130.171.2 ebgp-multihop 8
 neighbor 188.130.171.2 soft-reconfiguration inbound
 neighbor 188.130.171.2 route-map BLACKHOLE in
!
access-list TERMINAL permit 127.0.0.1/32
access-list TERMINAL deny any
!
ip prefix-list ANY seq 5 permit any
ip prefix-list DENY-ANY-PREFIXES seq 10 deny 0.0.0.0/0 le 32
ip prefix-list bogons seq 15 permit 0.0.0.0/8 le 32
ip prefix-list bogons seq 20 permit 127.0.0.0/8 le 32
ip prefix-list bogons seq 30 permit 10.0.0.0/8 le 32
ip prefix-list bogons seq 35 permit 172.16.0.0/12 le 32
ip prefix-list bogons seq 40 permit 192.168.0.0/16 le 32
ip prefix-list bogons seq 45 permit 169.254.0.0/16 le 32
ip prefix-list bogons seq 50 permit 224.0.0.0/4 le 32
ip prefix-list bogons seq 55 permit 240.0.0.0/4 le 32
ip prefix-list default seq 10 permit 0.0.0.0/0
ip prefix-list fullview seq 5 permit any
ip prefix-list our-CIDR-blocks seq 5 permit 188.130.171.0/24 le 32
ip prefix-list reduced seq 10 permit 0.0.0.0/0 ge 25
ip prefix-list upstream-out seq 10 permit 188.130.171.0/24
!
ip as-path access-list 1 deny .*
ip as-path access-list PRIV permit _6451[2-9]_
ip as-path access-list PRIV permit _645[2-9][0-9]_
ip as-path access-list PRIV permit _64[6-9][0-9][0-9]_
ip as-path access-list PRIV permit _65[0-9][0-9][0-9]_
!
route-map TT-in deny 100
 match as-path PRIV
!
route-map TT-in deny 110
 match ip address prefix-list bogons
!
route-map TT-in deny 115
 match ip address prefix-list reduced
!
route-map TT-in deny 120
 match ip address prefix-list our-CIDR-blocks
!
route-map TT-in permit 200
!
route-map TT-out permit 100
 match ip address prefix-list upstream-out
!
route-map TT-out deny 200
!
route-map BLACKHOLE permit 10
 match ip address prefix-list ANY
 set community 9930:666 additive
 set local-preference 200
!
route-map Bee-out permit 100
 match ip address prefix-list upstream-out
!
route-map Bee-out deny 200
!
route-map Bee-in deny 100
 match as-path PRIV
!
route-map Bee-in deny 110
 match ip address prefix-list bogons
!
route-map Bee-in deny 115
 match ip address prefix-list reduced
!
route-map Bee-in deny 120
 match ip address prefix-list our-CIDR-blocks
!
route-map Bee-in permit 200
!
line vty
 access-class TERMINAL
!
end

Работает, FV с обеих ног.

AS206538# sh ip bgp sum
BGP router identifier 188.130.171.1, local AS number 206538
RIB entries 1557496, using 166 MiB of memory
Peers 4, using 18 KiB of memory

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
62.141.99.89    4  3216  206115     523        0    0    0 08:40:41   829367
77.95.132.140   4 65002       0       0        0    0    0 never    Active
89.237.47.73    4 28745  303558     526        0    0    0 08:40:44   840314
188.130.171.2   4 65001     530  242625        0    0    0 08:40:44     3687

Total number of neighbors 4

Но есть странности.

Почему-то ничего не анонсится во вторую ногу

sh ip bgp nei 62.141.99.89 adv

(пусто)

И трассировка с обычного клиента во вторую ногу выглядит так

tracert -d  62.141.99.90
Трассировка маршрута к 62.141.99.90 с максимальным числом прыжков 30

  1     1 ms     3 ms     1 ms  192.168.1.1 
  2     1 ms     1 ms     3 ms  10.1.1.1 
  3     1 ms     1 ms     1 ms  62.141.99.90 

Трассировка завершена.

tracert -d  62.141.99.89
Трассировка маршрута к 62.141.99.89 с максимальным числом прыжков 30

  1     1 ms     1 ms     1 ms  192.168.1.1 
  2     1 ms     1 ms     1 ms  10.1.1.1 
  3     4 ms     1 ms     4 ms  188.130.171.65 
  4     *        *        *     Превышен интервал ожидания для запроса.
  5     *        *        *     Превышен интервал ожидания для запроса.

Роуты на сервере при этом

 ip route | grep default
default via 89.237.47.73 dev vlan150  proto zebra

ip route | grep 0.0.0.0
20.0.0.0/11 via 89.237.47.73 dev vlan150  proto zebra
40.0.0.0/19 via 89.237.47.73 dev vlan150  proto zebra
40.0.0.0/10 via 89.237.47.73 dev vlan150  proto zebra
.. и т.д.

Видно, что и во вторую ногу bgp что-то отправил

ip route | grep 62.141.99.89
1.9.206.0/24 via 62.141.99.89 dev vlan502  proto zebra
5.100.224.0/21 via 62.141.99.89 dev vlan502  proto zebra
5.180.30.0/24 via 62.141.99.89 dev vlan502  proto zebra
5.255.200.0/24 via 62.141.99.89 dev vlan502  proto zebra
8.238.70.0/24 via 62.141.99.89 dev vlan502  proto zebra
... и т.д.

Но если посмотреть трассировку до ресурсов, на которые bgp сделал роуты через вторую ногу, то увы:

 traceroute 1.9.206.1
traceroute to 1.9.206.1 (1.9.206.1), 30 hops max, 60 byte packets
 1  62.141.99.89 (62.141.99.89)  5.233 ms  5.221 ms  5.205 ms
 2  * * *
 3  * * *
 4  * * *
 5  * * *
 6  * * *

Если сделать weight одинаковым для обеих ног, т.е. и для второй сказать "neighbor 62.141.99.89 weight 2000", то инет пропадает.

 

AS206538# sh ip bgp 62.141.99.89
BGP routing table entry for 62.141.64.0/18
Paths: (2 available, best #1, table Default-IP-Routing-Table)
  Advertised to non peer-group peers:
  188.130.171.2
  28745 20485 3216
    89.237.47.73 from 89.237.47.73 (176.56.13.1)
      Origin IGP, localpref 100, weight 2000, valid, external, best
      Last update: Wed Mar 17 01:35:35 2021

  3216
    62.141.99.89 from 62.141.99.89 (79.104.32.14)
      Origin IGP, localpref 100, weight 1000, valid, external
      Community: 3216:2001 3216:2999 3216:4100
      Last update: Wed Mar 17 01:48:06 2021

AS206538# sh ip bgp nei 62.141.99.89
BGP neighbor is 62.141.99.89, remote AS 3216, local AS 206538, external link
 Description: Bee
  BGP version 4, remote router ID 79.104.32.14
  BGP state = Established, up for 09:06:13
  Last read 00:00:28, hold time is 180, keepalive interval is 60 seconds
  Neighbor capabilities:
    4 Byte AS: advertised and received
    Route refresh: advertised and received(old & new)
    Address family IPv4 Unicast: advertised and received
  Message statistics:
    Inq depth is 0
    Outq depth is 0
                         Sent       Rcvd
    Opens:                  1          1
    Notifications:          0          0
    Updates:                0     208702
    Keepalives:           547          1
    Route Refresh:          0          0
    Capability:             0          0
    Total:                548     208704
  Minimum time between advertisement runs is 30 seconds
  Update source is 62.141.99.90
  Default weight 1000

 For address family: IPv4 Unicast
  Inbound soft reconfiguration allowed
  Community attribute sent to this neighbor(both)
  Inbound path policy configured
  Outbound path policy configured
  Route map for incoming advertisements is *Bee-in
  Route map for outgoing advertisements is *Bee-out
  829263 accepted prefixes

  Connections established 1; dropped 0
  Last reset never
Local host: 62.141.99.90, Local port: 22158
Foreign host: 62.141.99.89, Foreign port: 179
Nexthop: 62.141.99.90
Nexthop global: ::
Nexthop local: ::
BGP connection: non shared network
Read thread: on  Write thread: off

AS206538# sh ip bgp 89.237.47.73
BGP routing table entry for 89.237.47.0/24
Paths: (2 available, best #1, table Default-IP-Routing-Table)
  Advertised to non peer-group peers:
  188.130.171.2
  28745
    89.237.47.73 from 89.237.47.73 (176.56.13.1)
      Origin IGP, metric 0, localpref 100, weight 2000, valid, external, best
      Last update: Wed Mar 17 01:35:39 2021

  3216 20485 28745
    62.141.99.89 from 62.141.99.89 (79.104.32.14)
      Origin IGP, localpref 100, weight 1000, valid, external
      Community: 3216:1000 3216:1014 3216:1108 20485:10074 20485:65102
      Last update: Wed Mar 17 01:48:10 2021

AS206538# sh ip bgp nei 89.237.47.73
BGP neighbor is 89.237.47.73, remote AS 28745, local AS 206538, external link
 Description: TTK
  BGP version 4, remote router ID 176.56.13.1
  BGP state = Established, up for 09:06:52
  Last read 00:00:14, hold time is 180, keepalive interval is 60 seconds
  Neighbor capabilities:
    4 Byte AS: advertised and received
    Route refresh: advertised and received(old & new)
    Address family IPv4 Unicast: advertised and received
    Graceful Restart Capabilty: received
      Remote Restart timer is 120 seconds
      Address families by peer:
        IPv4 Unicast(not preserved)
  Graceful restart informations:
    End-of-RIB send: IPv4 Unicast
    End-of-RIB received: IPv4 Unicast
  Message statistics:
    Inq depth is 0
    Outq depth is 0
                         Sent       Rcvd
    Opens:                  1          1
    Notifications:          0          0
    Updates:                2     305633
    Keepalives:           548          1
    Route Refresh:          1          0
    Capability:             0          0
    Total:                552     305635
  Minimum time between advertisement runs is 30 seconds
  Update source is 89.237.47.74
  Default weight 2000

 For address family: IPv4 Unicast
  Inbound soft reconfiguration allowed
  Community attribute sent to this neighbor(both)
  Inbound path policy configured
  Outbound path policy configured
  Route map for incoming advertisements is *TT-in
  Route map for outgoing advertisements is *TT-out
  840265 accepted prefixes

  Connections established 1; dropped 0
  Last reset never
Local host: 89.237.47.74, Local port: 33285
Foreign host: 89.237.47.73, Foreign port: 179
Nexthop: 89.237.47.74
Nexthop global: ::
Nexthop local: ::
BGP connection: non shared network
Read thread: on  Write thread: off

 

Share this post


Link to post
Share on other sites

Цитата

!
route-map TT-out permit 100
 match ip address prefix-list upstream-out
!
route-map TT-out deny 200
!
Цитата

route-map Bee-out permit 100
 match ip address prefix-list upstream-out
!
route-map Bee-out deny 200
!

Убрать, политика роут-мапов по умолчанию - deny, не нужно писать это в конце отдельно.

 

Цитата

neighbor 62.141.99.89 weight 1000

neighbor 89.237.47.73 weight 2000

Убрать.

Временно для экспериментов добавить статический дефолт ip r a def via 89.237.47.73 чтобы не "пропадал инет".

И показать sh ip bg nei 62.141.99.89 adv

 

Share this post


Link to post
Share on other sites

18 минут назад, disappointed сказал:

Убрать, политика роут-мапов по умолчанию - deny, не нужно писать это в конце отдельно.

AS206538# conf t
AS206538(config)# no route-map TT-out deny 200
AS206538(config)# no route-map Bee-out deny 200

 

19 минут назад, disappointed сказал:

Временно для экспериментов добавить статический дефолт ip r a def via 89.237.47.73 чтобы не "пропадал инет".

# ip r a def via 89.237.47.73
Error: an inet prefix is expected rather than "def".
# ip r a default via 89.237.47.73
RTNETLINK answers: File exists

 

20 минут назад, disappointed сказал:

 

Цитата


neighbor 62.141.99.89 weight 1000


neighbor 89.237.47.73 weight 2000

Убрать.

AS206538> en
AS206538# conf t
AS206538(config)# router bgp 206538
AS206538(config-router)# no neighbor 62.141.99.89 weight 1000
AS206538(config-router)# no neighbor 89.237.47.73 weight 2000
AS206538(config-router)#
AS206538# clear ip bgp * soft in
AS206538# sh ip bgp sum
BGP router identifier 188.130.171.1, local AS number 206538
RIB entries 1558138, using 166 MiB of memory
Peers 4, using 18 KiB of memory

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
62.141.99.89    4  3216  270037     945        0    0    0 15:42:41   829776
77.95.132.140   4 65002       0       0        0    0    0 never    Active
89.237.47.73    4 28745  344066     948        0    0    0 15:42:44   840706
188.130.171.2   4 65001     952  376320        0    0    0 15:42:44     3687

Total number of neighbors 4
AS206538# sh ip bg nei 62.141.99.89 adv
AS206538# sh ip bg nei 89.237.47.73 adv
BGP table version is 0, local router ID is 188.130.171.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, R Removed
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 188.130.171.0/24 89.237.47.74             0         32768 i

После чего инет все же пропал.

Share this post


Link to post
Share on other sites

20 минут назад, disappointed сказал:

sh ip bg nei 62.141.99.89 adv

не увидел

 

31 минуту назад, Andrei сказал:

AS206538# sh ip bg nei 62.141.99.89 adv

Пусто

 

20 минут назад, disappointed сказал:

через билайн вообще что-то ходит нет?

Сейчас нет. Раньше с ними bgp не было, был выдан просто 1 ip-адрес 62.141.99.90 (стыковая сетка 62.141.99.88/30), его прописали прямо на cisco, термнирующую pppoe и на него повесили НАТ. Сейчас клиентов с НАТа убрали, этот единственный ip и НАТ с циски убрали, ip перенесли на сервак с quagga.

 

20 минут назад, disappointed сказал:

rp filter отключён?

В Билайн:

# cat /proc/sys/net/ipv4/conf/vlan502/rp_filter
0

В ТТК:

# cat /proc/sys/net/ipv4/conf/vlan150/rp_filter
0

 

 

9 минут назад, disappointed сказал:

И нет анонса 188.130.171.0/24 через Билайн, не вижу сейчас.

Да, почему-то нет.

Share this post


Link to post
Share on other sites

5 часов назад, Andrei сказал:

 

 

В Билайн:

# cat /proc/sys/net/ipv4/conf/vlan502/rp_filter
0

В ТТК:

# cat /proc/sys/net/ipv4/conf/vlan150/rp_filter
0

 

 

 

есть еще all для того чтобы тут работал 0, там тоже надо 0

Share this post


Link to post
Share on other sites

Вчера наступил на грабли, не связанные с кваггой, но повлиявшие на ее работу.

Издавна на сервере с кваггой стоит shorewall. Вчера прописывал новые  интерфейсы на сервере, разумеется внес их в списки интерфейсов и хостов в настройках shorewall, после чего его рестартовал. И bgp перестал нормально работать.

Выяснилось, что по умолчанию в shorewall.conf есть параметр ROUTE_FILTER=Yes . И shorewall при рестарте заново включил rp_filter на всех интерфейсах.

Вещь не очевидная. Может кому пригодится такой опыт.

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.