Computer Network - Configuring Static Routing Experiment

Purpose

  1. Master the configuration method of static routing.
  2. Understand the meaning and characteristics of static routing.

Experimental software

Cisco Packet Tracer

Experimental requirements

Use static routing to implement communication between different subnets.

experimental knowledge

Key commands for this experiment:

model Order Function
Router(config-if)# ip address ip-add subnet-mask Configure an interface ip
Router(config-if)# no ip address Delete an interface ip
(config)# ip route ip-add subnet-mask next hop ip-add Set up static routes
(config)# no ip route ip-add subnet-mask next hop ip-add Delete static route
# show ip route View routing table
# show ip interface brief View port profile

Note: ip-add is the IP address; subnet-mask is the subnet mask.

Experimental steps

  1. Create a network topology as shown in the figure below, and select the router model yourself.
    Insert image description here

  1. Configuration of PC0:
    Insert image description here

  1. Configuration of PC1:
    Insert image description here

  1. Enter the [Command Line] interface of Router0, open and set the port IP: First, you will be asked whether to configure the router in a dialog box. We can skip it by answering no. Then press Enter again to enter the command.
命令如下:

Router>enable

Router#configure terminal //进入特权模式

Router(config)#interface FastEthernet0/0 //进入接口fa0/0

Router(config-if)#ip address 192.168.1.1 255.255.255.0 //配置接口fa0/0

Router(config-if)#no shutdown //启动

Router(config)#interface FastEthernet1/0

Router(config-if)#ip address 192.168.2.1 255.255.255.0

Router(config-if)#no shutdown


Insert image description here


  1. Enter the [Command Line] interface of Router1, open and set the port IP:
命令如下:

Router>enable

Router#configure terminal

Router(config)#interface FastEthernet0/0

Router(config-if)#ip address 192.168.2.2 255.255.255.0

Router(config-if)#no shutdown

Router(config)#interface FastEthernet1/0

Router(config-if)#ip address 192.168.3.1 255.255.255.0

Router(config-if)#no shutdown


Insert image description here


  1. Enter the [Command Line] interface of Router2, open and set the port IP:
命令如下:

Router>enable

Router#configure terminal

Router(config)#interface FastEthernet0/0

Router(config-if)#ip address 192.168.3.2 255.255.255.0

Router(config-if)#no shutdown

Router(config)#interface FastEthernet1/0

Router(config-if)#ip address 192.168.4.1 255.255.255.0

Router(config-if)#no shutdown


Insert image description here


  1. Then enter the [Command Line] of Router0 and enter the following command:
Router(config-if)#exit

Router(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.2
//告知路由器去 192.168.3.0 子网掩码是 255.255.255.0 这个网段的数据包要通过 192.168.2.2 这个地址送出去。

Router(config)#ip route 192.168.4.0 255.255.255.0 192.168.3.2


Static route settings:ip route-static prefix mask {address| interfacce} [distance] [tag tag] [permanent]

  • Prefix: IP of the destination network to be reached
  • Mask: The subnet mask of the destination network to be reached
  • Address: The IP address of the next hop route, that is, the port address of the adjacent router
  • Interface: Local network interface (choose one from the Address above)
  • Distance: Administrative distance (optional)
  • Tag Tag:tag 值(可选)
  • Permanent: Specifies that this route will not be removed even if the port is closed (optional)

Insert image description here


  1. Then enter the [Command Line] of Router1 and enter the following command:
Router(config-if)#exit

Router(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1

Router(config)#ip route 192.168.4.0 255.255.255.0 192.168.3.2


Insert image description here


  1. Then enter the [Command Line] of Router2 and enter the following command:
Router(config-if)#exit

Router(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1

Router(config)#ip route 192.168.2.0 255.255.255.0 192.168.3.1

Insert image description here


Experimental results

Enter the command prompt interface of PC0 and ping the IP of PC1:

Insert image description here


Enter the command prompt interface of PC1 and ping the IP of PC0:

Insert image description here


Note: If the ping succeeds, it means the two PCs are successfully connected. If there is no ping, it may be because the router responds slowly, please wait a moment and try again. If it still fails, please check whether the IP address in the command line is entered correctly and whether the port is set correctly.

Each IP address can also ping each other.
Insert image description here


Insert image description here


Insert image description here


Guess you like

Origin blog.csdn.net/qq_45902301/article/details/125177545