Page MenuHomeVyOS Platform

bgp: add support for "neighbor <X> local-as replace-as" option
Closed, ResolvedPublicFEATURE REQUEST

Description

FRR states:

Specify an alternate AS for this BGP process when interacting with the specified peer. With no modifiers, the specified local-as is prepended to the received AS_PATH when receiving routing updates from the peer, and prepended to the outgoing AS_PATH (after the process local AS) when transmitting local routes to the peer.
If the no-prepend attribute is specified, then the supplied local-as is not prepended to the received AS_PATH.
If the replace-as attribute is specified, then only the supplied local-as is prepended to the AS_PATH when transmitting local-route updates to this peer.
Note that replace-as can only be specified if no-prepend is.

This command is only allowed for eBGP peers.

VyOS CLI:

set protocols bgp local-as 100
set protocols bgp neighbor 192.0.2.1 local-as 300 replace-as
set protocols bgp peer-group foo local-as 303 replace-as

The no-prepend option is already supported.

Details

Difficulty level
Easy (less than an hour)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Feature (new functionality)

Event Timeline

c-po claimed this task.
c-po triaged this task as Normal priority.
c-po changed Difficulty level from Unknown (require assessment) to Easy (less than an hour).
c-po changed Issue type from Improvement (missing useful functionality) to Feature (new functionality).

Crashes if replace-as is set without no-prepend (see "Unknown command: neighbor 192.0.2.1 local-as 300 replace-as"):

vyos@vyos:~$ configure
[edit]
vyos@vyos# set protocols bgp local-as 100
[edit]
vyos@vyos# set protocols bgp neighbor 192.0.2.1 remote-as 200
[edit]
vyos@vyos# set protocols bgp neighbor 192.0.2.1 local-as 300 replace-as
[edit]
vyos@vyos# commit
[ protocols bgp ]
VyOS had an issue completing a command.

We are sorry that you encountered a problem while using VyOS.
There are a few things you can do to help us (and yourself):
- Contact us using the online help desk if you have a subscription:
  https://support.vyos.io/
- Make sure you are running the latest version of VyOS available at:
  https://vyos.net/get/
- Consult the community forum to see how to handle this issue:
  https://forum.vyos.io
- Join us on Slack where our users exchange help and advice:
  https://vyos.slack.com

When reporting problems, please include as much information as possible:
- do not obfuscate any data (feel free to contact us privately if your 
  business policy requires it)
- and include all the information presented below

Report Time:      2021-09-03 19:20:44
Image Version:    VyOS 1.4-rolling-202109031909
Release Train:    sagitta

Built by:         [email protected]
Built on:         Fri 03 Sep 2021 19:09 UTC
Build UUID:       fdd46c51-8b13-4ea9-bf22-b39a518e204a
Build Commit ID:  d07f632e7d6fc5

Architecture:     x86_64
Boot via:         installed image
System type:      KVM guest

Hardware vendor:  QEMU
Hardware model:   Standard PC (Q35 + ICH9, 2009)
Hardware S/N:     
Hardware UUID:    15860aab-06a3-4cce-a8a2-14b9b76c64a2

Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/protocols_bgp.py", line 315, in <module>
    apply(c)
  File "/usr/libexec/vyos/conf_mode/protocols_bgp.py", line 303, in apply
    frr_cfg.commit_configuration(bgp_daemon)
  File "/usr/lib/python3/dist-packages/vyos/frr.py", line 458, in commit_configuration
    reload_configuration('\n'.join(self.config), daemon=daemon)
  File "/usr/lib/python3/dist-packages/vyos/frr.py", line 206, in reload_configuration
    raise CommitError('FRR configuration failed while running commit. Please ' \
vyos.frr.CommitError: FRR configuration failed while running commit. Please enable debugging to examine logs.

To enable debugging run: "touch /tmp/vyos.frr.debug" and "sudo systemctl stop vyos-configd"



[[protocols bgp]] failed
Commit failed
[edit]
vyos@vyos# touch /tmp/vyos.frr.debug
[edit]
vyos@vyos# sudo systemctl stop vyos-configd
[edit]
vyos@vyos# commit
[ protocols bgp ]
load_configuration: Configuration loaded from FRR daemon zebra
load_configuration:  loaded      0 !
load_configuration:  loaded      1 frr version 7.5.1-20210619-12-g3f8a74e70
load_configuration:  loaded      2 frr defaults traditional
load_configuration:  loaded      3 hostname vyos
load_configuration:  loaded      4 service integrated-vtysh-config
load_configuration:  loaded      5 !
load_configuration:  loaded      6 line vty
load_configuration:  loaded      7 !
load_configuration:  loaded      8 end
modify_section: starting search for '(\\s+)?ip protocol bgp route-map [-a-zA-Z0-9.]+$' until '(\\s|!)'
_find_first_block: find start='(\\s+)?ip protocol bgp route-map [-a-zA-Z0-9.]+$$' stop='(\\s|!)' start_at=0
_find_first_block: no match       0 "!"
_find_first_block: no match       1 "frr version 7.5.1-20210619-12-g3f8a74e70"
_find_first_block: no match       2 "frr defaults traditional"
_find_first_block: no match       3 "hostname vyos"
_find_first_block: no match       4 "service integrated-vtysh-config"
_find_first_block: no match       5 "!"
_find_first_block: no match       6 "line vty"
_find_first_block: no match       7 "!"
_find_first_block: no match       8 "end"
_find_first_block: exit start={repr(start_pattern)} stop={repr(stop_pattern)} start_at={start_at}
modify_section: No more config sections found, exiting
_find_first_element: find start="(ip prefix-list .*|route-map .*|line vty)" start_at=0
_find_first_element: no match     0 "!"
_find_first_element: no match     1 "frr version 7.5.1-20210619-12-g3f8a74e70"
_find_first_element: no match     2 "frr defaults traditional"
_find_first_element: no match     3 "hostname vyos"
_find_first_element: no match     4 "service integrated-vtysh-config"
_find_first_element: no match     5 "!"
_find_first_element: Found stop   6 "line vty"
add_before:   add            6 !
add_before:   add            7 !
commit_configuration:  Commiting configuration
commit_configuration: new_config   0 !
commit_configuration: new_config   1 frr version 7.5.1-20210619-12-g3f8a74e70
commit_configuration: new_config   2 frr defaults traditional
commit_configuration: new_config   3 hostname vyos
commit_configuration: new_config   4 service integrated-vtysh-config
commit_configuration: new_config   5 !
commit_configuration: new_config   6 !
commit_configuration: new_config   7 !
commit_configuration: new_config   8 line vty
commit_configuration: new_config   9 !
commit_configuration: new_config  10 end
reload_configuration: Reloading config using temporary file: /tmp/tmp0dcrn1kk
reload_configuration: Executing command against frr-reload: "/usr/lib/frr/frr-reload.py --reload --daemon zebra --debug --stdout /tmp/tmp0dcrn1kk"
frr-reload output:   0 /usr/lib/frr/frr-reload.py:851: SyntaxWarning: "is not" with a literal. Did you mean "!="?
frr-reload output:   1   if line is not "exit-vrf":
frr-reload output:   2 2021-09-03 19:21:12,301  INFO: Called via "Namespace(input=None, reload=True, test=False, debug=True, log_level='info', stdout=True, pathspace=None, filename='/tmp/tmp0dcrn1kk', overwrite=False, bindir='/usr/bin', confdir='/etc/frr', rundir='/var/run/frr', vty_socket=None, daemon='zebra')"
frr-reload output:   3 2021-09-03 19:21:12,301  INFO: Loading Config object from file /tmp/tmp0dcrn1kk
frr-reload output:   4 2021-09-03 19:21:12,366 DEBUG: LINE frr version 7.5.1-20210619-12-g3f8a74e70          : entering new context, ['frr version 7.5.1-20210619-12-g3f8a74e70']      
frr-reload output:   5 2021-09-03 19:21:12,367 DEBUG: LINE frr defaults traditional                          : entering new context, ['frr defaults traditional']                      
frr-reload output:   6 2021-09-03 19:21:12,367 DEBUG: LINE hostname vyos                                     : entering new context, ['hostname vyos']                                 
frr-reload output:   7 2021-09-03 19:21:12,367 DEBUG: LINE service integrated-vtysh-config                   : entering new context, ['service integrated-vtysh-config']               
frr-reload output:   8 2021-09-03 19:21:12,367 DEBUG: LINE line vty                                          : entering new context, ['line vty']                                      
frr-reload output:   9 2021-09-03 19:21:12,367 DEBUG: LINE end                                               : exiting old context, ['line vty']                                      
frr-reload output:  10 2021-09-03 19:21:12,435 DEBUG: New Frr Config
frr-reload output:  11 !
frr-reload output:  12 frr version 7.5.1-20210619-12-g3f8a74e70
frr-reload output:  13 frr defaults traditional
frr-reload output:  14 hostname vyos
frr-reload output:  15 service integrated-vtysh-config
frr-reload output:  16 !
frr-reload output:  17 !
frr-reload output:  18 !
frr-reload output:  19 line vty
frr-reload output:  20 !
frr-reload output:  21 
frr-reload output:  22 end
frr-reload output:  23 
frr-reload output:  24 2021-09-03 19:21:12,435  INFO: Loading Config object from vtysh show running
frr-reload output:  25 2021-09-03 19:21:12,569 DEBUG: LINE frr version 7.5.1-20210619-12-g3f8a74e70          : entering new context, ['frr version 7.5.1-20210619-12-g3f8a74e70']      
frr-reload output:  26 2021-09-03 19:21:12,570 DEBUG: LINE frr defaults traditional                          : entering new context, ['frr defaults traditional']                      
frr-reload output:  27 2021-09-03 19:21:12,570 DEBUG: LINE hostname vyos                                     : entering new context, ['hostname vyos']                                 
frr-reload output:  28 2021-09-03 19:21:12,570 DEBUG: LINE service integrated-vtysh-config                   : entering new context, ['service integrated-vtysh-config']               
frr-reload output:  29 2021-09-03 19:21:12,570 DEBUG: LINE line vty                                          : entering new context, ['line vty']                                      
frr-reload output:  30 2021-09-03 19:21:12,570 DEBUG: LINE end                                               : exiting old context, ['line vty']                                      
frr-reload output:  31 2021-09-03 19:21:12,570 DEBUG: Running Frr Config (Pass #0)
frr-reload output:  32 frr version 7.5.1-20210619-12-g3f8a74e70
frr-reload output:  33 frr defaults traditional
frr-reload output:  34 hostname vyos
frr-reload output:  35 service integrated-vtysh-config
frr-reload output:  36 !
frr-reload output:  37 line vty
frr-reload output:  38 !
frr-reload output:  39 end
frr-reload output:  40 2021-09-03 19:21:12,570  INFO: Loading Config object from vtysh show running
frr-reload output:  41 2021-09-03 19:21:12,703 DEBUG: LINE frr version 7.5.1-20210619-12-g3f8a74e70          : entering new context, ['frr version 7.5.1-20210619-12-g3f8a74e70']      
frr-reload output:  42 2021-09-03 19:21:12,704 DEBUG: LINE frr defaults traditional                          : entering new context, ['frr defaults traditional']                      
frr-reload output:  43 2021-09-03 19:21:12,704 DEBUG: LINE hostname vyos                                     : entering new context, ['hostname vyos']                                 
frr-reload output:  44 2021-09-03 19:21:12,704 DEBUG: LINE service integrated-vtysh-config                   : entering new context, ['service integrated-vtysh-config']               
frr-reload output:  45 2021-09-03 19:21:12,704 DEBUG: LINE line vty                                          : entering new context, ['line vty']                                      
frr-reload output:  46 2021-09-03 19:21:12,704 DEBUG: LINE end                                               : exiting old context, ['line vty']                                      
frr-reload output:  47 2021-09-03 19:21:12,704 DEBUG: Running Frr Config (Pass #1)
frr-reload output:  48 frr version 7.5.1-20210619-12-g3f8a74e70
frr-reload output:  49 frr defaults traditional
frr-reload output:  50 hostname vyos
frr-reload output:  51 service integrated-vtysh-config
frr-reload output:  52 !
frr-reload output:  53 line vty
frr-reload output:  54 !
frr-reload output:  55 end
load_configuration: Configuration loaded from FRR daemon bgpd
load_configuration:  loaded      0 !
load_configuration:  loaded      1 frr version 7.5.1-20210619-12-g3f8a74e70
load_configuration:  loaded      2 frr defaults traditional
load_configuration:  loaded      3 hostname vyos
load_configuration:  loaded      4 service integrated-vtysh-config
load_configuration:  loaded      5 !
load_configuration:  loaded      6 line vty
load_configuration:  loaded      7 !
load_configuration:  loaded      8 end
modify_section: starting search for '^router bgp \\d+$' until '\\S+'
_find_first_block: find start='^router bgp \\d+$$' stop='\\S+' start_at=0
_find_first_block: no match       0 "!"
_find_first_block: no match       1 "frr version 7.5.1-20210619-12-g3f8a74e70"
_find_first_block: no match       2 "frr defaults traditional"
_find_first_block: no match       3 "hostname vyos"
_find_first_block: no match       4 "service integrated-vtysh-config"
_find_first_block: no match       5 "!"
_find_first_block: no match       6 "line vty"
_find_first_block: no match       7 "!"
_find_first_block: no match       8 "end"
_find_first_block: exit start={repr(start_pattern)} stop={repr(stop_pattern)} start_at={start_at}
modify_section: No more config sections found, exiting
_find_first_element: find start="(ip prefix-list .*|route-map .*|line vty)" start_at=0
_find_first_element: no match     0 "!"
_find_first_element: no match     1 "frr version 7.5.1-20210619-12-g3f8a74e70"
_find_first_element: no match     2 "frr defaults traditional"
_find_first_element: no match     3 "hostname vyos"
_find_first_element: no match     4 "service integrated-vtysh-config"
_find_first_element: no match     5 "!"
_find_first_element: Found stop   6 "line vty"
add_before:   add            6 !
add_before:   add            7 router bgp 100 
add_before:   add            8  no bgp ebgp-requires-policy
add_before:   add            9  no bgp network import-check
add_before:   add           10  !
add_before:   add           11  !
add_before:   add           12  neighbor 192.0.2.1 remote-as 200
add_before:   add           13  neighbor 192.0.2.1 local-as 300  replace-as
add_before:   add           14  !
add_before:   add           15 
add_before:   add           16  !
add_before:   add           17  end
add_before:   add           18 !
commit_configuration:  Commiting configuration
commit_configuration: new_config   0 !
commit_configuration: new_config   1 frr version 7.5.1-20210619-12-g3f8a74e70
commit_configuration: new_config   2 frr defaults traditional
commit_configuration: new_config   3 hostname vyos
commit_configuration: new_config   4 service integrated-vtysh-config
commit_configuration: new_config   5 !
commit_configuration: new_config   6 !
commit_configuration: new_config   7 router bgp 100 
commit_configuration: new_config   8  no bgp ebgp-requires-policy
commit_configuration: new_config   9  no bgp network import-check
commit_configuration: new_config  10  !
commit_configuration: new_config  11  !
commit_configuration: new_config  12  neighbor 192.0.2.1 remote-as 200
commit_configuration: new_config  13  neighbor 192.0.2.1 local-as 300  replace-as
commit_configuration: new_config  14  !
commit_configuration: new_config  15 
commit_configuration: new_config  16  !
commit_configuration: new_config  17  end
commit_configuration: new_config  18 !
commit_configuration: new_config  19 line vty
commit_configuration: new_config  20 !
commit_configuration: new_config  21 end
reload_configuration: Reloading config using temporary file: /tmp/tmp8uxgz9fs
reload_configuration: Executing command against frr-reload: "/usr/lib/frr/frr-reload.py --reload --daemon bgpd --debug --stdout /tmp/tmp8uxgz9fs"
frr-reload output:   0 /usr/lib/frr/frr-reload.py:851: SyntaxWarning: "is not" with a literal. Did you mean "!="?
frr-reload output:   1   if line is not "exit-vrf":
frr-reload output:   2 2021-09-03 19:21:12,920  INFO: Called via "Namespace(input=None, reload=True, test=False, debug=True, log_level='info', stdout=True, pathspace=None, filename='/tmp/tmp8uxgz9fs', overwrite=False, bindir='/usr/bin', confdir='/etc/frr', rundir='/var/run/frr', vty_socket=None, daemon='bgpd')"
frr-reload output:   3 2021-09-03 19:21:12,920  INFO: Loading Config object from file /tmp/tmp8uxgz9fs
frr-reload output:   4 2021-09-03 19:21:12,986   ERROR: vtysh failed to process new configuration: vtysh (mark file) exited with status 2:
frr-reload output:   5 b'line 14: % Unknown command:  neighbor 192.0.2.1 local-as 300  replace-as\n\n'
frr-reload output:   6 2021-09-03 19:21:13,054 DEBUG: New Frr Config
frr-reload output:   7 
frr-reload output:   8 2021-09-03 19:21:13,054  INFO: Loading Config object from vtysh show running
frr-reload output:   9 2021-09-03 19:21:13,188 DEBUG: LINE frr version 7.5.1-20210619-12-g3f8a74e70          : entering new context, ['frr version 7.5.1-20210619-12-g3f8a74e70']      
frr-reload output:  10 2021-09-03 19:21:13,189 DEBUG: LINE frr defaults traditional                          : entering new context, ['frr defaults traditional']                      
frr-reload output:  11 2021-09-03 19:21:13,189 DEBUG: LINE hostname vyos                                     : entering new context, ['hostname vyos']                                 
frr-reload output:  12 2021-09-03 19:21:13,189 DEBUG: LINE service integrated-vtysh-config                   : entering new context, ['service integrated-vtysh-config']               
frr-reload output:  13 2021-09-03 19:21:13,189 DEBUG: LINE line vty                                          : entering new context, ['line vty']                                      
frr-reload output:  14 2021-09-03 19:21:13,189 DEBUG: LINE end                                               : exiting old context, ['line vty']                                      
frr-reload output:  15 2021-09-03 19:21:13,189 DEBUG: Running Frr Config (Pass #0)
frr-reload output:  16 frr version 7.5.1-20210619-12-g3f8a74e70
frr-reload output:  17 frr defaults traditional
frr-reload output:  18 hostname vyos
frr-reload output:  19 service integrated-vtysh-config
frr-reload output:  20 !
frr-reload output:  21 line vty
frr-reload output:  22 !
frr-reload output:  23 end
frr-reload output:  24 2021-09-03 19:21:13,189  INFO: "frr version 7.5.1-20210619-12-g3f8a74e70" cannot be removed
frr-reload output:  25 2021-09-03 19:21:13,189  INFO: "frr defaults traditional" cannot be removed
frr-reload output:  26 2021-09-03 19:21:13,189  INFO: "service integrated-vtysh-config" cannot be removed
frr-reload output:  27 2021-09-03 19:21:13,189  INFO: "line vty" cannot be removed
frr-reload output:  28 2021-09-03 19:21:13,258  INFO: Executed "no hostname vyos"
frr-reload output:  29 2021-09-03 19:21:13,258  INFO: Loading Config object from vtysh show running
frr-reload output:  30 2021-09-03 19:21:13,396 DEBUG: LINE frr version 7.5.1-20210619-12-g3f8a74e70          : entering new context, ['frr version 7.5.1-20210619-12-g3f8a74e70']      
frr-reload output:  31 2021-09-03 19:21:13,396 DEBUG: LINE frr defaults traditional                          : entering new context, ['frr defaults traditional']                      
frr-reload output:  32 2021-09-03 19:21:13,396 DEBUG: LINE hostname vyos                                     : entering new context, ['hostname vyos']                                 
frr-reload output:  33 2021-09-03 19:21:13,396 DEBUG: LINE service integrated-vtysh-config                   : entering new context, ['service integrated-vtysh-config']               
frr-reload output:  34 2021-09-03 19:21:13,396 DEBUG: LINE line vty                                          : entering new context, ['line vty']                                      
frr-reload output:  35 2021-09-03 19:21:13,396 DEBUG: LINE end                                               : exiting old context, ['line vty']                                      
frr-reload output:  36 2021-09-03 19:21:13,396 DEBUG: Running Frr Config (Pass #1)
frr-reload output:  37 frr version 7.5.1-20210619-12-g3f8a74e70
frr-reload output:  38 frr defaults traditional
frr-reload output:  39 hostname vyos
frr-reload output:  40 service integrated-vtysh-config
frr-reload output:  41 !
frr-reload output:  42 line vty
frr-reload output:  43 !
frr-reload output:  44 end
frr-reload output:  45 2021-09-03 19:21:13,396  INFO: "frr version 7.5.1-20210619-12-g3f8a74e70" cannot be removed
frr-reload output:  46 2021-09-03 19:21:13,396  INFO: "frr defaults traditional" cannot be removed
frr-reload output:  47 2021-09-03 19:21:13,396  INFO: "service integrated-vtysh-config" cannot be removed
frr-reload output:  48 2021-09-03 19:21:13,396  INFO: "line vty" cannot be removed
VyOS had an issue completing a command.

We are sorry that you encountered a problem while using VyOS.
There are a few things you can do to help us (and yourself):
- Contact us using the online help desk if you have a subscription:
  https://support.vyos.io/
- Make sure you are running the latest version of VyOS available at:
  https://vyos.net/get/
- Consult the community forum to see how to handle this issue:
  https://forum.vyos.io
- Join us on Slack where our users exchange help and advice:
  https://vyos.slack.com

When reporting problems, please include as much information as possible:
- do not obfuscate any data (feel free to contact us privately if your 
  business policy requires it)
- and include all the information presented below

Report Time:      2021-09-03 19:21:13
Image Version:    VyOS 1.4-rolling-202109031909
Release Train:    sagitta

Built by:         [email protected]
Built on:         Fri 03 Sep 2021 19:09 UTC
Build UUID:       fdd46c51-8b13-4ea9-bf22-b39a518e204a
Build Commit ID:  d07f632e7d6fc5

Architecture:     x86_64
Boot via:         installed image
System type:      KVM guest

Hardware vendor:  QEMU
Hardware model:   Standard PC (Q35 + ICH9, 2009)
Hardware S/N:     
Hardware UUID:    15860aab-06a3-4cce-a8a2-14b9b76c64a2

Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/protocols_bgp.py", line 315, in <module>
    apply(c)
  File "/usr/libexec/vyos/conf_mode/protocols_bgp.py", line 303, in apply
    frr_cfg.commit_configuration(bgp_daemon)
  File "/usr/lib/python3/dist-packages/vyos/frr.py", line 458, in commit_configuration
    reload_configuration('\n'.join(self.config), daemon=daemon)
  File "/usr/lib/python3/dist-packages/vyos/frr.py", line 206, in reload_configuration
    raise CommitError('FRR configuration failed while running commit. Please ' \
vyos.frr.CommitError: FRR configuration failed while running commit. Please enable debugging to examine logs.

To enable debugging run: "touch /tmp/vyos.frr.debug" and "sudo systemctl stop vyos-configd"



[[protocols bgp]] failed
Commit failed

Let me add a verify step…