< Home

network (BGP)

Function

The network command configures BGP to statically add routes in the IP routing table to the BGP routing table and advertise these routes to peers.

The undo network command deletes the routes statically added to the BGP routing table.

By default, BGP does not statically add routes in the IP routing table to the BGP routing table.

Format

network { ipv4-address [ mask | mask-length ] | ipv6-address prefix-length } [ route-policy route-policy-name ]

undo network { ipv4-address [ mask | mask-length ] | ipv6-address prefix-length }

Parameters

Parameter Description Value
ipv4-address Specifies the IPv4 address of the route to be imported by BGP. It is in dotted decimal notation.
mask Specifies the IP address mask. If no mask is specified, the IP address is considered as a classful address. It is in dotted decimal notation.
mask-length Specifies the mask length of the IP address. If no mask length is specified, the IP address is considered as a classful address. The value is an integer that ranges from 0 to 32.
ipv6-address Specifies the IPv6 address of the route to be imported by BGP. The value is a 32-digit hexadecimal number, in the format of X:X:X:X:X:X:X:X.
prefix-length Specifies the prefix length of the IPv6 network address advertised by BGP. The value is an integer that ranges from 0 to 128.
route-policy route-policy-name Specifies the name of the route-policy that is used for route import. The name is a string of 1 to 40 case-sensitive characters, with spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string.
  • ipv4-address is valid only in the BGP view, BGP-IPv4 unicast address family view, BGP-IPv4 multicast address family view, and BGP-VPN instance IPv4 address family view.

  • ipv6-address is valid only in the BGP-IPv6 unicast address family view and BGP-VPN instance IPv6 address family view.

Views

BGP view, BGP-IPv4 unicast address family view, BGP-IPv4 multicast address family view, BGP-VPN instance IPv4 address family view, BGP-IPv6 unicast address family view, BGP-VPN instance IPv6 address family view

Default Level

2: Configuration level

Usage Guidelines

Usage Scenario

BGP itself cannot discover routes. Instead, it imports routes discovered by other protocols such as IGP or static routes into the BGP routing table. These imported routes then are transmitted within an AS or between ASs. Before adding routes to the BGP routing table, BGP filters these routes by the routing protocol. If routes in the local IP routing table need to be statically added to the BGP routing table and then advertised, you can use the network command.

The Origin attribute of the routes imported into the BGP routing table by using the network command is IGP.

If a route with a specific prefix or mask is added to the BGP routing table by using the network command, this route is the optimal route selected from all types of protocol routes. Unlike the network command, the import-route (BGP) command is used to add all routes of a particular protocol such as RIP, OSPF, IS-IS, static route, or direct route to the BGP routing table.

Precautions

The network command is used to import exactly-matching routes. This means that only the routes in the local IP routing table that exactly match the specified destination address and prefix length can be added to the BGP routing table. If mask is not specified, routes are exactly matched against the natural network mask.

When using the undo network command to delete the existing configuration, specify a correct mask.

Creating a route-policy before it is referenced is recommended. By default, nonexistent route-policies cannot be referenced using the command. If the route-policy nonexistent-config-check disable command is run in the system view and a nonexistent route-policy is referenced using the current command, routes in the local routing table are added to the BGP routing table.

Example

# Configure BGP to import the local route 10.0.0.0/16.

<HUAWEI> system-view
[HUAWEI] bgp 100
[HUAWEI-bgp] ipv4-family unicast
[HUAWEI-bgp-af-ipv4] network 10.0.0.0 255.255.0.0
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >