Fortinet black logo

CLI Reference

config router bgp

config router bgp

Use these commands to configure BGP-related options, such as AS ID, router ID, distance of routes, redistribute route , etc., including BGP network, neighbor, and ha-router-id-list configurations.

Before you begin:
  • You must know how BGP has been implemented in your network, i.e., the configuration details of the implementation.
  • You must have read-write permission for system settings.
  • You must have configured all the required access (IPv6) lists and prefix (IPv6) lists.

Syntax

config router bgp

set as <id>

set router-id <ipv4 address>

set distance-external <1-255>

set distance-external6 <1-255>

set distance-internal <1-255>

set distance-internal6 <1-255>

set distance-local <1-255>

set distance-local6 <1-255>

set redistribute-ospf {enable|disable}

set redistribute-connected {enable|disable}

set redistribute-static {enable|disable}

set redistribute-connected6 {enable|disable}

set redistribute-static6 {enable|disable}

set always-compare-med {enable|disable}

set deterministic-med {enable|disable}

set bestpath-as-path-ignore {enable|disable}

set bestpath-cmp-routerid {enable|disable}

set bestpath-med-missing-as-worst {enable|disable}

config network

edit <id>

set type {ipv4|ipv6}

set prefix <ipv4-netmask>

set prefix6 <ipv6-netmask>

next

end

config neighbor

edit <id>

set remote-as <id>

set addr-type {ipv4|ipv6}

set ip <ipv4 address>

set ip6 <ipv6 address>

set interface <interface name>

set port <0-65535>

set keepalive-timer <0-65535>

set holdtime-timer <0-65535>

set default-originate {enable|disable}

set distribute-list-in <access list name>

set distribute-list-out <access list name>

set distribute-list-in6 <ipv6 access list name>

set distribute-list-out6 <ipv6 access list name>

set prefix-list-in <prefix list name>

set prefix-list-out <prefix list name>

set prefix-list-in6 <ipv6 prefix list name>

set prefix-list-out6 <ipv6 prefix list name>

set ebgp-multihop <1-255 >

set next-hop-self {enable|disable}

set passive {enable|disable}

set password <password>

set shutdown {enable|disable}

set ttl-security <1-254>

set update-source-type {interface|address}

set update-source-interface <interface name>

set update-source-ip <ipv4 address>

set update-source-ip6 <ipv6 address>

set weight <0-65535>

set bfd {enable|disable}

next

end

config ha-router-id-list

edit <id>

set router-id <ipv4 address>

set node <0-7>

next

end

end

as <id>

Specify the AS (Autonomous System) number.

router-id

Specify a unique value to identify the router, using an IPv4 address.

distance-external

Specify the distance for routes external to the AS.

distance-external6

Specify the distance for IPv6 routes external to the AS.

distance-internal

Specify the distance for routes internal to the AS.

distance-internal6

Specify the distance for IPv6 routes internal to the AS.

distance-local

Specify the distance for routes local to the AS.

distance-local6

Specify the distance for IPv6 routes local to the AS.

redistribute-ospf

Enable/disable the redistribute OSPF route to the BGP server.

redistribute-connected

Enable/disable the redistribute connected route to the BGP server.

redistribute-static

Enable/disable the redistribute static route to the BGP server.

redistribute-connected6

Enable/disable the redistribute connected IPv6 route to the BGP server.

redistribute-static6

Enable/disable the redistribute static IPv6 route to the BGP server.

always-compare-med

Enable/disable always compare MED (Multi-Exit Discriminator) for BGP decision.

deterministic-med

Enable/disable enforce deterministic comparison of MED for BGP decision.

bestpath-as-path-ignore

Enable/disable ignore AS path for BGP decision.

bestpath-cmp-routerid

Enable/disable compare router ID for identical EBGP paths for BGP decision.

bestpath-med-missing-as-worst

Enable/disable treat missing MED as least preferred for BGP decision.

Network

type

Specify the address type: IPv4 or IPv6.

prefix

Specify the network prefix when (address) type is IPv4, using the IP/mask format.

prefix6

Specify the network prefix when (address) type is IPv6, using the IPv6/mask format.

Neighbor

remote-as

The AS number of the neighbor.

addr-type

Address type used to configure the neighbor

ip

IP address of the neighbor.

ip6

IPv6 address of the neighbor.

interface

Interface that connected to neighbor

port

Port number that communicate with the neighbor.

keepalive-timer

Frequency to send keep alive requests.

holdtime-timer

Number of seconds to mark peer as dead.

default-originate

Enable/disable originate default route to this neighbor.

distribute-list-in

Filter for IP updates from this neighbor.

distribute-list-out

Filter for IP updates to this neighbor.

distribute-list-in6

Filter for IPv6 updates from this neighbor.

distribute-list-out6

Filter for IPv6 updates to this neighbor.

prefix-list-in

IP Inbound filter for updates from this neighbor.

prefix-list-out

IP Outbound filter for updates to this neighbor.

prefix-list-in6

IPv6 Inbound filter for updates from this neighbor.

prefix-list-out6

IPv6 Outbound filter for updates to this neighbor.

ebgp-multihop

Specify the maximum multi-hops allowed for EBGP neighbors. Only need for EBGP neighbor, cannot set with ttl-security.

next-hop-self

Enable/disable IP next-hop calculation for this neighbor.

passive

Enable/disable sending of open messages to this neighbor.

password

Set Password.

shutdown

Enable/disable shutdown for this neighbor.

update-source-type

Type of source for routing updates.

update-source-interface

Interface Source for routing updates.

update-source-ip

IP address Source for routing updates.

update-source-ip6

IPv6 address Source for routing updates.

weight

Default weight for routes from this neighbor. Range is <0-65535>.

bfd

Enable to activate Bidirectional Forwarding Detection (BFD) on the BGP session. When BFD detects a path failure, a neighbor Down event is notified immediately to the BGP process, triggering a BGP neighbor status change.

HA router ID list

router-id

Specify the router ID, using IPv4 address.

node <0-7>

Specify Node ID of HA Node.

Examples for IPv4 BGP configuration

Configure BGP router

FortiADC-VM (root) # config router bgp

FortiADC-VM (bgp) # set as 101

FortiADC-VM (bgp) # set router-id 10.0.6.217

FortiADC-VM (bgp) # set distance-internal 300

FortiADC-VM (bgp) # set redistribute-static enable

Configure BGP network

FortiADC-VM (bgp) # config network

FortiADC-VM (network) # edit 1

FortiADC-VM (1) # set type ipv4

FortiADC-VM (1) # set prefix 172.15.1.0/24

FortiADC-VM (1) # next

FortiADC-VM (network) # edit 2

FortiADC-VM (1) # set type ipv4

FortiADC-VM (1) # set prefix 192.168.11.0/24

FortiADC-VM (1) # next

FortiADC-VM (network) # end

Configure BGP neighbor

FortiADC-VM (bgp) # config neighbor

FortiADC-VM (neighbor) # edit 1

FortiADC-VM (1) # set remote-as 101

FortiADC-VM (1) # set ip 172.15.11.218

FortiADC-VM (1) # set interface port2

FortiADC-VM (1) # next

FortiADC-VM (neighbor) # end

FortiADC-VM (bgp) # get

as : 101

router-id : 10.0.6.217

distance-external : 20

distance-internal : 250

distance-local : 200

redistribute-ospf : disable

redistribute-connected : disable

redistribute-static : enable

redistribute-connected6 : disable

redistribute-static6 : disable

always-compare-med : disable

deterministic-med : disable

bestpath-as-path-ignore : disable

bestpath-cmp-routerid : disable

bestpath-med-missing-as-worst : disable

== [ 1 ]

== [ 2 ]

== [ 1 ]

FortiADC-VM (bgp) # end

Examples for IPv6 BGP configuration

Configure BGP router (IPv6)

FortiADC-VM (root) # config router bgp

FortiADC-VM (bgp) # set as 101

FortiADC-VM (bgp) # set router-id 10.0.6.217

FortiADC-VM (bgp) # config network #configure BGP network

FortiADC-VM (network) # edit 1

FortiADC-VM (1) # set type ipv6

FortiADC-VM (1) # set prefix6 2015::/64

FortiADC-VM (1) # next

FortiADC-VM (network) # edit 2

FortiADC-VM (1) # set type ipv4

FortiADC-VM (1) # set prefix6 2016::/64

FortiADC-VM (1) # next

FortiADC-VM (network) # end

Configure BGP network (IPv6)

FortiADC-VM (bgp) # config network

FortiADC-VM (network) # edit 1

FortiADC-VM (1) # set type ipv6

FortiADC-VM (1) # set prefix6 2015::/64

FortiADC-VM (1) # next

FortiADC-VM (network) # edit 2

FortiADC-VM (1) # set type ipv4

FortiADC-VM (1) # set prefix6 2016::/64

FortiADC-VM (1) # next

FortiADC-VM (network) # end

Configure BGP neighbor (IPv6)

FortiADC-VM (bgp) # config neighbor #configure BGP neighbor

FortiADC-VM (neighbor) # edit 1

FortiADC-VM (1) # set remote-as 101

FortiADC-VM (1) # set addr-type ipv6

FortiADC-VM (1) # set ip6 2016::2

FortiADC-VM (1) # set interface port2

FortiADC-VM (1) # next

FortiADC-VM (neighbor) # end

