Created
April 20, 2021 13:59
-
-
Save rohitthakur2590/150a8b7d6ee47e4d562a7c04789ea9e6 to your computer and use it in GitHub Desktop.
ios_bgp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: IOS_BGP | |
hosts: ios-lab | |
tasks: | |
- name: Configure global BGP | |
cisco.ios.ios_bgp: | |
config: | |
bgp_as: 65000 | |
router_id: 192.168.1.1 | |
log_neighbor_changes: true | |
neighbors: | |
- neighbor: 10.200.200.2 | |
remote_as: 65001 | |
ebgp_multihop: 255 | |
address_family: | |
- afi: ipv4 | |
redistribute: | |
- protocol: ospf | |
id: 1 | |
neighbors: | |
- neighbor: 10.200.200.2 | |
activate: yes | |
networks: | |
- prefix: 10.100.100.0 | |
masklen: 24 | |
- prefix: 10.200.200.0 | |
masklen: 24 | |
- prefix: 172.16.0.0 | |
masklen: 16 | |
- prefix: 192.168.1.1 | |
masklen: 32 | |
- prefix: 10.25.25.0 | |
masklen: 24 | |
- prefix: 10.25.26.0 | |
masklen: 24 | |
operation: merge | |
############################################################################################# | |
changed: [10.8.38.76] => { | |
"changed": true, | |
"commands": [ | |
"router bgp 65000", | |
"bgp router-id 192.168.1.1", | |
"bgp log-neighbor-changes", | |
"neighbor 10.200.200.2 remote-as 65001", | |
"neighbor 10.200.200.2 ebgp-multihop 255", | |
"address-family ipv4", | |
"redistribute ospf 1", | |
"neighbor 10.200.200.2 activate", | |
"network 10.100.100.0 mask 255.255.255.0", | |
"network 10.200.200.0 mask 255.255.255.0", | |
"network 172.16.0.0 mask 255.255.0.0", | |
"network 192.168.1.1 mask 255.255.255.255", | |
"network 10.25.25.0 mask 255.255.255.0", | |
"network 10.25.26.0 mask 255.255.255.0", | |
"exit-address-family", | |
"exit" | |
], | |
"invocation": { | |
"module_args": { | |
"config": { | |
"address_family": [ | |
{ | |
"afi": "ipv4", | |
"auto_summary": null, | |
"neighbors": [ | |
{ | |
"activate": true, | |
"advertisement_interval": null, | |
"maximum_prefix": null, | |
"neighbor": "10.200.200.2", | |
"next_hop_self": null, | |
"next_hop_unchanged": null, | |
"prefix_list_in": null, | |
"prefix_list_out": null, | |
"remove_private_as": null, | |
"route_reflector_client": null, | |
"route_server_client": null | |
} | |
], | |
"networks": [ | |
{ | |
"masklen": 24, | |
"prefix": "10.100.100.0", | |
"route_map": null | |
}, | |
{ | |
"masklen": 24, | |
"prefix": "10.200.200.0", | |
"route_map": null | |
}, | |
{ | |
"masklen": 16, | |
"prefix": "172.16.0.0", | |
"route_map": null | |
}, | |
{ | |
"masklen": 32, | |
"prefix": "192.168.1.1", | |
"route_map": null | |
}, | |
{ | |
"masklen": 24, | |
"prefix": "10.25.25.0", | |
"route_map": null | |
}, | |
{ | |
"masklen": 24, | |
"prefix": "10.25.26.0", | |
"route_map": null | |
} | |
], | |
"redistribute": [ | |
{ | |
"id": "1", | |
"metric": null, | |
"protocol": "ospf", | |
"route_map": null | |
} | |
], | |
"safi": "unicast", | |
"synchronization": null | |
} | |
], | |
"bgp_as": 65000, | |
"log_neighbor_changes": true, | |
"neighbors": [ | |
{ | |
"description": null, | |
"ebgp_multihop": 255, | |
"enabled": null, | |
"local_as": null, | |
"neighbor": "10.200.200.2", | |
"password": null, | |
"peer_group": null, | |
"remote_as": 65001, | |
"timers": null, | |
"update_source": null | |
} | |
], | |
"networks": null, | |
"router_id": "192.168.1.1" | |
}, | |
"operation": "merge" | |
} | |
} | |
} | |
################################################################################################# | |
after: | |
an-iosl2-02#sh running-config | section ^router bgp | |
router bgp 65000 | |
bgp router-id 192.168.1.1 | |
bgp log-neighbor-changes | |
neighbor 10.200.200.2 remote-as 65001 | |
neighbor 10.200.200.2 ebgp-multihop 255 | |
! | |
address-family ipv4 | |
network 10.25.25.0 mask 255.255.255.0 | |
network 10.25.26.0 mask 255.255.255.0 | |
network 10.100.100.0 mask 255.255.255.0 | |
network 10.200.200.0 mask 255.255.255.0 | |
network 172.16.0.0 | |
network 192.168.1.1 mask 255.255.255.255 | |
redistribute ospf 1 | |
neighbor 10.200.200.2 activate | |
exit-address-family | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment