Configuring Routing

CHAPTERS

1. Overview

2. IPv4 Static Routing Configuration

3. IPv6 Static Routing Configuration

4. Viewing Routing Table

5. Example for Static Routing

This guide applies to:

T1600G-18TS v2 or above, T1600G-28TS v3 or above, T1600G-28PS v3 or above, T1600G-52TS v3 or above, T1600G-52PS v3 or above, T1700X-16TS v3 or above, T1700G-28TQ v3 or above, T2600G-18TS v2 or above, T2600G-28TS v3 or above, T2600G-28MPS v3 or above, T2600G-28SQ v1 or above, T2600G-52TS v3 or above.

1Overview

Routing table is used for a Layer 3 device (in this configuration guide, it means the switch) to forward packets to the correct destination. When the switch receives packets of which the source IP address and destination IP address are in different subnets, it will check the routing table, find the correct outgoing interface then forward the packets.

The routing table mainly contains two types of routing entries: dynamic routing entries and static routing entries.

Dynamic routing entries are automatically generated by the switch. The switch use dynamic routing protocols to automatically calculate the best route to forward packets.

Static routing entries are manually added none-aging routing entries. In a simple network with a small number of devices, you only need to configure static routes to ensure that the devices from different subnets can communicate with each other. On a complex large-scale network, static routes ensure stable connectivity for important applications because the static routes remain unchanged even when the topology changes.

The switch supports IPv4 static routing and IPv6 static routing configuration.

2IPv4 Static Routing Configuration

2.1Using the GUI

Choose the menu L3 FEATURES > Static Routing > IPv4 Static Routing and click to load the following page.

Figure 2-1 Configuring the IPv4 Static Routing

Configure the corresponding parameters to add an IPv4 static routing entry. Then click Create.

Destination

Specify the destination IPv4 address of the packets.

Subnet Mask

Specify the subnet mask of the destination IPv4 address.

Next Hop

Specify the IPv4 gateway address to which the packet should be sent next.

Distance

Specify the administrative distance, which is the trust rating of a routing entry. A higher value means a lower trust rating. Among the routes to the same destination, the route with the lowest distance value will be recorded in the IPv4 routing table.

The valid value ranges from 1 to 255 and the default value is 1.

2.2Using the CLI

Follow these steps to create an IPv4 static route.

Step 1

configure

Enter global configuration mode.

Step 2

ip route { dest-address } { mask } { next-hop-address } [ distance ]

Add an IPv4 static route.

dest-address: Specify the destination IPv4 address of the packets.

mask: Specify the subnet mask of the destination IPv4 address.

next-hop-address: Specify the IPv4 gateway address to which the packet should be sent next.

distance: Specify the administrative distance, which is a rating of the trustworthiness of the routing information. A higher value means a lower trust rating. When more than one routing protocols have routes to the same destination, only the route that has the shortest distance will be recorded in the IP routing table. The valid values are from 1 to 255 and the default value is 1.

Step 3

show ip route [ static | connected ]

Verify the IPv4 route entries of the specified type.

Step 4

end

Return to privileged EXEC mode.

Step 5

copy running-config startup-config

Save the settings in the configuration file.

The following example shows how to create an IPv4 static route with the destination IP address as 192.168.2.0, the subnet mask as 255.255.255.0 and the next-hop address as 192.168.0.2:

Switch#configure

Switch(config)#ip route 192.168.2.0 255.255.255.0 192.168.0.2

Switch(config)#show ip route

Codes: C - connected, S - static

* - candidate default

C 192.168.0.0/24 is directly connected, Vlan1

S 192.168.2.0/24 [1/0] via 192.168.0.2, Vlan1

Switch(config)#end

Switch#copy running-config startup-config

3IPv6 Static Routing Configuration

3.1Using the GUI

Choose the menu L3 FEATURES > Static Routing > IPv6 Static Routing > IPv6 Static Routing Table and click to load the following page.

Figure 3-1 Configuring the IPv6 Static Routing

Configure the corresponding parameters to add an IPv6 static routing entry. Then click Create.

IPv6 Address

Specify the destination IPv6 address of the packets.

Prefix Length

Specify the prefix length of the IPv6 address.

Next Hop

Specify the IPv6 gateway address to which the packet should be sent next.

Distance

