H3C S3100-52P Command Manual-Release 1602(V1.01)

HomeSupportSwitchesH3C S3100 Switch SeriesReference GuidesCommand ReferencesH3C S3100-52P Command Manual-Release 1602(V1.01)
15-Static Route Command
Title Size Download
15-Static Route Command 88.31 KB

Chapter 1  IP Routing Table Commands

 

&  Note:

The term router in this chapter refers to a router in a generic sense or an Ethernet switch running a routing protocol.

 

1.1  IP Routing Table Commands

1.1.1  display ip routing-table

Syntax

display ip routing-table [ | { begin | exclude | include } regular-expression ]

View

Any view

Parameters

regular-expression: Regular expression, a string of 1 to 256 case-sensitive characters used for specifying routing entries.

|: Uses the regular expression to match the output routing information.

begin: Displays the routing information from the route entry containing the specified character string.

include: Displays all routing information containing the specified character string.

exclude: Displays all routing information without the specified character string.

 

&  Note:

For details about regular expressions, refer to Configuration File Management Operation of this manual.

 

Description

Use the display ip routing-table command to display the routing table summary.

This command displays the summary of the routing table. Each line represents one route, containing destination address/mask length, protocol, preference, cost, next hop, and output interface.

This command displays only the currently used routes, that is, the optimal routes.

Examples

# Display the summary of the current routing table.

<Sysname> display ip routing-table

Routing Table: public net

Destination/Mask   Protocol   Pre Cost  Nexthop     Interface

1.1.1.0/24         DIRECT        0   0       1.1.1.1     Vlan-interface1

1.1.1.1/32         DIRECT        0   0       127.0.0.1   InLoopBack0

2.2.2.0/24         DIRECT        0   0       2.2.2.1     Vlan-interface2

2.2.2.1/32         DIRECT        0   0       127.0.0.1   InLoopBack0

3.3.3.0/24         DIRECT        0   0       3.3.3.1     Vlan-interface3

3.3.3.1/32         DIRECT        0   0       127.0.0.1   InLoopBack0

4.4.4.0/24         DIRECT        0   0       4.4.4.1     Vlan-interface4

4.4.4.1/32         DIRECT        0   0       127.0.0.1   InLoopBack0

127.0.0.0/8        DIRECT        0   0       127.0.0.1   InLoopBack0

127.0.0.1/32       DIRECT       0   0       127.0.0.1   InLoopBack0

# Display the routing information from the entry containing the character string interface4 in the current routing table.

<Sysname> display ip routing-table | begin interface4

Routing Table: public net

4.4.4.0/24         DIRECT        0   0       4.4.4.1     Vlan-interface4

4.4.4.1/32         DIRECT        0   0       127.0.0.1   InLoopBack0

127.0.0.0/8        DIRECT        0   0       127.0.0.1   InLoopBack0

127.0.0.1/32       DIRECT        0   0       127.0.0.1   InLoopBack0

# Display the routing information containing the character string interface4 in the current routing table.

<Sysname> display ip routing-table | include interface4

Routing Table: public net

Destination/Mask   Protocol   Pre Cost  Nexthop     Interface

4.4.4.0/24         DIRECT        0   0       4.4.4.1     Vlan-interface4

# Display the routing information without the character string interface4 in the current routing table.

<Sysname> display ip routing-table | exclude interface4

Routing Table: public net

Destination/Mask   Protocol   Pre Cost  Nexthop     Interface

1.1.1.0/24         DIRECT        0   0       1.1.1.1     Vlan-interface1

1.1.1.1/32         DIRECT        0   0       127.0.0.1   InLoopBack0

2.2.2.0/24         DIRECT        0   0       2.2.2.1     Vlan-interface2

2.2.2.1/32         DIRECT        0   0       127.0.0.1   InLoopBack0

3.3.3.0/24         DIRECT        0   0       3.3.3.1     Vlan-interface3

3.3.3.1/32         DIRECT        0   0       127.0.0.1   InLoopBack0

4.4.4.1/32         DIRECT        0   0       127.0.0.1   InLoopBack0

127.0.0.0/8        DIRECT        0   0       127.0.0.1   InLoopBack0

127.0.0.1/32       DIRECT        0   0       127.0.0.1   InLoopBack0

Table 1-1 Description on the fields of the display ip routing-table command

Field

Description

Destination/Mask

Destination address/mask length

