Huawei, Cisco, and Juniper Networks Static Routing Experimental Configuration

  • A brief introduction to static routing

  • Huawei Static Routing Experiment

    • Networking requirements

    • Configuration ideas

    • Steps

    • configuration file

  • Cisco Static Routing Experiment

    • experimental topology

    • Configure IP address for each PC

    • Configure an IP address for each router

    • Configure static routing

    • Test communication between two PCs

  • Juniper Static Routing Experiment

    • static routing topology

    • Experiment Description

    • Experimental configuration

    • result

    • verify

A brief introduction to static routing

A static route is a special route that needs to be manually configured by the administrator. Static routing uses less bandwidth than dynamic routing and does not use CPU resources to calculate and analyze routing updates. However, when the network fails or the topology changes, the static route will not be automatically updated and must be manually reconfigured.

Static routing has 5 main parameters:

  • Destination address

  • mask

  • out interface

  • Next hop

  • priority.

The advantage of using static routing is simple configuration and high controllability. When the network structure is relatively simple, you only need to configure static routing to make the network work normally. In a complex network environment, you can also configure static routes to improve network performance and guarantee bandwidth for important applications.

Huawei Static Routing Experiment

Networking requirements

As shown in the figure below, hosts belonging to different network segments are connected through several Switches. It is required not to configure a dynamic routing protocol so that any two hosts on different network segments can communicate with each other.

Configuration ideas

Use the following ideas to configure different network segments to communicate with each other through static routes:

  1. Create a VLAN and configure the VLAN to which each interface belongs, and configure the IP address of each VLANIF interface to implement network communication between adjacent devices.

  2. Configure IP default gateways on each host, and configure IPv4 static routes or static default routes on each Switch, so that no dynamic routing protocol is configured, so that any two hosts on different network segments can communicate with each other.

Steps

  1. Configure the VLAN to which each interface belongs

Configure SwitchA. The configurations of SwitchB and SwitchC are similar to those of SwitchA.

<HUAWEI> system-view
[HUAWEI] sysname SwitchA
[SwitchA] vlan batch 10 30
[SwitchA] interface gigabitethernet 1/0/1
[SwitchA-GigabitEthernet1/0/1] port link-type trunk
[SwitchA-GigabitEthernet1/0/1] port trunk allow-pass vlan 10
[SwitchA-GigabitEthernet1/0/1] quit
[SwitchA] interface gigabitethernet 1/0/2
[SwitchA-GigabitEthernet1/0/2] port link-type access
[SwitchA-GigabitEthernet1/0/2] port default vlan 30
[SwitchA-GigabitEthernet1/0/2] quit
  1. Configure an IP address for each VLANIF interface

Configure SwitchA. The configurations of SwitchB and SwitchC are similar to those of SwitchA.

[SwitchA] interface vlanif 10
[SwitchA-Vlanif10] ip address 10.1.4.1 30
[SwitchA-Vlanif10] quit
[SwitchA] interface vlanif 30
[SwitchA-Vlanif30] ip address 10.1.1.1 24
[SwitchA-Vlanif30] quit
  1. configure host

Configure the default gateway of host PC1 to 10.1.1.1, the default gateway of host PC2 to 10.1.2.1, and the default gateway of host PC3 to 10.1.3.1.

  1. Configure static routing

Configure a default IP route on SwitchA.

[SwitchA] ip route-static 0.0.0.0 0.0.0.0 10.1.4.2

Configure two IP static routes on SwitchB.

[SwitchB] ip route-static 10.1.1.0 255.255.255.0 10.1.4.1
[SwitchB] ip route-static 10.1.3.0 255.255.255.0 10.1.4.6

Configure an IP default route on SwitchC.

[SwitchC] ip route-static 0.0.0.0 0.0.0.0 10.1.4.5
  1. Verify configuration results

Check the IP routing table of SwitchA.

[SwitchA] display ip routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 7        Routes : 7
 
Destination/Mask    Proto  Pre  Cost   Flags   NextHop      Interface
 
        0.0.0.0/0    Static 60   0        RD    10.1.4.2     Vlanif10
        10.1.1.0/24  Direct 0    0         D    10.1.1.1     Vlanif30
        10.1.1.1/32  Direct 0    0         D    127.0.0.1    Vlanif30
        10.1.4.0/30  Direct 0    0         D    10.1.4.1     Vlanif10
        10.1.4.1/32  Direct 0    0         D    127.0.0.1    Vlanif10
      127.0.0.0/8    Direct 0    0         D    127.0.0.1    InLoopBack0
      127.0.0.1/32   Direct 0    0         D    127.0.0.1    InLoopBack0

Use the ping command to verify connectivity.

