# Static Routing

### 1. Function Overview

In this product, static routing (static route information) can be used for route control in IP networks.
An administrator can explicitly register route information by entering a command.
You can set both static routes for IPv4 networks and static routes for IPv6 networks.

There are the following two types of static route information.

Type | Description
--- | ---
VLAN interface route information | Route information automatically registered by setting the IP address using the ip/ipv6 address command
Static route information | Route information registered by route setting by ip/ipv6 route command

Use the show ip/ipv6 route command to display the routing table.

### 2. Definition of Terms Used

None

### 3. Function Details

#### 3.1. VLAN interface route information

Route information that is automatically registered by setting the IP address using the ip/ipv6 address command.
It is the route information of the network directly connected to this product and is associated with the interface.

Set 192.168.100.1/24 as the IP address for the VLAN1 interface and display the routing table.

    Yamaha(config)# interface vlan1
    Yamaha(config-if)# ip address 192.168.100.1/24
    Yamaha(config-if)# exit
    Yamaha(config)# exit
    Yamaha#show ip route
    Codes: C - connected, S - static
           * - candidate default

    C       192.168.100.0/24 is directly connected, vlan1

    Gateway of last resort is not set

#### 3.2. Static route information

Route information registered by route setting by ip/ipv6 route command.
You can statically set a route to a specific network or set a default gateway.
When setting the default gateway, specify 0.0.0.0/0 as the destination network.
Up to 128 IPv4 static routes with the ip route command can be set.
Up to 32 IPv6 static routes with the ipv6 route command can be set.

Set the gateway for the route addressed to 172.16.0.0/16 to 192.168.100.254 and display the routing table.

    Yamaha(config)# ip route 172.16.0.0/24 192.168.100.254
    Yamaha(config)# exit
    Yamaha# show ip route
    Codes: C - connected, S - static
           * - candidate default

    S       172.16.0.0/24 [1/0] via 192.168.100.254, vlan1
    C       192.168.100.0/24 is directly connected, vlan1

    Gateway of last resort is not set

Set 192.168.100.200 as the default gateway and display the routing table.

    Yamaha(config)# ip route 0.0.0.0/0 192.168.100.200
    Yamaha(config)# exit
    Yamaha# show ip route
    Codes: C - connected, S - static
           * - candidate default

    Gateway of last resort is 192.168.100.200 to network 0.0.0.0

    S*      0.0.0.0/0 [1/0] via 192.168.100.200, vlan1
    S       172.16.0.0/24 [1/0] via 192.168.100.254, vlan1
    C       192.168.100.0/24 is directly connected, vlan1

#### 3.3. Display of routing table

There are two routing tables: an IP forwarding table (FIB) in which only route information actually used for packet forwarding is registered, and an IP routing table (RIB) in which all route information is registered.
All VLAN interface route information and static route information are registered in the IP routing table. Within this, only the route information that is actually used in the packet forwarding process is registered in the IP forwarding table.

Use the show ip/ipv6 route command to display the IP forwarding table and the IP routing table.
In the routing table, VLAN interface route information and static route information are displayed as follows.

Type | Display
--- | ---
VLAN interface route information | C - connected
Static route information | S - static

If no option is specified for show ip/ipv6 route, the IP forwarding table is displayed.
You can display the IP routing table by specifying the database option with show ip/ipv6 route.
You can also display summary information and specific route information only by specifying other options.

Option | Description
--- | ---
IP address | Display route information used when forwarding packets to the specified IP address.
IP address and prefix | Display route information that matches the specified information.
database | Display all configured route information (IP routing table).
summary | Display IP routing table summary information

For details on how to use the show ip route command, refer to the command reference.

#### 3.4. Route information priority (management distance)

Route information has a priority commonly called Administrative Distance.
This is used to determine which is prioritized when route information to the same destination is registered with VLAN interface route information and static route information.
The priority of route information can be applied not only to static routing but also to dynamic routing.
The priority of static routing route information can be specified in the range of 1 to 255 using the option at the end of the ip route command.
The smaller the value, the higher the priority. In the initial state, the priority is as follows.

Type | Initial priority | How to change priority
--- | --- | ---
VLAN interface route information | None (overrides any other route information) | Settings cannot be changed.
Static route information | 1 | It can be specified in the range of 1 to 255 by the option at the end of the ip/ipv6 route command.

#### 3.5. Enabling the routing function

Use the ip/ipv6 forwarding command to enable/disable the routing function.
In the initial state, the routing function is enabled for both IPv4 and IPv6.

### 4. Related Commands

Related commands are indicated below.
For details on the commands, refer to the Command Reference.

- List of related commands

Function types | Operations | Operating commands
--- | --- | ---
Route information settings | Set static route information | ip route / ipv6 route
Show static route information | show ip route / show ipv6 route
Show route information | show ip route / show ipv6 route
Routing function settings | Routing function settings | ip forwarding / ipv6 forwarding
Routing function status display | show ip forwarding / show ipv6 forwarding

### 5. Points of Caution

None

### 6. Related Documentation

None

Search result
No more search results.
There are no topics that match your search query.