Configuring BGP on a Cisco Nexus 3548 Switch (CLI)
Here's a comprehensive guide to configuring BGP on a Cisco Nexus 3548 switch using the CLI. This covers the basics, common configurations, and important considerations. This is a detailed guide, so it's broken down into sections.
1. Prerequisites & Planning
- Understand your BGP Topology: Before you start, you need a clear understanding of your BGP network. This includes:
- Autonomous System (AS) Number: Your AS number is crucial. This uniquely identifies your network to the internet. You'll need to obtain one if you're peering with external networks.
- Neighbor Relationships: Know the IP addresses and AS numbers of your BGP neighbors.
- Routing Policy: Decide what routes you want to advertise and accept. This involves route maps, prefix lists, and AS-path filters.
- Address Families: Determine which address families you'll be using (IPv4, IPv6, VPNv4, etc.). IPv4 is the most common.
- Connectivity: Ensure basic IP connectivity exists between your Nexus switch and its BGP neighbors. Ping and traceroute are your friends.
- Licensing: Verify you have the necessary licensing for BGP on your Nexus switch. Some features may require specific licenses.
2. Global BGP Configuration
First, enter global configuration mode:
configure terminal
Then, configure the BGP process:
router bgp <your_AS_number>
Replace <your_AS_number> with your actual AS number. For example:
router bgp 65001
Important Global Options:
-
router-id: Crucial for BGP stability. It's a 32-bit number, usually an IP address. If not configured, the highest IP address on a loopback interface is used. It's highly recommended to explicitly configure it.
router-id 192.168.1.1
-
bestpath as-path multipath-relax: (Optional, but often recommended) Allows BGP to choose multiple paths even if they have different AS paths. Can improve convergence.
bestpath as-path multipath-relax
-
bgp log-neighbor-changes: (Optional) Logs when BGP neighbor states change. Useful for troubleshooting.
bgp log-neighbor-changes
3. Neighbor Configuration
Now, configure your BGP neighbors. For each neighbor:
neighbor <neighbor_IP_address> remote-as <neighbor_AS_number>
Replace <neighbor_IP_address> with the IP address of the neighbor and <neighbor_AS_number> with its AS number. Example:
neighbor 10.1.1.2 remote-as 65002
Important Neighbor Options:
-
update-source: Specifies the source IP address for BGP updates. Important if you're using loopback interfaces.
neighbor 10.1.1.2 update-source Loopback0
-
ebgp-multihop: Required for eBGP (External BGP) neighbors that are not directly connected. Specifies the maximum TTL (Time To Live) for BGP packets.
neighbor 10.1.1.2 ebgp-multihop 2
-
address-family ipv4 unicast: Enables IPv4 unicast address family for the neighbor. This is the most common configuration.
neighbor 10.1.1.2 address-family ipv4 unicast
-
address-family ipv6 unicast: Enables IPv6 unicast address family.
neighbor 10.1.1.2 address-family ipv6 unicast
-
route-map <route_map_name> in: Applies a route map to incoming routes from the neighbor. Used for filtering and modifying routes.
neighbor 10.1.1.2 address-family ipv4 unicast route-map INBOUND_FILTER in
-
route-map <route_map_name> out: Applies a route map to outgoing routes to the neighbor.
neighbor 10.1.1.2 address-family ipv4 unicast route-map OUTBOUND_ADVERTISE out
-
send-community: Enables the sending of BGP communities to the neighbor. Communities are used for tagging routes and applying policies.
neighbor 10.1.1.2 address-family ipv4 unicast send-community
-
next-hop-self: Forces the Nexus switch to advertise itself as the next hop for routes it originates. Useful in certain topologies.
neighbor 10.1.1.2 address-family ipv4 unicast next-hop-self
4. Address Family Configuration
Within each neighbor configuration, you need to enable the address family (e.g., IPv4 unicast). This is where you define how routes are exchanged.
address-family ipv4 unicast
activate
exit
-
activate: Enables the address family for the neighbor.
-
redistribute connected: (Optional) Advertises directly connected routes to the neighbor. Use with caution!
-
redistribute static: (Optional) Advertises static routes to the neighbor. Use with caution!
-
network <network_address>/<prefix_length>: Advertises a specific network. This is how you tell BGP what networks you own.
network 192.168.10.0/24
5. Route Maps and Prefix Lists (Filtering & Policy)
Route maps and prefix lists are essential for controlling which routes are advertised and accepted.
-
Prefix Lists: Define a set of IP prefixes.
ip prefix-list ALLOWED_PREFIXES seq 5 permit 10.0.0.0/8 le 24
ip prefix-list DENIED_PREFIXES seq 5 deny 172.16.0.0/12
-
Route Maps: Match routes based on criteria (prefix list, AS path, etc.) and apply actions (permit, deny, set attributes).
route-map INBOUND_FILTER permit 10
match ip address prefix-list ALLOWED_PREFIXES
route-map INBOUND_FILTER deny 20
match ip address prefix-list DENIED_PREFIXES
6. Verification
Use these commands to verify your BGP configuration:
- show bgp summary: Displays a summary of BGP neighbors and their states. Look for "Established" state.
- show bgp ipv4 unicast: Displays the BGP routing table for IPv4 unicast.
- show bgp neighbors <neighbor_IP_address>: Displays detailed information about a specific neighbor.
- show route-map <route_map_name>: Displays the configuration of a route map.
- show ip prefix-list <prefix_list_name>: Displays the configuration of a prefix list.
- ping <neighbor_IP_address>: Verify basic IP connectivity.
7. Example Configuration (Basic eBGP)
This example shows a basic eBGP configuration between two Nexus switches:
Nexus Switch 1 (AS 65001):
configure terminal
router bgp 65001
router-id 192.168.1.1
neighbor 10.1.1.2 remote-as 65002
neighbor 10.1.1.2 update-source Loopback0
neighbor 10.1.1.2 address-family ipv4 unicast
activate
network 192.168.10.0/24
exit
end
Nexus Switch 2 (AS 65002):
configure terminal
router bgp 65002
router-id 192.168.1.2
neighbor 10.1.1.1 remote-as 65001
neighbor 10.1.1.1 update-source Loopback0
neighbor 10.1.1.1 address-family ipv4 unicast
activate
network 192.168.20.0/24
exit
end
Important Considerations:
- Loopback Interfaces: Using loopback interfaces as the update source is highly recommended for stability. If a physical interface goes down, the BGP session will remain up as long as the loopback interface is reachable.
- Timers: BGP uses timers for keepalives and hold times. Adjust these timers carefully, especially in unstable networks.
- Route Reflectors: In larger networks, route reflectors can help reduce the number of full mesh BGP sessions.
- BGP Communities: Use BGP communities to tag routes and apply policies.
- Security: Implement appropriate security measures, such as authentication and filtering, to protect your BGP network.
- Monitoring: Continuously monitor your BGP network for issues and performance problems.
This guide provides a solid foundation for configuring BGP on a Cisco Nexus 3548 switch. Remember to adapt the configuration to your specific network requirements and test thoroughly before deploying it in a production environment. Refer to the official Cisco documentation for the most up-to-date information and advanced features.