FortiADC-VM (bgp) # end

config router bgp

Use these commands to configure BGP-related options, such as AS ID, router ID, distance of routes, redistribute route , etc., including BGP network, neighbor, and ha-router-id-list configurations.

Before you begin:
  • You must know how BGP has been implemented in your network, i.e., the configuration details of the implementation.
  • You must have read-write permission for system settings.
  • You must have configured all the required access (IPv6) lists and prefix (IPv6) lists.

Syntax

config router bgp

set as <id>

set router-id <ipv4 address>

set distance-external <1-255>

set distance-external6 <1-255>

set distance-internal <1-255>

set distance-internal6 <1-255>

set distance-local <1-255>

set distance-local6 <1-255>

set redistribute-ospf {enable|disable}

set redistribute-connected {enable|disable}

set redistribute-static {enable|disable}

set redistribute-connected6 {enable|disable}

set redistribute-static6 {enable|disable}

set always-compare-med {enable|disable}

set deterministic-med {enable|disable}

set bestpath-as-path-ignore {enable|disable}

set bestpath-cmp-routerid {enable|disable}

set bestpath-med-missing-as-worst {enable|disable}

config network

edit <id>

set type {ipv4|ipv6}

set prefix <ipv4-netmask>

set prefix6 <ipv6-netmask>

next

end

config neighbor

edit <id>

set remote-as <id>

set addr-type {ipv4|ipv6}

set ip <ipv4 address>

set ip6 <ipv6 address>

set interface <interface name>

set port <0-65535>

set keepalive-timer <0-65535>

set holdtime-timer <0-65535>

set default-originate {enable|disable}

set distribute-list-in <access list name>

set distribute-list-out <access list name>

set distribute-list-in6 <ipv6 access list name>

set distribute-list-out6 <ipv6 access list name>

set prefix-list-in <prefix list name>

set prefix-list-out <prefix list name>

set prefix-list-in6 <ipv6 prefix list name>

set prefix-list-out6 <ipv6 prefix list name>

set ebgp-multihop <1-255 >

set next-hop-self {enable|disable}

set passive {enable|disable}

set password <password>

set shutdown {enable|disable}

set ttl-security <1-254>

set update-source-type {interface|address}

set update-source-interface <interface name>

set update-source-ip <ipv4 address>

set update-source-ip6 <ipv6 address>

set weight <0-65535>

set bfd {enable|disable}

next

end

config ha-router-id-list

edit <id>

set router-id <ipv4 address>

set node <0-7>

next

end

end

as <id>

Specify the AS (Autonomous System) number.

router-id

Specify a unique value to identify the router, using an IPv4 address.

distance-external

Specify the distance for routes external to the AS.

distance-external6

Specify the distance for IPv6 routes external to the AS.

distance-internal

Specify the distance for routes internal to the AS.

distance-internal6

Specify the distance for IPv6 routes internal to the AS.

distance-local

Specify the distance for routes local to the AS.

distance-local6

Specify the distance for IPv6 routes local to the AS.

redistribute-ospf

Enable/disable the redistribute OSPF route to the BGP server.

redistribute-connected

Enable/disable the redistribute connected route to the BGP server.

redistribute-static

Enable/disable the redistribute static route to the BGP server.

redistribute-connected6

Enable/disable the redistribute connected IPv6 route to the BGP server.

redistribute-static6

Enable/disable the redistribute static IPv6 route to the BGP server.

always-compare-med

Enable/disable always compare MED (Multi-Exit Discriminator) for BGP decision.

deterministic-med

Enable/disable enforce deterministic comparison of MED for BGP decision.

bestpath-as-path-ignore

Enable/disable ignore AS path for BGP decision.

bestpath-cmp-routerid

Enable/disable compare router ID for identical EBGP paths for BGP decision.

bestpath-med-missing-as-worst

Enable/disable treat missing MED as least preferred for BGP decision.

Network

type

Specify the address type: IPv4 or IPv6.

prefix

Specify the network prefix when (address) type is IPv4, using the IP/mask format.

prefix6

Specify the network prefix when (address) type is IPv6, using the IPv6/mask format.

Neighbor

remote-as

The AS number of the neighbor.

addr-type

Address type used to configure the neighbor

ip

IP address of the neighbor.

ip6

IPv6 address of the neighbor.

interface

Interface that connected to neighbor

port

Port number that communicate with the neighbor.

keepalive-timer

Frequency to send keep alive requests.

holdtime-timer

Number of seconds to mark peer as dead.

default-originate

Enable/disable originate default route to this neighbor.

distribute-list-in

Filter for IP updates from this neighbor.

distribute-list-out

Filter for IP updates to this neighbor.

distribute-list-in6

Filter for IPv6 updates from this neighbor.

distribute-list-out6

