Static Routing with 2 Routers in SONiC OS
Static routing is a type of network routing technique in which
routes are manually configured by the network administrator. The
routing information does not change automatically unless it is manually
updated.
1.
Scenario Overview
We have:
PC1 → Router1 → Router2 → PC2
2. Steps for Configuration
Router1 (R1):
Remove the BGP neighbors with the default IP addresses of Ethernet0
and Ethernet4.
$sudo config bgp remove neighbor ARISTA01T2
$sudo config bgp remove neighbor ARISTA02T2
Remove the default IP addresses of Ethernet0 and Ethernet4
$sudo config interface ip remove Ethernet0 [Link]/31
$sudo config interface ip remove Ethernet4 [Link]/31
Add the new IP addresses for Ethernet0 & 4
$sudo config interface ip add Ethernet0 [Link]/22
$sudo config interface ip add Ethernet4 [Link]/24
Add the Routing path
$sudo config route add prefix [Link]/24 nexthop [Link]
$sudo config save -y
$show ip route
Router2 (R2):
Remove the BGP neighbors with the default IP addresses of Ethernet0
and Ethernet4.
$sudo config bgp remove neighbor ARISTA01T2
$sudo config bgp remove neighbor ARISTA02T2
Remove the default IP addresses of Ethernet0 and Ethernet4
$sudo config interface ip remove Ethernet0 [Link]/31
$sudo config interface ip remove Ethernet4 [Link]/31
Add the new IP addresses for Ethernet0 & 4
$sudo config interface ip add Ethernet0 [Link]/24
$sudo config interface ip add Ethernet4 [Link]/24
Add the Routing path
$sudo config route add prefix [Link]/24 nexthop [Link]
$sudo config save -y
$show ip route
Step 4 — Configure PCs
PC1: IP [Link]/24 [Link]
PC2: IP [Link]/24 [Link]
Step 5 — Test
From PC1:
$ping [Link] //PC2
From PC2:
$ping [Link] //PC1
$ping [Link] //R2
3. Network Diagram
The diagram below illustrates the static routing setup between two
routers.