Protocol

Routing protocol

Pre

Route preference

Cost

Route cost

Nexthop

Next hop address

Interface

Output interface, through which the data packets destined for the destination network segment are sent

 

1.1.2  display ip routing-table acl

Syntax

display ip routing-table acl acl-number [ verbose ]

View

Any view

Parameters

acl-number: Basic access control list number, in the range of 2000 to 2999.

verbose: With this keyword specified, detailed information of routes in the active or inactive state that match the ACL is displayed. With this keyword not specified, brief information of only the routes in the active state that match the ACL is displayed.

Description

Use the display ip routing-table acl command to display the information of routes that match the specified ACL.

Examples

# Display the summary information about the active routes that match ACL 2000.

<Sysname> system-view

System View: return to User View with Ctrl+Z.

[Sysname] acl number 2000

[Sysname-acl-basic-2000] rule permit source 10.1.1.1 0.0.0.255

[Sysname-acl-basic-2000] rule deny source any

[Sysname-acl-basic-2000] display ip routing-table acl 2000

Routes matched by access-list 2000:

  Summary count: 2

Destination/Mask   Protocol Pre     Cost    Nexthop         Interface

10.1.1.0/24      DIRECT      0       0       10.1.1.2        Vlan-interface1

10.1.1.2/32      DIRECT      0       0       127.0.0.1    InLoopBack0

Refer to Table 1-1 or the description on the output fields.

# Display the detailed information about the active and inactive routes that match ACL 2000.

<Sysname> display ip routing-table acl 2000 verbose

Routes matched by access-list 2000:

  + = Active Route, - = Last Active, # = Both   * = Next hop in use

  Destinations: 2        Routes: 2

  Holddown: 0    Delete: 0       Hidden: 0

 

**Destination: 10.1.1.0         Mask: 255.255.255.0

        Protocol: #DIRECT       Preference: 0

        *NextHop: 10.1.1.2         Interface: 10.1.1.2(Vlan-interface1)

        State: <Int ActiveU Retain Unicast>

        Age: 35:37:03       Cost: 0/0     

**Destination: 10.1.1.2         Mask: 255.255.255.255

        Protocol: #DIRECT       Preference: 0

        *NextHop: 127.0.0.1        Interface: 127.0.0.1(InLoopBack0)

        State: <NoAdvise Int ActiveU Retain Gateway Unicast>

        Age: 35:37:03       Cost: 0/0      

Table 1-2 Description on the fields of the display ip routing-table command

Field

Description

Destination

Destination address

Mask

Subnet mask

Protocol

Protocol that discovers the route

Preference

Route preference

Nexthop

Next hop to the destination

Interface

Outbound interface through which data packets are forwarded to the destination network segment.

State

Description of route state:

ActiveU

An active unicast route, where “U” represents unicast.

Blackhole

A blackhole route is similar to a reject route, but no ICMP unreachable message is sent to the source.

Delete

A route is to be deleted.

Gateway

An indirect route.

Hidden

An existing route that is temporarily unavailable for some reason (for example, suppressed by a routing policy or down interface). However, deletion is not expected. It is therefore hidden so that it can recover later.

Holddown

Number of routes that are held down. Holddown is a route advertisement policy that some D-V based routing protocols (for example, RIP) use to avoid the spread of wrong routes but speed up the correct spread of ICMP unreachable messages. A certain route is advertised at intervals, no matter whether the currently discovered route to the same destination changes. For details, refer to the specific routing protocols.

Int

A route discovered by IGP.

NoAdvise

A routing protocol does not advertise any NoAdvise route when advertising routes in accordance with a routing policy.

NotInstall

A NotInstall route cannot be added to the core routing table, but may be advertised. A route with the highest priority is generally selected from the routing table, added to the core routing table, and then advertised.

Reject

The routes marked with reject do not guide the router to forward packets as a normal route does. The router discards the packets matching reject routes and sends an ICMP unreachable message to the source.

Reject routes are usually used for network tests.

Retain

The routes marked with retain will not be deleted when you delete routes in the core routing table. You can mark static routes with retain to make them stay in the core routing table.

Static

The routes marked with static will not be deleted from the routing table after you perform a save operation and restart the router. The routes manually configured on a router are marked with static.

Unicast

A unicast route.

Age

Lifetime of a route in the routing table, in the format of HH:MM:SS.

Cost

Cost of a route.

 

