# iosxr_bgp – Configure global BGP protocol settings on Cisco IOS-XR

New in version 2.8.

- Synopsis
- Parameters
- Notes
- Examples
- Return Values
- Status

## Synopsis

- This module provides configuration management of global BGP parameters on devices running Cisco IOS-XR

## Parameters

Parameter | Choices/Defaults | Comments
--- | --- | ---
config - |  | Specifies the BGP related configuration.
| address_family - |  | Specifies BGP address family related configurations.

afi
- / required

Choices:
- ipv4
- ipv6

Type of address family to configure.

|  | networks - |  | Specify networks to announce via BGP. For operation replace, this option is mutually exclusive with root level networks option.
|  |  | masklen - |  | Subnet mask length for the network to announce(e.g, 8, 16, 24, etc.).
|  |  | network - / required |  | Network ID to announce via BGP.
|  |  | route_map - |  | Route map to modify the attributes.
|  | redistribute - |  | Specifies the redistribute information from another routing protocol.
|  |  | id - |  | Identifier for the routing protocol for configuring redistribute information. Valid for protocols 'ospf', 'eigrp', 'isis' and 'ospfv3'.
|  |  | metric - |  | Specifies the metric for redistributed routes.

protocol
- / required

Choices:
- ospf
- ospfv3
- eigrp
- isis
- static
- connected
- lisp
- mobile
- rip
- subscriber

Specifies the protocol for configuring redistribute information.

|  |  | route_map - |  | Specifies the route map reference.

safi
-

Choices:
- flowspec
- unicast ←
- multicast
- labeled-unicast

Specifies the type of cast for the address family.

| bgp_as integer / required |  | Specifies the BGP Autonomous System (AS) number to configure on the device.

log_neighbor_changes
boolean

Choices:
- no
- yes

Enable/disable logging neighbor up/down and reset reason.

| neighbors - |  | Specifies BGP neighbor related configurations.
|  | advertisement_interval integer |  | Specifies the minimum interval (in seconds) between sending BGP routing updates. The range is from 0 to 600.
|  | description - |  | Neighbor specific description.
|  | ebgp_multihop integer |  | Specifies the maximum hop count for EBGP neighbors not on directly connected networks. The range is from 0 to 255.

enabled
boolean

Choices:
- no
- yes

Administratively shutdown or enable a neighbor.

|  | neighbor - / required |  | Neighbor router address.
|  | password - |  | Password to authenticate the BGP peer connection.
|  | remote_as integer / required |  | Remote AS of the BGP neighbor to configure.
|  | tcp_mss integer |  | Specifies the TCP initial maximum segment size to use. The range is from 68 to 10000.
|  | timers - |  | Specifies BGP neighbor timer related configurations.
|  |  | holdtime integer / required |  | Interval after not receiving a keepalive message that the software declares a peer dead. The range is from 3 to 65535.
|  |  | keepalive integer / required |  | Frequency with which the Cisco IOS-XR software sends keepalive messages to its peer. The range is from 0 to 65535.
|  |  | min_neighbor_holdtime integer |  | Interval specifying the minimum acceptable hold-time from a BGP neighbor. The minimum acceptable hold-time must be less than, or equal to, the interval specified in the holdtime argument. The range is from 3 to 65535.
|  | update_source - |  | Source of the routing updates.
| router_id - | Default: null | Configures the BGP routing process router-id value.

operation
-

Choices:
- merge ←
- replace
- override
- delete

Specifies the operation to be performed on the BGP process configured on the device.
In case of merge, the input configuration will be merged with the existing BGP configuration on the device.
In case of replace, if there is a diff between the existing configuration and the input configuration, the existing configuration will be replaced by the input configuration for every option that has the diff.
In case of override, all the existing BGP configuration will be removed from the device and replaced with the input configuration.
In case of delete the existing BGP configuration will be removed from the device.

## Notes

Note

- Tested against Cisco IOS XR Software Version 6.1.3
- This module works with connection `network_cli`. See the IOS-XR Platform Options.

## Examples

    - name: configure global bgp as 65000
      iosxr_bgp:
        bgp_as: 65000
        router_id: 1.1.1.1
        neighbors:
          - neighbor: 182.168.10.1
            remote_as: 500
            description: PEER_1
          - neighbor: 192.168.20.1
            remote_as: 500
            update_source: GigabitEthernet 0/0/0/0
        address_family:
          - name: ipv4
            cast: unicast
            networks:
              - network: 192.168.2.0/23
              - network: 10.0.0.0/8
            redistribute:
              - protocol: ospf
                id: 400
                metric: 110

    - name: remove bgp as 65000 from config
      ios_bgp:
        bgp_as: 65000
        state: absent

## Return Values

Common return values are documented here, the following are the fields unique to this module:

Key | Returned | Description
--- | --- | ---

commands
list

always

The list of configuration mode commands to send to the device
Sample:
['router bgp 65000', 'bgp router-id 1.1.1.1', 'neighbor 182.168.10.1 remote-as 500', 'neighbor 182.168.10.1 description PEER_1', 'neighbor 192.168.20.1 remote-as 500', 'neighbor 192.168.20.1 update-source GigabitEthernet0/0/0/0', 'address-family ipv4 unicast', 'redistribute ospf 400 metric 110', 'network 192.168.2.0/23', 'network 10.0.0.0/8', 'exit']

## Status

- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Network Team. [network]

### Red Hat Support

More information about Red Hat’s support of this module is available from this Red Hat Knowledge Base article.

### Authors

- Nilashish Chakraborty (@NilashishC)

Hint

If you notice any issues in this documentation, you can edit this document to improve it.