peer connect-interface

Use peer connect-interface to specify a source interface (IPv4 address/IPv6 address) for establishing TCP connections to a peer or peer group.

Use undo peer connect-interface to remove the configuration.

Syntax

peer { group-name | ipv6-address [ prefix-length ] } connect-interface interface-type interface-number

undo peer { group-name | ipv6-address [ prefix-length ] } connect-interface

Default

BGP uses the primary IPv4 or IPv6 address of the output interface in the optimal route destined for the BGP peer or peer group as the source address.

Views

BGP instance view

BGP-VPN instance view

Predefined user roles

network-admin

Parameters

group-name: Specifies a peer group by its name, a case-sensitive string of 1 to 47 characters. The peer group must have been created.

ipv4-address: Specifies a peer by its IPv4 address. The peer must have been created.

mask-length: Specifies a mask length in the range of 0 to 32. You can use the ipv4-address and mask-length arguments together to specify a subnet. If you specify a subnet, this command specifies a source interface for establishing TCP connections to all dynamic peers in the network.

ipv6-address: Specifies a peer by its IPv6 address. The peer must have been created.

prefix-length: Specifies a prefix length in the range of 0 to 128. You can use the ipv6-address and prefix-length arguments together to specify a subnet. If you specify a subnet, this command specifies a source interface for establishing TCP connections to all dynamic peers in the subnet.

interface-type interface-number: Specifies an interface by its type and number.

Usage guidelines

The peer connect-interface command and the peer source-address command can both change the source address for establishing TCP connections. If you execute both commands, the most recent configuration takes effect.

The peer source-address and peer connect-interface commands are applicable to the following scenarios:

The source interfaces on the local router and the peer must be reachable to each other.

After you configure this command, BGP immediately tears down the session to a directly connected IBGP peer when the source interface (non-loopback interface) fails and the link state goes down.

To specify an indirectly connected interface on an EBGP peer as the source interface, use the peer ebgp-max-hop command. The command allows the establishment of an EBGP session to the indirectly connected peer.

If an interface has multiple IPv4 addresses, BGP uses the primary IPv4 address to establish TCP connections. If an interface has multiple IPv6 addresses, BGP selects a source IPv6 address. To use an IPv6 address as the source address, specify that IPv6 address by using the peer source-address command.

You cannot specify a virtual template (VT) interface as the source interface for establishing TCP connections because a VT interface cannot process services.

Examples

# In BGP instance view, specify loopback 0 as the source interface for TCP connections to peer group test.

<Sysname> system-view
[Sysname] bgp 100
[Sysname-bgp-default] peer test connect-interface loopback 0

Related commands

peer ebgp-max-hop

peer source-address