Command Line Reference
IP Unicast Routing
BGP Configuration
90 min
show bgp peer group show bgp peer group \[command] show bgp peer group \[purpose] this command displays configured bgp peer groups \[view] system view \[use cases] sonic# show bgp peer group bgp peer group peer v4 ebgp peer group type is external configured address families ipv4 unicast; peer group members 30 11 13 9 established 30 11 13 137 active bgp peer group peer v4 ibgp peer group type is external configured address families ipv4 unicast; bgp peer group peer v4 int peer group type is external configured address families ipv4 unicast; bgp peer group peer v6 ebgp peer group type is external configured address families ipv4 unicast; peer group members 2022 9300 active 2022 9310 established bgp peer group peer v6 ibgp peer group type is external configured address families ipv4 unicast; bgp peer group peer v6 int peer group type is external configured address families ipv4 unicast; show ip bgp show ip bgp \[command] show ip bgp { view \[ all| view name ] | \[ vrf \[ all | vrf name ]]} \[purpose] display the routing table of bgp view or vrf \[parameter] parameter description view specify view view name the name of view vrf specify vrf vrf name the name of vrf \[view] system view \[use cases] sonic# show ip bgp vrf all instance default bgp table version is 2375, local router id is 30 11 0 84, vrf id 0 default local pref 100, local as 65100 status codes s suppressed, d damped, h history, valid, > best, = multipath, i internal, r rib failure, s stale, r removed nexthop codes @nnn nexthop's vrf id, < announce nh self origin codes i igp, e egp, ? incomplete network next hop metric locprf weight path > 0 0 0 0/0 30 11 13 9 0 65101 4200000001 i show ip bgp neighbors show ip bgp neighbors \[command] show ip bgp neighbors \[purpose] display the details of bgp neighbors \[view] system view \[use cases] sonic# show ip bgp neighbors bgp neighbor is 1 1 1 2, remote as 65100, local as 65200, external link bgp version 4, remote router id 2 1 1 2, local router id 192 168 15 48 bgp state = established, up for 02 34 12 last read 00 00 09, last write 00 00 12 hold time is 90, keepalive interval is 30 seconds neighbor capabilities 4 byte as advertised addpath ipv4 unicast rx advertised ipv4 unicast route refresh advertised address family ipv4 unicast advertised and received hostname capability advertised (name sonic,domain name n/a) not received graceful restart capability advertised graceful restart information local gr mode helper remote gr mode disable r bit false timers configured restart time(sec) 120 received restart time(sec) 0 message statistics inq depth is 0 outq depth is 0 sent rcvd opens 3 3 notifications 0 4 updates 2 6 keepalives 338 337 route refresh 0 0 capability 0 0 total 343 350 minimum time between advertisement runs is 0 seconds for address family ipv4 unicast update group 3, subgroup 3 packet queue length 0 community attribute sent to this neighbor(all) 25 accepted prefixes connections established 3; dropped 2 last reset 02 34 17, no afi/safi activated for peer local host 1 1 1 1, local port 179 foreign host 1 1 1 2, foreign port 1051 nexthop 1 1 1 1 nexthop global fe80 211 24ff\ fe1a 1b61 nexthop local fe80 211 24ff\ fe1a 1b61 bgp connection shared network bgp connect retry timer in seconds 120 estimated round trip time 1 ms read thread on write thread on fd used 27 show ip bgp show ip bgp \[command] show ip bgp \[purpose] display all route information received from bgp neighbors \[view] system view \[use cases] sonic# show ip bgp instance default bgp table version is 3, local router id is 10 1 1 138, vrf id 0 default local pref 100, local as 65001 status codes s suppressed, d damped, h history, valid, > best, = multipath, i internal, r rib failure, s stale, r removed nexthop codes @nnn nexthop's vrf id, < announce nh self origin codes i igp, e egp, ? incomplete rpki validation codes v valid, i invalid, n not found network next hop metric locprf weight path > 10 1 1 138/32 0 0 0 0 0 32768 i > 10 1 1 139/32 10 1 1 2 0 0 65002 i > 10 1 1 216/32 10 1 1 2 0 65002 65003 i show ip bgp statistics show ip bgp statistics \[command] show ip bgp statistics \[purpose] display bgp routing related statistics \[view] system view \[use cases] sonic# show ip bgp statistics bgp ipv4 unicast rib statistics (vrf default) total advertisements 25 total prefixes 25 average prefix length 19 20 unaggregateable prefixes 25 maximum aggregateable prefixes 0 bgp aggregate advertisements 0 address space advertised 985600 % announced 0 02 /8 equivalent 0 06 /24 equivalent 3850 00 advertisements with paths 25 longest as path (hops) 1 average as path length (hops) 1 00 largest as path (bytes) 6 average as path size (bytes) 6 00 highest public asn 0 show bgp neighbors log info show bgp neighbors log info \[command] show bgp neighbors log info \[purpose] display the bgp neighbor status information \[view] system view \[usage scenario] using this command, you can sequentially view the bgp neighbor's re establishment time, the last errordown time, the reason for the errordown, and the last establishment time the reasons for errordown include admin shutdown (bgp session down), bfd down received (bfd session down), interface down (interface down), notification sent (cease/other configuration change \[bgp session information changed] | hold timer expired \[bgp message timeout]), notification received (cease/unspecific \[bgp session termination] | cease/peer de configured \[peer bgp neighbor removed]), etc \[use cases] sonic(config router)# do show bgp neighbors log info \ bgp neighbor is 1 1 1 2 date/time 2024 12 25 02 32 31 status up date/time 2024 12 25 02 32 01 status down down reason notification sent (cease/other configuration change) date/time 2024 12 25 02 30 09 status up router bgp router bgp \[command] router bgp as \[ view view name |vrf vrf name ] no router bgp as \[ view view name |vrf vrf name ] \[purpose] enable a bgp protocol process with the specified as number \[parameter] parameter description as as number(1 4294967295) or asn format as dot notation(0 65535) (0 65535) view name specify the view name vrf name specify the vrf name \[view] system configuration view \[notes] when vrf name is not specified, the bgp protocol process belongs to the default vrf when expressing asn in dot notation, the decimal asn 65538 is equivalent to the dot notation 1 2 \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# bgp router id bgp router id a b c d \[command] bgp router id a b c d no bgp router id a b c d \[purpose] this command specifies the router id \[parameter] parameter description a b c d configured router identifier \[view] bgp configuration view \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# bgp router id 1 1 1 1 bgp cluster id bgp cluster id a b c d \[command] bgp cluster id a b c d no bgp cluster id a b c d \[purpose] configure the cluster id for the route reflector \[view] bgp configuration view \[usage scenario] when multiple route reflectors exist within a cluster, it is necessary to configure the same cluster id to identify that these reflectors belong to the same cluster \[use cases] sonic(config)# router bgp 65100 sonic(config router)# bgp cluster id 10 1 1 10 bgp bestpath bgp bestpath \[command] bgp bestpath \[as path {confed | ignore | multipath relax}] no bgp bestpath \[as path {confed | ignore | multipath relax}] \[purpose] specify the bestpath decision method for bgp \[parameter] parameter description confed specifies that bgp considers as path length and content when selecting the best route ignore ignore the attributes when specifying bgp bestpath decision method multipath relax this command specifies that bgp decision process should consider paths of equal as path length candidates for multipath computation without the knob, the entire as path must match for multipath computation multipath relax ensure that when comparing routes where both are equal on most metrics, including local pref, as path length, igp cost, med, that the tie is broken based on router id \[view] bgp configuration view \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# bgp bestpath as path ignore bgp bestpath compare routerid bgp bestpath compare routerid \[command] bgp bestpath compare routerid no bgp bestpath compare routerid \[purpose] configure bgp to ignore router id when selecting the best route \[view] bgp configuration view \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# bgp bestpath as path compare routerid bgp bestpath bandwidth bgp bestpath bandwidth \[command] bgp bestpath bandwidth {default weight for missing|ignore|skip missing} no bgp bestpath bandwidth {default weight for missing|ignore|skip missing} \[purpose] configure bgp's treatment of bandwidth when selecting the best path \[parameter] parameter description default weight for missing when a route does not carry a bandwidth parameter, the default action is to assign a weight of 1 ignore ignore the bandwidth value in the route skip missing discard routes that do not carry a bandwidth parameter \[view] bgp configuration view \[use cases] sonic(config)# router bgp 65100 sonic(config router)# bgp bestpath bandwidth default weight for missing bgp ebgp requires policy bgp ebgp requires policy \[command] bgp ebgp requires policy no bgp ebgp requires policy \[purpose] this command requires incoming and outgoing filters to be applied for ebgp sessions \[view] bgp configuration view \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# bgp ebgp requires policy bgp graceful restart restart time bgp graceful restart restart time \[command] bgp graceful restart restart time delay no bgp graceful restart restart time delay \[purpose] set the maximum waiting time for the remote end to wait for the successful reconstruction of the local bgp neighbor \[parameter] parameter description delay range value 1 4094, unit s \[view] bgp configuration view \[usage scenario] after executing this command, when the remote device detects that the bgp peer established with the local device is in a down state, it triggers the bgp session to enter graceful restart mode during this time, the device can continue to use previously learned routing information without waiting for the bgp session to be reestablished if the maximum waiting time is exceeded without a successful reconnection, the device exits the graceful restart process and withdraws routes \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# bgp graceful restart restart time 200 bgp graceful restart rib stale time bgp graceful restart rib stale time \[command] bgp graceful restart rib stale time delay no bgp graceful restart rib stale time delay \[purpose] configure the maximum waiting time for the local end to wait for the end of rib marker from the remote end \[parameter] parameter description delay range value 1 3600, unit s \[view] bgp configuration view \[usage scenario] after the local end and remote end rebuild the bgp session, the local end should receive the end of rib marker from the remote end within the time set by this command if the end of rib marker is not received within the specified time, the local end will exit the graceful restart process and withdraw routes \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# bgp graceful restart rib stale time 20 bgp shutdown bgp shutdown \[command] bgp shutdown \[ message string ] no bgp shutdown \[ message string ] \[purpose] administrative shutdown of all peers of a bgp instance \[parameter] parameter description string an optional shutdown message msg can be specified \[view] bgp configuration view \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# bgp shutdown message testing bgp network import check bgp network import check \[command] bgp network import check no bgp network import check \[purpose] check for the networks existence in rib \[view] bgp configuration view \[usage scenario] this configuration modifies the behavior of the network statement if you have this configured the underlying network must exist in the rib if you have the \[no] form configured then bgp will not check for the networks existence in the rib for versions 7 3 and before frr defaults for datacenter were the network must exist, traditional did not check for existence for versions 7 4 and beyond both traditional and datacenter the network must exist \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# bgp network import check bgp update delay bgp update delay \[command] bgp update delay max delay \[ establish wait ] no bgp update delay max delay \[ establish wait ] \[purpose] configuring a global delay for sending update messages \[parameter] parameter description max delay max delay in seconds (0 3600) establish wait establish wait in seconds (1 3600) \[view] system configuration view \[use cases] sonic# configure terminal sonic(config)# bgp update delay 2 2 update delay update delay \[command] update delay max delay no update delay max delay \[purpose] this command is used to delay the advertisement of bgp routes after a bgp process is restarted \[parameter] parameter description max delay range value 0 3600, unit s \[view] bgp configuration view \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# update delay 2 distance distance \[command] distance ebpg distance ibgp distance local distance distance distance a b c d/m \[ip prefix name] no distance ebpg distance ibgp distance local distance no distance distance a b c d/m \[ip prefix name] \[purpose] modify the administrative distance for the route \[parameter] parameter description ebpg distance modify the administrative distance of ebgp routes, the value range 1 255 ibgp distance modify the administrative distance of ibgp routes, the value range is 1 255 local distance change the administrative distance of the local route, the value range is 1 255 distance sets the administrative distance for a particular route a b c d/m ip prefix ip prefix name the name of ip prefix list \[view] bgp configuration view \[usage scenario] if the system has a static route configured from the kernel, it has a distance of 0 in some cases, it might be useful to override the route e g kernel has a statically configured default route, and you received another default route from the bgp and want to install it to be preferred over the static route in such a case, user can set a higher distance from the kernel by default, the administrative distance for ebgp routes is 200, the administrative distance for ibgp routes is 20, and the administrative distance for local routes is 1 \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# distance 20 0 0 0 0/0 redistribute redistribute \[command] redistribute \[ babel|connected|eigrp|isis|kernel|openfabric|ospf|ospf6|rip|ripng|sharp|static|table|vnc|vnc direct ] \[ metric metric id ] \[ route map string ] no redistribute \[ babel|connected|eigrp|isis|kernel|openfabric|ospf|ospf6|rip|ripng|sharp|static|table|vnc|vnc direct ] \[ metric metric id ] \[ route map string ] \[purpose] redistribute routes from other protocols into bgp \[parameter] parameter description metric id set the metric for route route map string apply a route map \[view] address family view \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# address family ipv4 unicast sonic(config router af)# redistribute ospf metric 200 bgp listen range bgp listen range \[command] bgp listen range { a b c d/m | x\ x x \ x /m } peer group name no bgp listen range { a b c d/m | x\ x x \ x /m } peer group name \[purpose] allow establishing bgp neighbor relationships with all ip addresses within the specified address range \[parameter] parameter description a b c d/m x\ x x \ x /m ip range name peer group name \[view] bgp configuration view \[use cases] sonic(config)# router bgp 65100 sonic(config router)# neighbor test peer group sonic(config router)# neighbor test remote as external sonic(config router)# bgp listen range 10 111 1 0/24 peer group test bgp listen limit bgp listen limit \[command] bgp listen limit neighor number no bgp listen limit neighor number \[purpose] define the maximum number of peers accepted for one bgp instance \[parameter] parameter description neighbor number configure dynamic neighbors listen limit value (1 5000) \[view] bgp configuration view \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# bgp listen limit 20 bgp default ipv4 unicast bgp default ipv4 unicast \[command] bgp default ipv4 unicast no bgp default ipv4 unicast \[purpose] ipv4 unicast address families for all neighbors are enabled by default \[view] bgp configuration view \[notes] by default, all neighbors do not enable the ipv4 unicast address family and require manual configuration to set their state to active after configuring the bgp default ipv4 unicast command, the created bgp peer automatically enables the ipv4 unicast address family by default \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# bgp default ipv4 unicast bgp default local preference bgp default local preference \[command] bgp default local preference value no bgp default local preference value \[purpose] configuring the default local preference for bgp \[view] bgp configuration view \[notes] by default, the default local priority is 100 \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# bgp default local preference 100 bgp default shutdown bgp default shutdown \[command] bgp default shutdown no bgp default shutdown \[purpose] set the default state of the newly configured peer to shutdown \[view] bgp configuration view \[notes] after configuring this command, all newly added bgp peers will require manual configuration of the no shutdown command to be used properly \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# bgp default shutdown bgp route reflector allow outbound policy bgp route reflector allow outbound policy \[command] bgp route reflector allow outbound policy no bgp route reflector allow outbound policy \[purpose] allowing route policies to affect reflected routes \[view] bgp configuration view \[usage scenario] by default, policies that modify route attributes configured in a route map do not affect routes that are reflected by route reflectors enabling this feature allows route attributes to be modified and take effect on all reflected routes \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# bgp route reflector allow outbound policy bgp fast external failover bgp fast external failover \[command] bgp route reflector allow outbound policy no bgp route reflector allow outbound policy \[purpose] enable bgp to immediately close the ebgp peer when there is link instability \[view] bgp configuration view \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# bgp fast external failover aggregate address aggregate address \[command] aggregate address ip address { mask length | mask } \[ as set|summary only|route map string |origin{incomplete|igp|egp}] no aggregate address ip address { mask length | mask } \[ as set|summary only|route map string |origin{incomplete|igp|egp}] \[purpose] this command specifies an aggregate address \[parameter] parameter description ip address specifies an ip address of the summarized route theaddress is in dotted decimal notation mask ip address mask, the address is in dotted decimal natation mask length length of the ip address mask as set include as set in the generated routes summary only announce only the aggregated route route map string apply a route map for an aggregated prefix origin{incomplete|igp|egp} specify origin for an aggregated prefix \[view] ip address family view \[usage scenario] this command can be used to aggregate and advertise routes from the local routing table to ensure that the aggregated routes have loop prevention, you can use the "as set" keyword to create an aggregate route that inherits the origin, as path, community, and large community attributes from the specific routes by configuring "summary only," you can suppress all the detailed routes included in the aggregate route, only announcing the aggregate route this helps reduce the routing load on bgp peers \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# address family ipv6 unicast sonic(config router af)# aggregate address 100 1/64 network network \[command] network ip address { mask length | mask } \[ route map string ] no network ip address { mask length | mask } \[ route map string ] \[purpose] this command adds the announcement network \[parameter] parameter description a b c d ip address, the address is in dotted decimal natation mask ip address mask, the address is in dotted decimal natation mask length length of the ip address mask route map string apply a route map for an aggregated prefix \[view] ip address family view \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# address family ipv4 unicast sonic(config router af)# network 1 1 1 0/24 neighbor graceful restart neighbor graceful restart \[command] neighbor { a b c d | x\ x x \ x | string } {graceful restart|graceful restart disable|graceful restart helper} no neighbor { a b c d | x\ x x \ x | string } {graceful restart|graceful restart disable|graceful restart helper} \[purpose] this command will enable bgp graceful restart functionality \[parameter] parameter description a b c d neighbor address x\ x x \ x neighbor ipv6 address string peer group name gracefule restart graceful restart command for a neighbor gracefule restart disable graceful restart disable command for a neighbor gracefule restart helper graceful restart helper command for a neighbor \[view] bgp configuration view \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# neighbor 1 1 1 1 graceful restart neighbor advertisement interval neighbor advertisement interval \[command] neighbor { a b c d | x\ x x \ x | string } advertisement interval internal no neighbor { a b c d | x\ x x \ x | string } advertisement interval internal \[purpose] configure the time interval for a peer to send route prefix update messages \[parameter] parameter description a b c d neighbor address x\ x x \ x neighbor ipv6 address string peer group name internal the range of value 0 600, default value is 0 \[view] bgp configuration view \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# neighbor 1 1 1 1 advertisement interval 2 neighbor bfd neighbor bfd \[command] neighbor { a b c d | x\ x x \ x | string } bfd \[date plane] \[purpose] enable bfd functionality for a specific peer \[parameter] parameter description date plane specify that locally generated bfd packets are processed by the hardware \[view] bgp configuration view \[usage scenario] by default, when bfd functionality is enabled, both the reception and transmission of bfd packets on the device are processed by the cpu if the device is running multiple network protocols and the cpu is relatively busy, it may lead to inaccurate bfd detection results due to cpu processing delays enabling this feature ensures that bfd packets generated locally by the device are processed by the hardware, reducing the performance load on the cpu \[use cases] sonic(config) router bgp 65100 sonic(config router)# neighbor 44 1 3 1 remote as external sonic(config router)# neighbor 44 1 3 1 bfd data plane neighbor capability extended nexthop neighbor capability extended nexthop \[command] neighbor { a b c d | x\ x x \ x | string } capability extended nexthop no neighbor { a b c d | x\ x x \ x | string } capability extended nexthop \[purpose] allow bgp to negotiate extended next hop capability with its peers \[parameter] parameter description a b c d neighbor address x\ x x \ x neighbor ipv6 address string peer group name \[view] bgp configuration view \[notes] allow bgp to negotiate the extended nexthop capability with it’s peer if user is peering over a ipv6 ll address then this capability is turned on automatically if user is peering over a ipv6 global address then turning on this command will allow bgp to install ipv4 routes with ipv6 nexthops if you do not have ipv4 configured on interfaces \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# neighbor 1 1 1 1 capability extended nexthop neighbor capability dynamic neighbor capability dynamic \[command] neighbor { a b c d | x\ x x \ x | string } capability dynamic no neighbor { a b c d | x\ x x \ x | string } capability dynamic \[purpose] allow bgp to negotiate the extended nexthop capability with it’s peer \[parameter] parameter description a b c d neighbor address x\ x x \ x neighbor ipv6 address string peer group name \[view] bgp configuration view \[notes] dynamic capability defines a new bgp message (capability) that can be used to set/unset bgp capabilities without bringing down a bgp session this includes changing graceful restart (llgr also) timers, enabling/disabling add path, and other supported capabilities \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# neighbor 1 1 1 1 capability dynamic neighbor description neighbor description \[command] neighbor { a b c d | x\ x x \ x | string } description string no neighbor { a b c d | x\ x x \ x | string } description string \[purpose] set description of the peer \[parameter] parameter description a b c d neighbor address x\ x x \ x neighbor ipv6 address string peer group name string describing this neighbor \[view] bgp configuration view \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# neighbor 1 1 1 1 description test neighbor disable connected check neighbor disable connected check \[command] neighbor { a b c d | x\ x x \ x | string } disable connected check no neighbor { a b c d | x\ x x \ x | string } disable connected check \[purpose] allow peerings between directly connected ebgp peers using loopback addresses \[parameter] parameter description a b c d neighbor address x\ x x \ x neighbor ipv6 address string peer group name \[view] bgp configuration view \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# neighbor 1 1 1 1 disable connected check neighbor ebgp multihop neighbor ebgp multihop \[command] neighbor { a b c d | x\ x x \ x | string } ebgp multihop count no neighbor { a b c d | x\ x x \ x | string } ebgp multihop count \[purpose] specifying ebgp multihop allows sessions with ebgp neighbors to establish when they are multiple hops away \[parameter] parameter description a b c d neighbor address x\ x x \ x neighbor ipv6 address string peer group name count maximum hop count (1 255) \[view] bgp configuration view \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# neighbor 1 1 1 1 ebgp multihop 2 neighbor interface neighbor interface \[command] neighbor { a b c d | x\ x x \ x | string } interface interface name no neighbor { a b c d | x\ x x \ x | string } interface interface name \[purpose] when you connect to a bgp peer over an ipv6 link local address, you have to specify the ifname of the interface used for the connection \[parameter] parameter description a b c d neighbor address x\ x x \ x neighbor ipv6 address string interface name or neighbor tag interface name interface name \[view] bgp configuration view \[usage scenario] when you connect to a bgp peer over an ipv6 link local address, you have to specify the ifname of the interface used for the connection to specify ipv4 session addresses, see the neighbor peer update source command below \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# neighbor 1 1 1 1 interface ethernet49 neighbor local as neighbor local as \[command] neighbor { a b c d | x\ x x \ x | string } local as asn \[no prepend] \[replace as] no neighbor { a b c d | x\ x x \ x | string } local as asn \[no prepend] \[replace as] \[purpose] specify an alternate as for this bgp process when interacting with the specified peer \[parameter] parameter description a b c d neighbor address x\ x x \ x neighbor ipv6 address string interface name or neighbor tag asn as number \[view] bgp configuration view \[usage scenario] 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 \[notes] note that replace as can only be specified if no prepend is \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# neighbor 1 1 1 1 local as 123 no prepend replace as neighbor password neighbor password \[command] neighbor { a b c d | x\ x x \ x | string } password password neighbor { a b c d | x\ x x \ x | string } password passowrd \[purpose] set a md5 password to be used with the tcp socket that is being used to connect to the remote peer \[parameter] parameter description a b c d neighbor address x\ x x \ x neighbor ipv6 address string ipeer group name password the password \[view] bgp configuration view \[usage scenario] to enhance the security of bgp connections, md5 authentication can be used during the establishment of tcp connections when the passwords at both ends of the bgp neighbors do not match, the bgp neighbor establishment will fail \[notes] it is important to note that the key will be displayed in ciphertext, meaning that the password will not be visible in plain text \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# neighbor 1 1 1 1 password test1234 neighbor port neighbor port \[command] neighbor { a b c d | x\ x x \ x | string } port port no neighbor { a b c d | x\ x x \ x | string } port port \[purpose] specify the l4 port to use for the bgp session to this neighbor \[parameter] parameter description a b c d neighbor address x\ x x \ x neighbor ipv6 address string peer group name port tcp port number (0 65535) \[view] bgp configuration view \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# neighbor 1 1 1 1 port 234 neighbor remote as neighbor remote as \[command] neighbor { a b c d | x\ x x \ x | string } remote as \[ asn |internal|external] no neighbor { a b c d | x\ x x \ x | string } remote as \[ asn |internal|external] \[purpose] create a new neighbor whose remote as is asn \[parameter] parameter description a b c d neighbor address x\ x x \ x neighbor ipv6 address string peer group name asn as number \[view] bgp configuration view \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# neighbor 1 1 1 1 remote as 65101 sonic(config router)# neighbor 1 1 1 1 remote as external neighbor peer group neighbor peer group \[command] neighbor peer group name peer group no neighbor peer group name peer group \[purpose] create a peer group \[view] bgp configuration view \[usage scenario] in large scale bgp networks, the number of peers can be substantial, and many of these peers share similar policies configuring these peers can be repetitive, but using peer groups can simplify the configuration process when a user wants to apply the same configuration to several peers, they can create a peer group, configure it accordingly, and then add the peers to that group this way, all peers within the group inherit the group's configuration \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# neighbor peer v4 ebgp peer group neighbor peer group neighbor peer group \[command] neighbor { a b c d | x\ x x \ x | string } peer group name no neighbor { a b c d | x\ x x \ x | string } peer group name \[purpose] this command bind specific peer to peer group \[parameter] parameter description a b c d neighbor address x\ x x \ x neighbor ipv6 address name peer group name \[view] bgp configuration view \[usage scenario] a peer group is a collection of peers with similar policies or attributes when a peer joins a peer group, the configuration settings for that peer group apply to all members within the group in situations where there are a significant number of peers with identical configurations in the network, configuring peer groups can streamline the setup process \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# neighbor 1 1 1 1 peer group peer v4 ebgp neighbor update source neighbor update source \[command] neighbor { a b c d | x\ x x \ x | string } update source { a b c d | x\ x x \ x | string } no neighbor { a b c d | x\ x x \ x | string } update source { a b c d | x\ x x \ x | string } \[purpose] specify the ipv4 source address to use for the bgp session to this neighbor \[parameter] parameter description a b c d neighbor address x\ x x \ x neighbor ipv6 address string peer group name \[view] bgp configuration view \[usage scenario] specify the ipv4 source address to use for the bgp session to this neighbor, may be specified as either an ipv4 address directly or as an interface name \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# neighbor 1 1 1 1 update source ethernet49 neighbor activate neighbor activate \[command] neighbor { a b c d | x\ x x \ x | string } activate no neighbor { a b c d | x\ x x \ x | string } activate \[purpose] enable a specific bgp peer \[parameter] parameter description a b c d ipv4 address x\ x x \ x ipv6 address \[view] ip address family view \[notes] by default, only the ipv4 unicast address family is announced to all neighbors using the no bgp default ipv4 unicast configuration overrides this default so that all address families need to be enabled explicitly \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# address family ipv4 unicast sonic(config router af)# network 1 1 1 1 activate neighbor allowas in neighbor allowas in \[command] neighbor { a b c d | x\ x x \ x | string } allowas in \[ number |origin] no neighbor { a b c d | x\ x x \ x | string } allowas in \[ number |origin] \[purpose] this command accepts incoming routes with as paths that have the same value as the current system's as \[parameter] parameter description a b c d neighbor address x\ x x \ x neighbor ipv6 address string interface name or neighbor tag number number of occurrences of as number (1 10) \[view] ip address family view \[usage scenario] normally, bgp determines the presence of loops by checking for the presence of the same as number in the as path attribute this command allows you to configure the maximum number of times the local as number is allowed to repeat, meeting the requirements of special scenarios。 \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# address family ipv4 unicast sonic(config router af)# neighbor 1 1 1 1 allowas in 2 neighbor as override neighbor as override \[command] neighbor { a b c d | x\ x x \ x | string } as override no neighbor { a b c d | x\ x x \ x | string } as override \[purpose] override as number of the originating router with the local as number \[parameter] parameter description a b c d neighbor address x\ x x \ x neighbor ipv6 address string interface name or neighbor tag \[view] ip address family view \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# address family ipv4 unicast sonic(config router af)# neighbor 1 1 1 1 as override neighbor attribute unchanged neighbor attribute unchanged \[command] neighbor { a b c d | x\ x x \ x | string } attribute unchanged \[{ as path | next hop | med }] no neighbor { a b c d | x\ x x \ x | string } attribute unchanged \[{ as path | next hop|med }] \[purpose] preserve the next hop when advertising routes to a specified ebgp peer \[parameter] parameter description a b c d neighbor address x\ x x \ x neighbor ipv6 address string peer group name \[view] ip address family view \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# address family ipv4 unicast sonic(config router af)# neighbor 1 1 1 1 attribute unchanged as path neighbor default originate neighbor default originate \[command] neighbor { a b c d | x\ x x \ x | string } default originate \[ route map word ] no neighbor { a b c d | x\ x x \ x | string } default originate \[ route map word ] \[purpose] advertise a default route to a specified peer \[parameter] parameter description a b c d neighbor address x\ x x \ x neighbor ipv6 address string peer group name word route map name \[view] ip address family view \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# address family ipv4 unicast sonic(config router af)# neighbor 1 1 1 1 default originate route map test neighbor next hop self neighbor next hop self \[command] neighbor { a b c d | x\ x x \ x | string } next hop self \[force] no neighbor { a b c d | x\ x x \ x | string } next hop self \[force] \[purpose] when announcing routes to ibgp peers or peer groups, set the next hop attribute to the local ip address \[parameter] parameter description a b c d neighbor address x\ x x \ x neighbor ipv6 address string interface name or neighbor tag force if the optional keyword force is specified, the modification is done also for routes learned via ibgp \[view] ip address family view \[usage scenario] by default, when a device learns routes from its ebgp neighbors and forwards them to its ibgp neighbors, it does not modify the next hop ip address of the routes as a result, the next hop of the route remains the neighbor address of the ebgp neighbor when ibgp neighbors receive these routes, they become unusable because the next hop is unreachable to avoid this situation, you can resolve it by configuring the "next hop self" command \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# address family ipv4 unicast sonic(config router af)# neighbor 1 1 1 1 next hop self force neighbor prefix list neighbor prefix list \[command] neighbor { a b c d | x\ x x \ x | string } prefix list name \[in|out] no neighbor { a b c d | x\ x x \ x | string } prefix list name \[in|out] \[purpose] apply a prefix list on the neighbor \[parameter] parameter description a b c d neighbor address x\ x x \ x neighbor ipv6 address string interface name or neighbor tag name prefix list name \[view] ip address family view \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# address family ipv4 unicast sonic(config router af)# neighbor 1 1 1 1 prefix list test in neighbor route reflector client neighbor route reflector client \[command] neighbor { a b c d | x\ x x \ x | string } route reflector client no neighbor { a b c d | x\ x x \ x | string } route reflector client \[purpose] configure the current device as a route reflector when establishing a bgp connection with the specified neighbor \[view] ip address family view \[usage scenario] to ensure connectivity between ibgp peers, it's necessary to establish full mesh connections between ibgp peers however, when there are many ibgp peers, this consumes significant network and cpu resources utilizing route reflectors can address this issue by allowing bgp routers to establish connections only with a few route reflectors instead of all other routers \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# address family ipv4 unicast sonic(config router af)# neighbor 1 1 1 1 route reflector client neighbor route map neighbor route map \[command] neighbor { a b c d | x\ x x \ x | string } route map name \[in|out] no neighbor { a b c d | x\ x x \ x | string } route map name \[in|out] \[purpose] apply a route map on the neighbor \[parameter] parameter description a b c d neighbor address x\ x x \ x neighbor ipv6 address string peer group name name route map name \[view] ip address family view \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# address family ipv4 unicast sonic(config router af)# neighbor 1 1 1 1 route map test in neighbor send community neighbor send community \[command] neighbor { a b c d | x\ x x \ x | string } send community \[both|all|extended|standard|large] no neighbor { a b c d | x\ x x \ x | string } send community \[both|all|extended|standard|large] \[purpose] set the route’community for the neighbor \[parameter] parameter description a b c d neighbor address x\ x x \ x neighbor ipv6 address string peer group name both send both standard and extended community attributes all send both standard, extended and large community attributes extended send extended community attributes standard send standard community attributes large send large community attributes \[view] ip address family view \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# address family ipv4 unicast sonic(config router af)# neighbor 1 1 1 1 send community extended neighbor shutdown neighbor shutdown \[command] neighbor { a b c d | x\ x x \ x | string } shutdown \[\[ message msg ] |\[ rtt rtt \[ count count ]]] no neighbor { a b c d | x\ x x \ x | string } shutdown \[\[ message msg ] ||\[ rtt rtt \[ count count ]]] \[purpose] shutdown the peer \[parameter] parameter description a b c d neighbor address x\ x x \ x neighbor ipv6 address string interface name or neighbor tag msg shutdown message rtt round trip time in milliseconds (1 65535) count specify the number of keepalives before shutdown \[view] bgp configuration view \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# neighbor 1 1 1 1 shutdown message testing neighbor ttl security hops neighbor ttl security hops \[command] neighbor { a b c d | x\ x x \ x | string } ttl security hops number no neighbor { a b c d | x\ x x \ x | string } ttl security hops number \[purpose] this command enforces generalized ttl security mechanism (gtsm), as specified in rfc 5082 \[parameter] parameter description a b c d neighbor address x\ x x \ x neighbor ipv6 address string interface name or neighbor tag number number of hops to bgp peer (1 254) \[view] bgp configuration view \[notes] with this command, only neighbors that are the specified number of hops away will be allowed to become neighbors this command is mutually exclusive with ebgp multihop \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# neighbor 1 1 1 1 ttl security hops 2 neighbor weight neighbor weight \[command] neighbor { a b c d | x\ x x \ x | string } weight weight no neighbor { a b c d | x\ x x \ x | string } weight weight \[purpose] this command specifies a default weight value for the neighbor’s routes \[parameter] parameter description a b c d neighbor address x\ x x \ x neighbor ipv6 address string interface name or neighbor tag weight weight (0 65535) \[view] ip address family view \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# address family ipv4 unicast sonic(config router af)# neighbor 1 1 1 1 weight 2 neighbor interface neighbor interface \[command] neighbor { ethernet | link aggregation | vlan } id interface no neighbor { ethernet | link aggregation | vlan } id interface \[purpose] establish bgp connections using the interface's ipv6 link local address \[parameter] parameter description id interface id/link aggregation id/ vlan id \[view] bgp config view、ip address family view \[notes] to use this command, first enable ipv6 use link local on the relevant interface configuring a bgp peer this way is equivalent to using the neighbor \[ip address] command and supports all the same command line options \[use cases] sonic# configure terminal sonic(config)# router bgp 65100 sonic(config router)# neighbor ethernet 1 interface remote as 200 sonic(config router af)# address family ipv4 unicast sonic(config router af)# neighbor ethernet 1 activate
