Example for Configuring IPv4 Static Routes


Unicast routing involves sending data from a single sender to a single receiver, making it a point-to-point routing protocol. Examples of unicast protocols include TCP and HTTP. Various forms of Layer 3 routing are considered unicast, including static routing. Static routing is used to manually configure a routing entry rather than rely on dynamic routing. As the name implies, static routes are fixed routes that do not change. They may be used as a backup to dynamic routing, to ensure a valid path exists between two points.

This document describes an example of how to configure a static route between two hosts in a network using open white box switches running the Pica8 PICOS network operating system.

Configuration Example

An example of configuration with static routing is shown in Fig. 5-1. Host A and Host B should be able to communicate with each other. Host A and Host B should be able to communicate with the gateway (e.g., access Internet).


                                    Figure 5-1. Static routing configuration. 

Configuring Switch A

For Switch A, configure 3 VLAN interfaces for networks 10.10.1.1/24, 10.10.3.1/24, and 10.10.6.1/24. Also configure a static route to 10.10.2.0/24 and a default route.

admin@XorPlus# set vlans vlan-id 2
admin@XorPlus# set vlans vlan-id 3
admin@XorPlus# set vlans vlan-id 4
admin@XorPlus# set interface gigabit-ethernet ge-1/1/1 family ethernet-switching native-vlan-id 2
admin@XorPlus# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching native-vlan-id 3
admin@XorPlus# set interface gigabit-ethernet ge-1/1/3 family ethernet-switching native-vlan-id 4
admin@XorPlus# set vlans vlan-id 2 l3-interface vlan-2
admin@XorPlus# set vlans vlan-id 3 l3-interface vlan-3
admin@XorPlus# set vlans vlan-id 4 l3-interface vlan-4
admin@XorPlus# commit
Commit OK.
Save done.
admin@XorPlus# set l3-interface vlan-interface vlan-2 address 10.10.1.1 prefix-length 24
admin@XorPlus# set l3-interface vlan-interface vlan-3 address 10.10.3.1 prefix-length 24
admin@XorPlus# set l3-interface vlan-interface vlan-4 address 10.10.6.1 prefix-length 24
admin@XorPlus# set ip routing enable true
admin@XorPlus# set protocols static route 10.10.2.0/24 next-hop 10.10.6.2
admin@XorPlus# set protocols static route 0.0.0.0/0 next-hop 10.10.3.2
admin@XorPlus# commit
Commit OK.
Save done.
admin@XorPlus# 


Verify the static route entry in the RIB as follows:

admin@XorPlus# run show route static 
RIB entry for static
====================
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

S>* 10.10.2.0/24 [1/0] via 10.10.6.1, vlan-4, weight 1, 00:40:35
S>* 0.0.0.0/0 [1/0] via 10.10.3.1, vlan-3, weight 1, 05:00:04


Configuring Switch B

Configure 3 VLAN interfaces for networks 10.10.2.1/24, 10.10.4.1/24, and 10.10.6.2/24. Then, configure a static route to 10.10.1.0/24 and a default route.

admin@XorPlus# set vlans vlan-id 2
admin@XorPlus# set vlans vlan-id 3
admin@XorPlus# set vlans vlan-id 4
admin@XorPlus# set interface gigabit-ethernet ge-1/1/1 family ethernet-switching native-vlan-id 2
admin@XorPlus# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching native-vlan-id 3
admin@XorPlus# set interface gigabit-ethernet ge-1/1/3 family ethernet-switching native-vlan-id 4
admin@XorPlus# set vlans vlan-id 2 l3-interface vlan-2
admin@XorPlus# set vlans vlan-id 3 l3-interface vlan-3
admin@XorPlus# set vlans vlan-id 4 l3-interface vlan-4
admin@XorPlus# commit
Commit OK.
Save done.
admin@XorPlus# set l3-interface vlan-interface vlan-2 address 10.10.2.1 prefix-length 24
admin@XorPlus# set l3-interface vlan-interface vlan-3 address 10.10.4.1 prefix-length 24
admin@XorPlus# set l3-interface vlan-interface vlan-4 address 10.10.6.2 prefix-length 24
admin@XorPlus# set ip routing enable true
admin@XorPlus# set protocols static route 10.10.1.0/24 next-hop 10.10.6.1
admin@XorPlus# set protocols static route 0.0.0.0/0 next-hop 10.10.4.2
admin@XorPlus# commit
Commit OK.
Save done.
admin@XorPlus# 


Verify the static route entry in the RIB:

admin@XorPlus# run show route static
RIB entry for static
====================
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

S>* 10.10.1.0/24 [1/0] via 10.10.6.1, vlan-4, weight 1, 00:40:35
S>* 0.0.0.0/0 [1/0] via 10.10.4.1, vlan-3, weight 1, 05:00:04


Configuring Switch C

Configure 3 VLAN interfaces for networks 10.10.3.2/24, 10.10.4.2/24, and 10.10.5.2/24. Then, configure a static route to 10.10.1.0/24 and a default route.

admin@XorPlus# set vlans vlan-id 2
admin@XorPlus# set vlans vlan-id 3
admin@XorPlus# set vlans vlan-id 4
admin@XorPlus# set interface gigabit-ethernet ge-1/1/1 family ethernet-switching native-vlan-id 2
admin@XorPlus# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching native-vlan-id 3
admin@XorPlus# set interface gigabit-ethernet ge-1/1/3 family ethernet-switching native-vlan-id 4
admin@XorPlus# set vlans vlan-id 2 l3-interface vlan-2
admin@XorPlus# set vlans vlan-id 3 l3-interface vlan-3
admin@XorPlus# set vlans vlan-id 4 l3-interface vlan-4
admin@XorPlus# commit
Commit OK.
Save done.
admin@XorPlus# set l3-interface vlan-interface vlan-2 address 10.10.3.2 prefix-length 24
admin@XorPlus# set l3-interface vlan-interface vlan-3 address 10.10.4.2 prefix-length 24
admin@XorPlus# set l3-interface vlan-interface vlan-4 address 10.10.5.2 prefix-length 24
admin@XorPlus# set ip routing enable true
admin@XorPlus# set protocols static route 10.10.1.0/24 next-hop 10.10.3.1
admin@XorPlus# set protocols static route 10.10.2.0/24 next-hop 10.10.4.1
admin@XorPlus# set protocols static route 10.10.6.0/24 next-hop 10.10.3.1
admin@XorPlus# set protocols static route 0.0.0.0/0 next-hop 10.10.5.1
admin@XorPlus# commit
Commit OK.
Save done.
admin@XorPlus# 


Verify the static route entry in the RIB:

admin@XorPlus# run show route static
RIB entry for static
====================
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

S>* 10.10.1.0/24 [1/0] via 10.10.3.2, vlan-2, weight 1, 00:40:35
S>* 10.10.2.0/24 [1/0] via 10.10.4.2, vlan-3, weight 1, 00:40:35
S>* 10.10.6.0/24 [1/0] via 10.10.3.2, vlan-2, weight 1, 00:40:35
S>* 0.0.0.0/0 [1/0] via 10.10.5.2, vlan-4, weight 1, 05:00:04

Copyright © 2024 Pica8 Inc. All Rights Reserved.