1.1.3  display ip routing-table ip-address

Syntax

display ip routing-table ip-address [ mask | mask-length ] [ longer-match ] [ verbose ]

View

Any view

Parameters

ip-address: Destination IP address, in dotted decimal notation.

mask: Subnet mask, in dotted decimal notation.

mask-length: Length of a subnet mask, in the range of 0 to 32.

longer-match: Specifies all the routes that lead to the destination address and match the specified mask. If you do not specify the mask argument, those that match the natural mask are specified.

verbose: Displays the detailed information of routes.

Description

Use the display ip routing-table ip-address command to display the routing information of the specified destination address.

With different arguments provided, the command output is different. The following is the command output with different arguments provided:

l           display ip routing-table ip-address

If the destination address ip-address corresponds to a route in the natural mask range, this command displays the route that is the longest match of the destination address ip-address and is active.

l           display ip routing-table ip-address mask

This command only displays the routes exactly matching the specified destination address and mask.

l           display ip routing-table ip-address longer-match

This command displays all destination address routes matching the specified destination address in the natural mask range.

l           display ip routing-table ip-address mask longer-match

This command displays all destination address routes matching the specified destination address in the specified mask range.

Examples

# Display the brief information of routes with a natural mask.

<Sysname> display ip routing-table 169.0.0.0

Destination/Mask     Protocol    Pre Cost    Nexthop     Interface

169.0.0.0/16         Static  60  0       2.1.1.1     LoopBack1

For descriptions of the above fields, see Table 1-1.

# Display the detailed information of routes with a natural mask.

<Sysname> display ip routing-table 169.0.0.0 verbose

Routing tables:

  + = Active Route, - = Last Active, # = Both    * = Next hop in use

  Summary count: 1

**Destination: 169.0.0.0         Mask: 255.255.255.0

         Protocol: #STATIC       Preference: 60

         *NextHop: 2.1.1.1          Interface: 2.1.1.1(LoopBack1)

         State: <Int ActiveU Gateway Static Unicast>

         Age: 4:49              Cost: 0/0

For descriptions of the above fields, see Table 1-2.

1.1.4  display ip routing-table ip-address1 ip-address2

Syntax

display ip routing-table ip-address1 { mask1 | mask-length1 } ip-address2 { mask2 | mask-length2 } [ verbose ]

View

Any view

Parameters

ip-address1, ip-address2: Destination IP address in dotted decimal notation. ip-address1 {mask1 | mask-length1} and ip-address2 {mask2 | mask-length2} determine one address range together. ip-address1 ANDed with {mask1 | mask-length1} specifies the start of the range, while ip-address2 ANDed with {mask2 | mask-length2} specifies the end. This command displays the route in this address range.

mask1, mask2: Subnet mask, in dotted decimal notation.

mask-length1, mask-length2: Mask length, in the ranges of 0 to 32.

verbose: With the verbose argument provided, this command displays the verbose information of both active and inactive routes. Without this argument provided, this command displays the summary of active routes only.

Description

Use the display ip routing-table ip-address1 ip-address2 command to display the route information in the specified destination address range.

Examples

# Display the routing information of destination addresses ranging from 1.1.1.0 to 2.2.2.0.

<Sysname>display ip routing-table 1.1.1.0 24 2.2.2.0 24

Routing tables:

  Summary count: 3

Destination/Mask   Protocol   Pre Cost        Nexthop     Interface

1.1.1.0/24         DIRECT    0  0                  1.1.1.1         Vlan-interface1

1.1.1.1/32         DIRECT    0  0          127.0.0.1     InLoopBack0

2.2.2.0/24         DIRECT    0  0                    2.2.2.1          Vlan-interface2

For descriptions of the above fields, see Table 1-1.

1.1.5  display ip routing-table protocol

Syntax

display ip routing-table protocol protocol [ inactive | verbose ]

View

Any view

Parameters

protocol: You can provide one of the following values for this argument.

l           direct: Displays direct-connect route information

l           static: Displays static route information.

inactive: With this argument provided, this command displays the inactive route information. Without this argument provided, this command displays both active and inactive route information.

verbose: With this keyword specified, detailed information of routes in the active or inactive state is displayed. With this keyword not specified, brief information of only the routes in the active state is displayed.

Description

Use the display ip routing-table protocol command to display the route information of a specific protocol.

Examples

# Display the summary of all direct-connect routes.