Filter for IPv6 updates to this neighbor.

prefix-list-in

IP Inbound filter for updates from this neighbor.

prefix-list-out

IP Outbound filter for updates to this neighbor.

prefix-list-in6

IPv6 Inbound filter for updates from this neighbor.

prefix-list-out6

IPv6 Outbound filter for updates to this neighbor.

ebgp-multihop

Specify the maximum multi-hops allowed for EBGP neighbors. Only need for EBGP neighbor, cannot set with ttl-security.

next-hop-self

Enable/disable IP next-hop calculation for this neighbor.

passive

Enable/disable sending of open messages to this neighbor.

password

Set Password.

shutdown

Enable/disable shutdown for this neighbor.

update-source-type

Type of source for routing updates.

update-source-interface

Interface Source for routing updates.

update-source-ip

IP address Source for routing updates.

update-source-ip6

IPv6 address Source for routing updates.

weight

Default weight for routes from this neighbor. Range is <0-65535>.

bfd

Enable to activate Bidirectional Forwarding Detection (BFD) on the BGP session. When BFD detects a path failure, a neighbor Down event is notified immediately to the BGP process, triggering a BGP neighbor status change.

HA router ID list

router-id

Specify the router ID, using IPv4 address.

node <0-7>

Specify Node ID of HA Node.

Examples for IPv4 BGP configuration

Configure BGP router

FortiADC-VM (root) # config router bgp

FortiADC-VM (bgp) # set as 101

FortiADC-VM (bgp) # set router-id 10.0.6.217

FortiADC-VM (bgp) # set distance-internal 300

FortiADC-VM (bgp) # set redistribute-static enable

Configure BGP network

FortiADC-VM (bgp) # config network

FortiADC-VM (network) # edit 1

FortiADC-VM (1) # set type ipv4

FortiADC-VM (1) # set prefix 172.15.1.0/24

FortiADC-VM (1) # next

FortiADC-VM (network) # edit 2

FortiADC-VM (1) # set type ipv4

FortiADC-VM (1) # set prefix 192.168.11.0/24

FortiADC-VM (1) # next

FortiADC-VM (network) # end

Configure BGP neighbor

FortiADC-VM (bgp) # config neighbor

FortiADC-VM (neighbor) # edit 1

FortiADC-VM (1) # set remote-as 101

FortiADC-VM (1) # set ip 172.15.11.218

FortiADC-VM (1) # set interface port2

FortiADC-VM (1) # next

FortiADC-VM (neighbor) # end

FortiADC-VM (bgp) # get

as : 101

router-id : 10.0.6.217

distance-external : 20

distance-internal : 250

distance-local : 200

redistribute-ospf : disable

redistribute-connected : disable

redistribute-static : enable

redistribute-connected6 : disable

redistribute-static6 : disable

always-compare-med : disable

deterministic-med : disable

bestpath-as-path-ignore : disable

bestpath-cmp-routerid : disable

bestpath-med-missing-as-worst : disable

== [ 1 ]

== [ 2 ]

== [ 1 ]

FortiADC-VM (bgp) # end

Examples for IPv6 BGP configuration

Configure BGP router (IPv6)

FortiADC-VM (root) # config router bgp

FortiADC-VM (bgp) # set as 101

FortiADC-VM (bgp) # set router-id 10.0.6.217

FortiADC-VM (bgp) # config network #configure BGP network

FortiADC-VM (network) # edit 1

FortiADC-VM (1) # set type ipv6

FortiADC-VM (1) # set prefix6 2015::/64

FortiADC-VM (1) # next

FortiADC-VM (network) # edit 2

FortiADC-VM (1) # set type ipv4

FortiADC-VM (1) # set prefix6 2016::/64

FortiADC-VM (1) # next

FortiADC-VM (network) # end

Configure BGP network (IPv6)

FortiADC-VM (bgp) # config network

FortiADC-VM (network) # edit 1

FortiADC-VM (1) # set type ipv6

FortiADC-VM (1) # set prefix6 2015::/64

FortiADC-VM (1) # next

FortiADC-VM (network) # edit 2

FortiADC-VM (1) # set type ipv4

FortiADC-VM (1) # set prefix6 2016::/64

FortiADC-VM (1) # next

FortiADC-VM (network) # end

Configure BGP neighbor (IPv6)

FortiADC-VM (bgp) # config neighbor #configure BGP neighbor

FortiADC-VM (neighbor) # edit 1

FortiADC-VM (1) # set remote-as 101

FortiADC-VM (1) # set addr-type ipv6

FortiADC-VM (1) # set ip6 2016::2

FortiADC-VM (1) # set interface port2

FortiADC-VM (1) # next

FortiADC-VM (neighbor) # end

FortiADC-VM (bgp) # end