Specify the administrative distance, which is the trust rating of a routing entry. A higher value means a lower trust rating. Among the routes to the same destination, the route with the lowest distance value will be recorded in the IPv6 routing table.

The valid value ranges from 1 to 255 and the default value is 1

3.2Using the CLI

Follow these steps to enable IPv6 routing function and create an IPv6 static route.

Step 1

configure

Enter global configuration mode.

Step 2

ipv6 routing

Enable the IPv6 routing function on the specified Layer 3 interface.

Step 3

ipv6 route { ipv6-dest-address } { next-hop-address } [ distance ]

Add an IPv6 static route.

ipv6-dest-address: Specify the destination IPv6 address of the packets, in the format of X:X:X:X::X/<0-128>.

next-hop-address: Specify the IPv6 gateway address to which the packet should be sent next.

distance: Specify the administrative distance, which is a rating of the trustworthiness of the routing information. A higher value means a lower trust rating. When more than one routing protocols have routes to the same destination, only the route that has the shortest distance will be recorded in the IP routing table. The valid values are from 1 to 255 and the default value is 1.

Step 4

show ipv6 route [ static | connected ]

Verify the IPv6 route entries of the specified type.

Step 5

end

Return to privileged EXEC mode.

Step 6

copy running-config startup-config

Save the settings in the configuration file.

The following example shows how to create an IPv6 static route with the destination IP address as 3200::/64 and the next-hop address as 3100::1234:

Switch#configure

Switch(config)#ipv6 route 3200::/64 3100::1234

Switch(config)#show ipv6 route static

Codes: C - connected, S - static

* - candidate default

C 3000::/64 is directly connected, Vlan1

S 3200::/64 [1/0] via 3100::1234, Vlan2

Switch(config)#end

Switch#copy running-config startup-config

4Viewing Routing Table

You can view the routing tables to learn about the network topology. The switch supports IPv4 routing table and IPv6 routing table.

4.1Using the GUI

4.1.1Viewing IPv4 Routing Table

Choose the menu L3 FEATURES > Routing Table > IPv4 Routing Table to load the following page.

Figure 4-1 Viewing IPv4 Routing Table

View the IPv4 routing entries.

Protocol

Displays the type of the routing entry.

Connected: The destination network is directed connected to the switch.

Static: The routing entry is a manually added static routing entry.

Destination Network

Displays the destination IP address and subnet mask.

Next Hop

Displays the IPv4 gateway address to which the packet should be sent next.

Distance

Displays the administrative distance, which is the trust rating of a routing entry. A higher value means a lower trust rating. Among the routes to the same destination, the route with the lowest distance value will be recorded in the IPv6 routing table.

Metric

Displays the metric to reach the destination IP address.

Interface Name

Displays the name of the gateway interface.

4.1.2Viewing IPv6 Routing Table

Choose the menu L3 FEATURES> Routing Table > IPv6 Routing Table to load the following page.

Figure 4-2 Viewing IPv6 Routing Table

View the IPv6 routing entries.

Protocol

Displays the type of the routing entry.

Connected: The destination network is directed connected to the switch.

Static: The routing entry is a manually added static routing entry.

Destination Network

Displays the destination IPv6 address and subnet mask.

Next Hop

Displays the IPv6 gateway address to which the packet should be sent next.

Distance

Displays the administrative distance, which is the trust rating of a routing entry. A higher value means a lower trust rating. Among the routes to the same destination, the route with the lowest distance value will be recorded in the IPv6 routing table.

Metric

Displays the metric to reach the destination IPv6 address.

Interface Name

Displays the name of the gateway interface.

4.2Using the CLI

4.2.1Viewing IPv4 Routing Table

On privileged EXEC mode or any other configuration mode, you can use the following command to view IPv4 routing table:

show ip route [ static | connected ]

View the IPv4 route entries of the specified type. If not specified, all types of route entries will be displayed.

static: View the static routes.

connected: View the connected routes.

4.2.2Viewing IPv6 Routing Table

On privileged EXEC mode or any other configuration mode, you can use the following command to view IPv6 routing table:

show ipv6 route [ static | connected ]

View the IPv6 route entries of the specified type. If not specified, all types of route entries will be displayed.

static: View the static IPv6 routes.

connected: View the connected IPv6 routes.

5Example for Static Routing

5.1Network Requirements