<Sysname> display ip routing-table protocol direct

DIRECT Routing tables:

Summary count: 4

DIRECT Routing tables status:<active>:

Summary count: 3

Destination/Mask     Protocol    Pre Cost    Nexthop     Interface

20.1.1.1/32          DIRECT          0   0       127.0.0.1   InLoopBack0

127.0.0.0/8          DIRECT          0   0       127.0.0.1   InLoopBack0

127.0.0.1/32         DIRECT          0   0       127.0.0.1   InLoopBack0

DIRECT Routing tables status:<inactive>:

Summary count: 1

Destination/Mask     Protocol   Pre  Cost    Nexthop     Interface

210.0.0.1/32         DIRECT      0       0       127.0.0.1   InLoopBack0

For detailed description of the output information, see Table 1-1.

1.1.6  display ip routing-table radix

Syntax

display ip routing-table radix

View

Any view

Parameters

None

Description

Use the display ip routing-table radix command to display the route information in a tree structure.

Examples

<Sysname> display ip routing-table radix

Radix tree for INET (2) inodes 7 routes 5:

             +-32+--{210.0.0.1

         +--0+

          | | +--8+--{127.0.0.0

          | | | +-32+--{127.0.0.1

          | +--1+

          | +--8+--{20.0.0.0

          | +-32+--{20.1.1.1

Table 1-3 Description on the fields of the display ip routing-table radix command

Field

Description

INET

Address suite

Inodes

Number of nodes

Routes

Number of routes

 

1.1.7  display ip routing-table statistics

Syntax

display ip routing-table statistics

View

Any view

Parameters

None

Description

Use the display ip routing-table statistics command to display the integrated routing information.

The integrated routing information includes the total number of routes, the number of active routes, the number of routes added by protocols, and the number of routes deleted.

Examples

# Display the integrated route information.

<Sysname> display ip routing-table statistics

Routing tables:

Proto      route       active      added       deleted

DIRECT     24          4           25          1

STATIC     4           1           4           0

Total      28          5           29          1

Table 1-4 Description on the fields of the display ip routing-table statistics command

Field

Description

Proto

Routing protocol type

Route

Total number of routes

active

Number of active routes

added

Number of routes added after the router is rebooted or the routing table is cleared last time.

deleted

Number of routes deleted (Such routes will be freed in a period of time)

Total

Total number of the different kinds of routes

 

1.1.8  display ip routing-table verbose

Syntax

display ip routing-table verbose

View

Any view

Parameters

None

Description

Use the display ip routing-table verbose command to display the detailed information of a routing table, including inactive routes and null routes. The information displayed includes route state descriptor, statistics of the routing table, and detailed information of each route.

Examples

# Display the verbose routing table information.

<Sysname> display ip routing-table verbose

Routing Tables:

  + = Active Route, - = Last Active, # = Both    * = Next hop in use

  Destinations: 3       Routes: 3

  Holddown: 0    Delete: 62      Hidden: 0

**Destination: 1.1.1.0           Mask: 255.255.255.0

         Protocol: #DIRECT       Preference: 0

         *NextHop: 1.1.1.1        Interface: 1.1.1.1(Vlan-interface1)

         State: <Int ActiveU Retain Unicast>

         Age: 20:17:41          Cost: 0/0

**Destination: 1.1.1.1           Mask: 255.255.255.255

         Protocol: #DIRECT       Preference: 0

         *NextHop: 127.0.0.1        Interface: 127.0.0.1(InLoopBack0)

         State: <NoAdvise Int ActiveU Retain Gateway Unicast>

         Age: 20:17:42          Cost: 0/0

**Destination: 2.2.2.0           Mask: 255.255.255.0

         Protocol: #DIRECT       Preference: 0

         *NextHop: 2.2.2.1          Interface: 2.2.2.1(Vlan-interface2)

         State: <Int ActiveU Retain Unicast>

         Age: 20:08:05              Cost: 0/0

For descriptions of route states, see Table 1-2.

Table 1-5 lists the statistics of the routing table.

Table 1-5 Description on the fields of the display ip routing-table verbose command

Field

Description

Holddown

Number of suppressed routes

Delete

Number of deleted routes

Hidden

Number of hidden routes

 

1.1.9  reset ip routing-table statistics protocol

Syntax

reset ip routing-table statistics protocol { all | protocol }

View

User view

Parameters

all: Specifies all protocols.

protocol: Specifies a protocol, which can be direct, or static.

Description

Use the reset ip routing-table statistics protocol command to clear the statistics of routes in a routing table.

Examples

# Before executing the reset ip routing-table statistics protocol command, use the display ip routing-table statistics command to display the routing statistics:

<Sysname> display ip routing-table statistics

Routing tables:

Proto      route       active      added       deleted

DIRECT     4           4           12          8

STATIC     0           0           0           0

Total      4           4           12          8

# Clear the routing statistics of all protocols from the IP routing table.

<Sysname> reset ip routing-table statistics protocol all

# Display the routing statistics in the IP routing table.

<Sysname> display ip routing-table statistics

Routing tables:

Proto      route       active      added       deleted

DIRECT     4           4           0           0

STATIC     0           0           0           0

Total      4           4           0           0

The above information shows that the routing statistics in the IP routing table is cleared.

 


Chapter 2  Static Route Configuration Commands

 

&  Note:

The term router in this chapter refers to a router in a generic sense or an Ethernet switch running a routing protocol.

 

2.1  Static Route Configuration Commands

2.1.1  delete static-routes all

Syntax

delete static-routes all

View

System view

Parameters

None

Description

Use the delete static-routes all command to delete all static routes.

The system will request your confirmation before it deletes all the configured static routes.

Related commands: ip route-static, display ip routing-table.

Examples

# Delete all the static routes in the router.

<Sysname> system-view

System View: return to User View with Ctrl+Z. 

[Sysname] delete static-routes all

Are you sure to delete all the unicast static routes?[Y/N]y       

2.1.2  ip route-static

Syntax

ip route-static ip-address { mask | mask-length } { interface-type interface-number | next-hop } [ preference preference-value ] [ reject | blackhole ] [ description text ]

undo ip route-static ip-address { mask | mask-length } [ interface-type interface-number | next-hop ] [ preference preference-value ]

View

System view

Parameters

ip-address: Destination IP address, in dotted decimal notation.

mask: Subnet mask, in dotted decimal notation.

mask-length: Mask length, in the range of 0 to 32.

interface-type interface-number: Next-hop outbound interface.

next-hop: Next hop IP address of the route, in dotted decimal notation.

preference preference-value: Preference level of a static route, in the range of 1 to 255. The default preference is 60.

reject: Indicates the destination is unreachable. If a static route to a destination is marked with reject, all IP packets destined for this destination will be discarded, and the source host will be informed that the destination is unreachable.

blackhole: Indicates a blackhole route. If a static route to a destination is marked with blackhole, the outbound interface of this route is the Null 0 interface regardless of the next hop address, and all the IP packet addresses destined for this destination are dropped without the source host being notified.

description text: Provides a description for the current route, which is a string of 1 to 60 characters.

 

&  Note:

l      If you specify the next-hop outgoing interface when configuring a static route, the type of outgoing interface can be Null only.

l      The packets sent to a Null interface, which is a virtual interface, will be discarded immediately. This can decrease the system load.

 

Description

Use the ip route-static command to configure a static route.

Use the undo ip route-static command to delete a static route.

By default, the system can obtain the subnet route directly connected to the router. When you configure a static route, if no preference is specified for the route, the preference defaults to 60, and if the route is not specified as reject or blackhole, the route will be reachable by default.

When configuring a static route, note the following points:

l           If the destination IP address and the mask are both 0.0.0.0, what you are configuring is a default route. All the packets that fail to find a routing entry will be forwarded through this default route.

l           You cannot configure an interface address of the local switch as the next hop address of a static route.

l           You can configure a different preference to implement flexible route management policy.

Related commands: display ip routing-table.

Examples

# Configure the next hop of the default route as 129.102.0.2.

<Sysname> system-view

System View: return to User View with Ctrl+Z.

[Sysname] ip route-static 0.0.0.0 0.0.0.0 129.102.0.2

 

  • Cloud & AI
  • InterConnect
  • Intelligent Computing
  • Security
  • SMB Products
  • Intelligent Terminal Products
  • Product Support Services
  • Technical Service Solutions
All Services
  • Resource Center
  • Policy
  • Online Help
All Support
  • Become a Partner
  • Partner Resources
  • Partner Business Management
All Partners
  • Profile
  • News & Events
  • Online Exhibition Center
  • Contact Us
All About Us
新华三官网