靜態路由及默認路由

拓撲圖

 

場景,通過配置,使R1,R2,R3之間互聯互通

1、配置R1,R2,R3設備名稱和IP地址

R1配置

system-view

sysname r1

interface serial 4/0/0

ip address 10.0.12.1 24

description this port connect to r2-s4/0/0 //與路由器2serial接口進行連接通信

quit

inteface gigabitethernet 0/0/0

ip address 10.0.13.1 24

description this port connect to r3-g0/0/0 //與路由器3接口進行連接通信

interface loopback 0 //進入迴環接口地址

ip address 10.0.1.1 24

 

配置完成後檢查配置是否生效

display current-configuration

R2的配置

system-view

sysname r2

interface serial 4/0/0

ip address 10.0.12.2 24

description this port connect to r1-s4/0/0

quit

interface serial 4/0/1

ip address 10.0.23.2 24

desciption this port connect to r3-s4/0/1

quit

interface loopback 0

ipaddress 10.0.2.2 24

display current-configuration

R3的配置

system-view

sysname r3

interface serial 4/0//1

ip address 10.0.23.3 24

description this port connect to r2-s4/0/1

quit

interface gigabitethernet 0/0/0

ip address 10.0.13.3 24

description this port connect to r1-g0/0/0

quit

interface loopback 0

ip address 10.0.3.3 24

dis current-configuration

配置完成後各端口下IP地址及信息

R1 serial 4/0/0 10.0.12.1 int gi 0/0/0 10.0.13.1 loopback 10.0.1.1

R2 serial 4/0/0 10.0.12.2 serial 4/0/1 10.0.23.2 loopback 10.0.2.2

R3 serial 4/0/1 10.0.23.3 int gi 0/0/0 10.0.13.3 loopback 10.0.3.3

R1 S4/0/0-----R2 S4/0/0 R1 int gi 0/0/0 --------R3 int gi 0/0/0

R3 S4/0/1-----R2 S4/0/1 R3 int gi 0/0/0-----R1 int gi 0/0/0

R2 S4/0/0-----R1 S4/0/0 R2 S4/0/1 --------R3 S4/0/1

 

基礎配置完記得保存

在缺省下,save y

 

2、網絡配置好後,看各網絡的連通性

1、R1-R2 在R1上pingR2的地址 <r1> ping 10.0.12.2

2、R1-R3 在R1上pingR3的地址 <r1> ping 10.0.13.3

3、R2-R3 在R2上pingR3的地址 <r3> ping 10.0.23.3

3、R2上網絡貫通性

此時 R2上ping 10.0.13.3 和10.0.3.3 是不通的,

加過路由之後,網絡變通,

ip route-static 10.0.13.0 24 10.0.23.3

ip route-static 10.0.3.0 2 24 10.0.23.3

形成第二條路由,並設置優先級

先在R1上設置 R1和R3之間路由通路,後設置路由路徑,從R2 serial 4/0/0到 R1上,然後在到R3

[r1] ip route-static 10.0.3.0 24 10.0.13.3 //這一點有點不明白,希望後期能整明白

[r2] ip route-static 10.0.13.0 24 serial 4/0/0 preference 80

[r2] ip route-static 10.0.3.0 24 serial 4/0/0 preference 80

[r3] ip route-static 10.0.12.0 24 10.0.13.1 //R3上配置路由到13.1

加上路由後,驗證是否路由通 |

[r2] ping 10.0.13.3 |

[r2] ping 10.0.3.3 |

分別看路徑,看看路徑如何走的 |

tracert 10.0.13.3 tracert 10.0.3.3 //思考,爲何如此走 !!

驗證第二條路由是否通的

斷開R2-R3之間連接,登錄進去R2後,輸入以下命令

interface serial 4/0/1

shutdown //啓動端口 undo shutdown

此時在看到R3是否是通的

[r2] ping 10.0.13.3

[r2] ping 10.0.3.3

分別看路徑,看看路徑如何走的

tracert 10.0.13.3 tracert 10.0.3.3

4、在R1上配置路由,實現網絡互通

先在R2上打開關閉的端口

測試R1到R3的連通性

ping 10.0.23.3 =>測試結果爲不通

=> R1缺少到10.0.23.3的路由

加上路由 ip route-static 0.0.0.0 0.0.0.0 10.0.13.3

此時在測試R1到R3直接連通性

ping 10.0.23.3 => 已通

R1上備用路由配置

[r1] ip route-static 0.0.0.0 0.0.0.0 10.0.12.2 preference 80