[SwitchA] ping 10.1.3.1
  PING 10.1.3.1: 56  data bytes, press CTRL_C to break
    Reply from 10.1.3.1: bytes=56 Sequence=1 ttl=253 time=62 ms
    Reply from 10.1.3.1: bytes=56 Sequence=2 ttl=253 time=63 ms
    Reply from 10.1.3.1: bytes=56 Sequence=3 ttl=253 time=63 ms
    Reply from 10.1.3.1: bytes=56 Sequence=4 ttl=253 time=62 ms
    Reply from 10.1.3.1: bytes=56 Sequence=5 ttl=253 time=62 ms

  --- 10.1.3.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 62/62/63 ms

Verify connectivity using the Tracert command.

[SwitchA] tracert 10.1.3.1
 traceroute to  10.1.3.1(10.1.3.1), max hops: 30 ,packet length: 40,press CTRL_C to break
 1 10.1.4.2 31 ms  32 ms  31 ms
 2 10.1.3.1 62 ms  63 ms  62 ms

configuration file

Configuration file of SwitchA

#
sysname SwitchA
#
vlan batch 10 30
#
interface Vlanif10
 ip address 10.1.4.1 255.255.255.252
#
interface Vlanif30
 ip address 10.1.1.1 255.255.255.0
#
interface GigabitEthernet1/0/1
 port link-type trunk
 port trunk allow-pass vlan 10
#
interface GigabitEthernet1/0/2
 port link-type access
 port default vlan 30
#
ip route-static 0.0.0.0 0.0.0.0 10.1.4.2
#
return

Configuration file of SwitchB

#
sysname SwitchB
#
vlan batch 10 20 40
#
interface Vlanif10
 ip address 10.1.4.2 255.255.255.252
#
interface Vlanif20
 ip address 10.1.4.5 255.255.255.252
#
interface Vlanif40
 ip address 10.1.2.1 255.255.255.0
#
interface GigabitEthernet1/0/1
 port link-type trunk
 port trunk allow-pass vlan 10
#
interface GigabitEthernet1/0/2
 port link-type trunk
 port trunk allow-pass vlan 20
#
interface GigabitEthernet1/0/3
 port link-type access
 port default vlan 40
#
ip route-static 10.1.1.0 255.255.255.0 10.1.4.1
ip route-static 10.1.3.0 255.255.255.0 10.1.4.6
#
return

Configuration file of SwitchC

#
sysname SwitchC
#
vlan batch 20 50
#
interface Vlanif20
 ip address 10.1.4.6 255.255.255.252
#
interface Vlanif50
 ip address 10.1.3.1 255.255.255.0
#
interface GigabitEthernet1/0/1
 port link-type trunk
 port trunk allow-pass vlan 20
#
interface GigabitEthernet1/0/2
 port link-type access
 port default vlan 50
#
ip route-static 0.0.0.0 0.0.0.0 10.1.4.5
#
return

Cisco Static Routing Experiment

experimental topology

Configure IP address for each PC

Configure the IP addresses of all PCs according to the topology diagram.

Configure an IP address for each router

R1:

R1(config)#host R1 
R1(config)#int fa0/0 
R1(config-if)#ip add 60.0.0.1 255.0.0.0 
R1(config-if)#no shut 
R1(config-if)#exit 
R1( config)#int se0/0/0 
R1(config-if)#ip add 70.0.0.1 255.0.0.0 
R1(config-if)#clock rate 64000 
R1(config-if)#no close

R2:

Router(config)#host R2 
R2(config)#int se0/0/0 
R2(config-if)#ip add 70.0.0.2 255.0.0.0 
R2(config-if)#no shut 
R2(config-if)#exit 
R2(config)#int se0/0/1 
R2(config-if)#ip add 20.0.0.1 255.0.0.0 
R2(config-if)#clock rate 64000 
R2(config-if)#no shut 
R2(config-if )#exit 
R2(config)#int fa0/0 
R2(config-if)#ip add 10.0.0.1 255.0.0.0 
R2(config-if)#no close

R3:

Router(config)#host R3 
R3(config)#int fa0/0 
R3(config-if)#ip add 30.0.0.1 255.0.0.0 
R3(config-if)#no shut 
R3(config-if)#exit 
R3( config)# 
R3(config)#int se0/0/0 
R3(config-if)#ip add 20.0.0.2 255.0.0.0 
R3(config-if)#no shut 
R3(config-if)#exit 
R3(config) #int se0/0/1 
R3(config-if)#ip add 40.0.0.1 255.0.0.0 
R3(config-if)#clock rate 64000 
R3(config-if)#no close

R4:

Router(config)#host R4 
R4(config)#int se0/0/0 
R4(config-if)#ip add 40.0.0.2 255.0.0.0 
R4(config-if)#no shut 
R4(config-if)#exit 
R4(config)#int fa0/0 
R4(config-if)#ip add 50.0.0.1 255.0.0.0 
R4(config-if)#no close

