The network command imports routes to the BGP routing table and advertises them to peers.
The undo network command cancels the configuration.
By default, BGP does not import routes.
network { ipv4-address [ mask | mask-length ] } route-filter route-filter-name
network { ipv4-address [ mask | mask-length ] } route-filter route-filter-name label-index label-index-value
network { ipv4-address [ mask | mask-length ] } [ route-policy route-policy-name ] [ non-relay-tunnel ] label-index label-index-value
network { ipv4-address [ mask | mask-length ] } [ route-policy route-policy-name ] [ non-relay-tunnel ]
undo network { ipv4-address [ mask | mask-length ] }
undo network { ipv4-address [ mask | mask-length ] } [ route-policy route-policy-name ] [ non-relay-tunnel ] label-index label-index-value
undo network { ipv4-address [ mask | mask-length ] } route-filter route-filter-name label-index label-index-value
Parameter | Description | Value |
---|---|---|
ipv4-address |
Specifies the IPv4 address of a route to be imported by BGP. |
The value is in dotted decimal notation. |
mask |
Specifies an IP address mask. If no mask is specified, the IP address is considered as a classful address. |
The value is in dotted decimal notation. |
mask-length |
Specifies the mask length of an 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. |
route-filter route-filter-name |
Specifies the name of a routing filter that is used for route import. |
The value is a string of 1 to 200 case-sensitive characters, spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string. If the referenced route-filter contains parameters, you need to assign values to the parameters following the route-filter name in the format of (var1,var2, ...).,Var8). The length of each value ranges from 1 to 200. |
label-index label-index-value |
The imported BGP routes carry the label-index value. |
The value is an integer that ranges from 0 to 4294967294. |
route-policy route-policy-name |
Specifies the name of a route-policy that is used for route import. |
The value is a string of 1 to 200 case-sensitive characters, spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string. |
non-relay-tunnel |
Prevents the routes imported by BGP from recursing to tunnels. |
- |
Usage Scenario
BGP itself cannot discover routes. Instead, it imports routes discovered by other protocols (such as an IGP or static routes) to 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 can filter them based on the routing protocol. Alternatively, if routes in the local routing table need to be manually added to the BGP routing table and then advertised, you can use the network command.
The Origin attribute of the routes imported to the BGP routing table using the network command is IGP. If a route with a specific prefix or mask is added to the BGP routing table using the network command, this route is the optimal route selected from all types of protocol routes. Unlike the network command, the import-route command is used to add all routes of a specified protocol, such as RIP, OSPF, IS-IS, static routes, or direct routes to the BGP routing table. In most cases, the routes imported by BGP can recurse to tunnels. However, in some other cases, if the routes imported by BGP recurse to tunnels, a problem will occur. For example, in a seamless MPLS scenario, if the egress protection function is configured on egress MASGs between which a tunnel exists and a route imported by BGP on one of the MASGs recurses to the tunnel, this MASG then recurses the route to another tunnel of a different type. In this case, traffic is directed to the other MASG, which slows down traffic switchover. As a result, the egress protection function does not take effect. To address this problem, specify non-relay-tunnel to prevent the routes imported by BGP from recursing to tunnels.Precautions
The network command imports the routes in the local routing table that exactly match the specified destination address and prefix length to the BGP routing table. If mask is not specified, routes are matched against the natural network mask.
When using the undo network command to delete the existing configuration, specify a correct mask. The network route-policy route-policy-name command is mutually exclusive with the network route-filter route-filter-name command.<HUAWEI> system-view [~HUAWEI] bgp 100 [*HUAWEI-bgp] ipv4-family unicast [*HUAWEI-bgp-af-ipv4] network 192.168.1.1 255.255.0.0 non-relay-tunnel
<HUAWEI> system-view [~HUAWEI] bgp 100 [*HUAWEI-bgp] ipv4-family unicast [*HUAWEI-bgp-af-ipv4] network 192.168.1.1 255.255.0.0