配置静态路由教程:

拓扑图如下:

配置静态路由教程:
====================================
条件:
2台路由器为AR1220
两台S3700交换机
2台pc机
=============================================
两台pc机的ip分别如下:
pc1    192.168.1.2/24
pc2:    192.168.3.2/24
==============================================
配置静态路由命令步骤如下:
AR-1配置:
<Huawei>system-view                        //进系统视图
[Huawei]sysname AR-1                        //修改主机名为AR-1
[AR-1]interface GigabitEthernet 0/0/0                //进g0/0/0接口
[AR-1-GigabitEthernet0/0/0]ip address 192.168.1.1 24        //配置IP地址和子网掩码
[AR-1-GigabitEthernet0/0/0]int g0/0/1                //从g0/0/0切换到g0/0/1
[AR-1-GigabitEthernet0/0/1]ip address 192.168.2.1 24        //配置ip地址和子网掩码
===============================================================================
查看IP地址:
[AR-1]dis ip int bri
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 0

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.1.1/24       up         up        
GigabitEthernet0/0/1              192.168.2.1/24       up         up        
NULL0                             unassigned           up         up(s)     
[AR-1]
=====================================================================================
AR-2:
<Huawei>system-view                         //进系统视图
[Huawei]sysname AR-2                        //修改主机名为AR-2
[AR-2]interface GigabitEthernet 0/0/0                //进g0/0/0接口
[AR-2-GigabitEthernet0/0/0]ip address 192.168.3.1 24        //配置IP地址和子网掩码
[AR-2-GigabitEthernet0/0/0]int g0/0/1                //从g0/0/0切换g0/0/1
[AR-2-GigabitEthernet0/0/1]ip address 192.168.2.2 24        //配置IP地址和子网掩码
==========================================================================================
查看IP地址和子网掩码为:    dis ip int brief 
[AR-2]dis ip int brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 0

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.3.1/24       up         up        
GigabitEthernet0/0/1              192.168.2.2/24       up         up        
NULL0                             unassigned           up         up(s)     
[AR-2]
=========================================================================================
查看[AR-1]路由表:
[AR-1]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 11       Routes : 11       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      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
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
    192.168.1.0/24  Direct  0    0           D   192.168.1.1     GigabitEthernet
0/0/0
    192.168.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
  192.168.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
    192.168.2.0/24  Direct  0    0           D   192.168.2.1     GigabitEthernet
0/0/1
    192.168.2.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
  192.168.2.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
    192.168.3.0/24  Static  60   0          RD   192.168.2.2     GigabitEthernet     这是查看的核心
0/0/1
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

[AR-1]
=========================================================================================
第一次ping:
    用pc1去pingpc2 是ping不通的
PC>ping 192.168.3.1

Ping 192.168.3.1: 32 data bytes, Press Ctrl_C to break
Request timeout!
Request timeout!
Request timeout!
Request timeout!
Request timeout!

--- 192.168.3.1 ping statistics ---
  5 packet(s) transmitted
  0 packet(s) received
  100.00% packet loss
=================================================================================================
接下来配置的是让pc1能够ping通pc2的配置如下:
AR-1:
[AR-1]ip route-static 192.168.3.0 24 192.168.2.2
AR-2:
[AR-2]ip route-static 192.168.1.0 24 192.168.2.1
==================================================================================================
查看AR-2的路由表:
[AR-2]dis ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 11       Routes : 11       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      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
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
    192.168.1.0/24  Static  60   0          RD   192.168.2.1     GigabitEthernet    这是查看的核心
0/0/1
    192.168.2.0/24  Direct  0    0           D   192.168.2.2     GigabitEthernet
0/0/1
    192.168.2.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
  192.168.2.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
    192.168.3.0/24  Direct  0    0           D   192.168.3.1     GigabitEthernet
0/0/0
    192.168.3.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
  192.168.3.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
========================================================================================================
进行第二次的ping操作如下: 经过验证是可以ping通的
PC>ping 192.168.3.1

Ping 192.168.3.1: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.3.1: bytes=32 seq=2 ttl=254 time=110 ms
From 192.168.3.1: bytes=32 seq=3 ttl=254 time=62 ms
From 192.168.3.1: bytes=32 seq=4 ttl=254 time=31 ms
From 192.168.3.1: bytes=32 seq=5 ttl=254 time=32 ms

--- 192.168.3.1 ping statistics ---
  5 packet(s) transmitted
  4 packet(s) received
  20.00% packet loss
  round-trip min/avg/max = 0/58/110 ms
 

发布了13 篇原创文章 · 获赞 9 · 访问量 728

猜你喜欢

转载自blog.csdn.net/qq_38936227/article/details/104286210