[r3] ip route-static 10.0.12.0 24 10.0.23.2 preference 80

檢查路由配置是否生效 display ip routing-table

關閉R1-R3之間鏈路,檢查此時路由,對比有何不同。

 

思考:

1.華爲路由器下ping參數,和win下有很多不同

2.默認情況下發出去的ping數據包,源地址多少

3.此時所有網段是否已通

4.如果只實現互通,那種配置方式是最簡潔的配置?

5.配置靜態路由時,可以使用參數,“下一條的IP地址”,也可使用參數“接口標識”,有何不同?

 

解答(個人理解):

1、 使用ping ?可以看到各種參數,可一一對照理解

2、我們使用ping -i 可以指定出去的網口。默認走優先級最高

3、

目前不太理解,以後求解。先把路由記錄下來

R1 serial 4/0/0 10.0.12.1 int gi 0/0/0 10.0.13.1 loopback 10.0.1.1

R2 serial 4/0/0 10.0.12.2 serial 4/0/1 10.0.23.2 loopback 10.0.2.2

R3 serial 4/0/1 10.0.23.3 int gi 0/0/0 10.0.13.3 loopback 10.0.3.3

 

R1

<r1>dis ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 16       Routes : 16       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   Static  60   0          RD   10.0.13.3       GigabitEthernet
0/0/0
       10.0.1.0/24  Direct  0    0           D   10.0.1.1        LoopBack0
       10.0.1.1/32  Direct  0    0           D   127.0.0.1       LoopBack0
     10.0.1.255/32  Direct  0    0           D   127.0.0.1       LoopBack0
       10.0.3.0/24  Static  60   0          RD   10.0.13.0       GigabitEthernet
0/0/0
      10.0.12.0/24  Direct  0    0           D   10.0.12.1       Serial4/0/0
      10.0.12.1/32  Direct  0    0           D   127.0.0.1       Serial4/0/0
      10.0.12.2/32  Direct  0    0           D   10.0.12.2       Serial4/0/0
    10.0.12.255/32  Direct  0    0           D   127.0.0.1       Serial4/0/0
      10.0.13.0/24  Direct  0    0           D   10.0.13.1       GigabitEthernet
0/0/0
      10.0.13.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
    10.0.13.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
      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
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

R2

<r2>dis ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 17       Routes : 17       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       10.0.2.0/24  Direct  0    0           D   10.0.2.2        LoopBack0
       10.0.2.2/32  Direct  0    0           D   127.0.0.1       LoopBack0
     10.0.2.255/32  Direct  0    0           D   127.0.0.1       LoopBack0
       10.0.3.0/24  Static  60   0          RD   10.0.23.3       Serial4/0/1
      10.0.12.0/24  Direct  0    0           D   10.0.12.2       Serial4/0/0
      10.0.12.1/32  Direct  0    0           D   10.0.12.1       Serial4/0/0
      10.0.12.2/32  Direct  0    0           D   127.0.0.1       Serial4/0/0
    10.0.12.255/32  Direct  0    0           D   127.0.0.1       Serial4/0/0
      10.0.13.0/24  Static  60   0          RD   10.0.23.3       Serial4/0/1
      10.0.23.0/24  Direct  0    0           D   10.0.23.2       Serial4/0/1
      10.0.23.2/32  Direct  0    0           D   127.0.0.1       Serial4/0/1
      10.0.23.3/32  Direct  0    0           D   10.0.23.3       Serial4/0/1
    10.0.23.255/32  Direct  0    0           D   127.0.0.1       Serial4/0/1
      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
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

R3

<r3>dis ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 15       Routes : 15       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       10.0.3.0/24  Direct  0    0           D   10.0.3.3        LoopBack0
       10.0.3.3/32  Direct  0    0           D   127.0.0.1       LoopBack0
     10.0.3.255/32  Direct  0    0           D   127.0.0.1       LoopBack0
      10.0.12.0/24  Static  60   0          RD   10.0.13.1       GigabitEthernet
0/0/0
      10.0.13.0/24  Direct  0    0           D   10.0.13.3       GigabitEthernet
0/0/0
      10.0.13.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
    10.0.13.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
      10.0.23.0/24  Direct  0    0           D   10.0.23.3       Serial4/0/1
      10.0.23.2/32  Direct  0    0           D   10.0.23.2       Serial4/0/1
      10.0.23.3/32  Direct  0    0           D   127.0.0.1       Serial4/0/1
    10.0.23.255/32  Direct  0    0           D   127.0.0.1       Serial4/0/1
      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
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

4、最近路徑

5、目前不知,等待以後補充

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章