Configure static routing

R1:

R1(config)#ip route 10.0.0.0 255.0.0.0 70.0.0.2 
R1(config)#ip route 20.0.0.0 255.0.0.0 70.0.0.2 
R1(config)#ip route 30.0.0.0 255.0.0.0 70.0.0.2 
R1( config)#ip route 40.0.0.0 255.0.0.0 70.0.0.2 
R1(config)#ip route 50.0.0.0 255.0.0.0 70.0.0.2

R2:

R2(config)#ip route 30.0.0.0 255.0.0.0 20.0.0.2 
R2(config)#ip route 40.0.0.0 255.0.0.0 20.0.0.2 
R2(config)#ip route 50.0.0.0 255.0.0.0 20.0.0.2 
R2( config)#ip 路由 60.0.0.0 255.0.0.0 70.0.0.1

R3:

R3(config)#ip route 10.0.0.0 255.0.0.0 20.0.0.1 
R3(config)#ip route 60.0.0.0 255.0.0.0 20.0.0.1 
R3(config)#ip route 70.0.0.0 255.0.0.0 20.0.0.1 
R3( config)#ip 路由 50.0.0.0 255.0.0.0 40.0.0.2

R4:

R4(config)#ip route 10.0.0.0 255.0.0.0 40.0.0.1 
R4(config)#ip route 20.0.0.0 255.0.0.0 40.0.0.1 
R4(config)#ip route 30.0.0.0 255.0.0.0 40.0.0.1 
R4( config)#ip route 60.0.0.0 255.0.0.0 40.0.0.1 
R4(config)#ip route 70.0.0.0 255.0.0.0 40.0.0.1

Test communication between two PCs

First check the IP address of the PC:

PC>ipconfig
FastEthernet0 Connection:(default port)
Link-local IPv6 Address.........: FE80::210:11FF:FEC8:A547
IP Address......................: 50.0.0.2
Subnet Mask.....................: 255.0.0.0
Default Gateway.................: 50.0.0.1

Then ping with another computer:

PC>ping 60.0.0.2
Pinging 60.0.0.2 with 32 bytes of data:
Request timed out.
Reply from 60.0.0.2: bytes=32 time=3ms TTL=124
Reply from 60.0.0.2: bytes=32 time=3ms TTL=124
Reply from 60.0.0.2: bytes=32 time=15ms TTL=124
Ping statistics for 60.0.0.2:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 3ms, Maximum = 15ms, Average = 7ms

You can see that another PC is receiving packets, and the static route is in effect.

Juniper Static Routing Experiment

static routing topology

Experiment Description

Configure a static route 192.168.47.0/24 on the provider device (R1) with a next hop address of 172.16.1.2. Through this route, the provider device can reach the remote network at the customer site, and a static default route of 0.0.0.0/0 can also be configured on the customer device with a next-hop address of 172.16.1.1, which forwards this traffic to the provider network, which ensures that clients can reach all non-local networks.

There are multiple loopback addresses configured on both devices that provide remote destinations to ping, so you can verify that the static routes are working.

Experimental configuration

R1 device (provider)

set system host-name R1
set interfaces ge-0/0/0 unit 0 description “Link from R1 to R2”
set interfaces ge-0/0/0 unit 0 family inet address 172.16.1.1/24
set interfaces lo0 unit 0 family inet address 10.0.0.1/32
set interfaces lo0 unit 0 family inet address 10.0.0.2/32
set routing-options static route 192.168.47.0/24 next-hop 172.16.1.2

R2 device (customer)

set system host-name R2
set interfaces ge-0/0/0 unit 0 description “Link from R2 to R1”
set interfaces ge-0/0/0 unit 0 family inet address 172.16.1.2/24
set interfaces lo0 unit 0 family inet address 192.168.47.5/32
set interfaces lo0 unit 0 family inet address 192.168.47.6/32
set routing-options static route 0.0.0.0/0 next-hop 172.16.1.1
Configure R1 and R2 Devices Step by Step Procedure
  1. Configure the hostname on the R1 (provider) device.

[edit ]
user@R1# set system host-name R1
  1. Configure the interface on the R1 (provider) device.

[edit interfaces]
user@R1# set ge-0/0/0 unit 0 description "Link from R1 to R2"
user@R1# set ge-0/0/0 unit 0 family inet address 172.16.1.1/24
user@R1# set lo0 unit 0 family inet address 10.0.0.1/32
user@R1# set lo0 unit 0 family inet address 10.0.0.2/32
  1. Define a static route for the customer prefix on the R1 device. Make sure to specify the R2 side of the point-to-point link as the next hop for the static route.