As shown below, Host A and Host B are on different network segments. To meet business needs, Host A and Host B need to establish a connection without using dynamic routing protocols to ensure stable connectivity.

Figure 5-1 Network Topology

5.2Configuration Scheme

To implement this requirement, you can configure the default gateway of host A as 10.1.1.1/24, the default gateway of host B as 10.1.2.1/24, and configure IPv4 static routes on Switch A and Switch B so that hosts on different network segments can communicate with each other.

Demonstrated with T2600G-28TS, the following sections provide configuration procedure in two ways: using the GUI and using the CLI.

5.3Using the GUI

The configurations of Switch A and Switch B are similar. The following introductions take Switch A as an example.

1)Choose the menu L3 FEATURES > Interface to create a routed port Gi1/0/1 with the mode as static, the IP address as 10.1.1.1, the mask as 255.255.255.0 and the admin status as Enable. Create a routed port Gi1/0/2 with the mode as static, the IP address as 10.1.10.1, the mask as 255.255.255.0 and the admin status as Enable.

Figure 5-2 Create a Routed Port Gi1/0/1 for Switch A

Figure 5-3 Create a Routed Port Gi1/0/2 for Switch A

2)Choose the menu L3 FEATURES > Static Routing > IPv4 Static Routing to load the following page. Add a static routing entry with the destination as 10.1.2.0, the subnet mask as 255.255.255.0 and the next hop as 10.1.10.2. For switch B, add a static route entry with the destination as 10.1.1.0, the subnet mask as 255.255.255.0 and the next hop as 10.1.10.1.

Figure 5-4 Add a Static Route for Switch A

5.4Using the CLI

The configurations of Switch A and Switch B are similar. The following introductions take Switch A as an example.

1)Create a routed port Gi1/0/1 with the mode as static, the IP address as 10.1.1.1, the mask as 255.255.255.0 and the admin status as Enable. Create a routed port Gi1/0/2 with the mode as static, the IP address as 10.1.10.1, the mask as 255.255.255.0 and the admin status as Enable.

Switch_A#configure

Switch_A(config)#interface gigabitEthernet 1/0/1

Switch_A(config-if)#no switchport

Switch_A(config-if)#ip address 10.1.1.1 255.255.255.0

Switch_A(config-if)#exit

Switch_A(config)#interface gigabitEthernet 1/0/2

Switch_A(config-if)#no switchport

Switch_A(config-if)#ip address 10.1.10.1 255.255.255.0

2)Add a static route entry with the destination as 10.1.2.0, the subnet mask as 255.255.255.0 and the next hop as 10.1.10.2. For switch B, add a static route entry with the destination as 10.1.1.0, the subnet mask as 255.255.255.0 and the next hop as 10.1.10.1.

Switch_A#configure

Switch_A(config)#ip route 10.1.2.0 255.255.255.0 10.1.10.2

Switch_A(config)#end

Switch_A#copy running-config startup-config

Verify the Configurations

Switch A

Verify the static routing configuration:

Switch_A#show ip route

Codes: C - connected, S - static

* - candidate default

C 10.1.1.0/24 is directly connected, Vlan10

C 10.1.10.0/24 is directly connected, Vlan20

S 10.1.2.0/24 [1/0] via 10.1.10.2, Vlan20

Switch B

Verify the static routing configuration:

Switch_B#show ip route

Codes: C - connected, S - static

* - candidate default

C 10.1.2.0/24 is directly connected, Vlan30

C 10.1.10.0/24 is directly connected, Vlan20

S 10.1.1.0/24 [1/0] via 10.1.10.1, Vlan20

Connectivity Between Switch A and Switch B

Run the ping command on switch A to verify the connectivity:

Switch_A#ping 10.1.2.1

Pinging 10.1.2.1 with 64 bytes of data :

Reply from 10.1.2.1 : bytes=64 time<16ms TTL=64

Reply from 10.1.2.1 : bytes=64 time<16ms TTL=64

Reply from 10.1.2.1 : bytes=64 time<16ms TTL=64

Reply from 10.1.2.1 : bytes=64 time<16ms TTL=64

Ping statistics for 10.1.2.1:

Packets: Sent = 4 , Received = 4 , Lost = 0 (0% loss)

Approximate round trip times in milli-seconds:

Minimum = 1ms , Maximum = 3ms , Average = 1ms