Static routing forwards traffic through the R2 device, ensuring that the provider network can route to all remote destinations within the customer network.

[edit routing-options]
user@R1# set static route 192.168.47.0/24 next-hop 172.16.1.2
  1. Commit the changes on the R1 device.

[edit ]
user@R1# commit
  1. Configure the hostname on the R2 (client) device.

[edit ]
user@R2# set system host-name R2
  1. Configure the interface on the R2 (client) device.

[edit interfaces]
user@R2# set ge-0/0/0 unit 0 description "Link from R2 to R1"
user@R2# set ge-0/0/0 unit 0 family inet address 172.16.1.2/24
user@R2# set lo0 unit 0 family inet address 192.168.47.5/32
user@R2# set lo0 unit 0 family inet address 192.168.47.6/32
  1. To define an IPv4 static default route on the R2 device, make sure to specify the R1 end of the point-to-point link as the next hop for the static route.

An IPv4 default route forwards traffic to the R1 device on the provider network, ensuring customers can route to all non-local destinations.

[edit routing-options]
user@R2# set static route 0.0.0.0/0 next-hop 172.16.1.1
  1. Commit the changes on the R2 device.

[edit]
user@R2# commit

result

Issue the show interfaces and show routing-options commands to confirm your configuration, and if the output does not show the expected configuration, repeat the instructions in this example to correct the configuration.

R1 device

user@R1# show interfaces
ge-0/0/0 {
    unit 0 {
        description "Link from R1 to R2";
        family inet {
            address 172.16.1.1/24;
        }
    }
}
lo0 {
    unit 0 {
        family inet {
            address 10.0.0.1/32;
            address 10.0.0.2/32;
        }
    }
}
user@R1# show routing-options
static {
    route 192.168.47.0/24 next-hop 172.16.1.2;
}

R2 device

user@R2# show interfaces
ge-0/0/0 {
    unit 0 {
        description "Link from R2 to R1";
        family inet {
            address 172.16.1.2/24;
        }
    }
}
lo0 {
    unit 0 {
        family inet {
            address 192.168.47.5/32;
            address 192.168.47.6/32;
        }
    }
}
user@R2# show routing-options
static {
    route 0.0.0.0/0 next-hop 172.16.1.1;
}

verify

Check the routing tables to verify that the IPv4 static route is listed as an active route in the routing tables of both devices.
user@R1> show route
inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

10.0.0.1/32        *[Direct/0] 00:29:43
                    > via lo0.0
10.0.0.2/32        *[Direct/0] 00:29:43
                    > via lo0.0
172.16.1.0/24      *[Direct/0] 00:34:40
                    > via ge-0/0/0.0
172.16.1.1/32      *[Local/0] 00:34:40
                      Local via ge-0/0/0.0
192.168.47.0/24    *[Static/5] 00:31:23
                    > to 172.16.1.2 via ge-0/0/0.0
user@R2> show route
inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

0.0.0.0/0          *[Static/5] 00:31:24
                    > to 172.16.1.1 via ge-1/2/0.1
172.16.1.0/24      *[Direct/0] 00:35:21
                    > via ge-0/0/0.0
172.16.1.2/32      *[Local/0] 00:35:21
                      Local via ge-0/0/0.0
192.168.47.5/32    *[Direct/0] 00:35:22
                    > via lo0.0
192.168.47.6/32    *[Direct/0] 00:35:21
                    > via lo0.0 
Ping the remote loopback address

Verify that IPv4 static routes provide connectivity between the loopback addresses of these two devices. It's a good idea to use the source option to serve test traffic from the loopback address of the local device. This method verifies forwarding between the loopback addresses of the two devices in a single command.

  • Ping the loopback interface address of the R2 device from the R1 device.

  • Ping the loopback interface address of the R1 device from the R2 device.

user@R1> ping 192.168.47.5 count 2 source 10.0.0.1
PING 192.168.47.5 (192.168.47.5): 56 data bytes
64 bytes from 192.168.47.5: icmp_seq=0 ttl=64 time=1.344 ms
64 bytes from 192.168.47.5: icmp_seq=1 ttl=64 time=1.279 ms

--- 192.168.47.5 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max/stddev = 1.279/1.312/1.344/0.032 ms
user@R2> ping 10.0.0.1 count 2 source 192.168.47.5
PING 10.0.0.1 (10.0.0.1): 56 data bytes
64 bytes from 10.0.0.1: icmp_seq=0 ttl=64 time=1.939 ms
64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=2.139 ms

--- 10.0.0.1 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max/stddev = 1.939/2.039/2.139/0.100 ms

 

 

Guess you like

Origin blog.csdn.net/qq_43416206/article/details/131334856