天天看點

靜态路由預設路由的配置

靜态路由實驗

負載均衡的一點是個人了解,有不正确之處歡迎批評指正。             

R1配置:

s0/0/0口:193.1.1.9/30(本地)   next-hop 193.1.1.10/30  point-to-point link

F0/0設定子接口:F0/0.1 172.17.115.1/24 VLAN1   F0/0.5 172.17.110.1/24 VLAN6

靜态路由配置:

ip route 192.168.1.0 255.255.255.0  193.1.1.10

ip route 192.168.2.0 255.255.255.0  193.1.1.10

ip route 193.1.1.16 255.255.255.252  193.1.1.10

ip route 1.1.1.0 255.255.255.0  193.1.1.10

ip route 10.10.0.0 255.255.0.0  193.1.1.10

S1配置:VLAN 1   ,VLAN 6  F0/10  F0/11 

PC1:172.17.115.11/24

PC2:172.17.110.11/24

R2配置:  DCE

LOOPBACK口:192.168.1.1/24   192.168.2.1/24

s0/0/0口:193.1.1.10/30(本地)   next-hop 193.1.1.9/30  point-to-point link

s0/0/1口:193.1.1.17/30(本地)   next-hop 193.1.1.18/30  point-to-point link

ip route 172.17.115.0 255.255.255.0  193.1.1.9 1/2(管理距離,如有備用路由時)

ip route 172.17.110.0 255.255.255.0  193.1.1.9

ip route 1.1.1.0 255.255.255.0  193.1.1.18  permanent (加此參數,則為靜态路由使用的接口出現故障,仍将把路由儲存在跌幅表中)

ip route 10.10.2.0 255.255.0.0  193.1.1.18

R3配置:預設路由

LOOP口:1.1.1.1/24  

F0/0口:10.10.2.1/16

s0/0/1口:193.1.1.18/30(本地)   next-hop 193.1.1.17/30  point-to-point link

預設路由 ip route 0.0.0.0 0.0.0.0 193.1.1.17

SERVER:10.10.9.61

最終實作全網互聯。

<a href="http://blog.51cto.com/attachment/201103/185037839.jpg" target="_blank"></a>

R1配置:Router&gt;ena

Router#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#int f0/0

Router(config-if)#no shu           需要先把接口啟用

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up

Router(config-if)#int f0/0.1               建立并進入子接口f0/0.1 

%LINK-5-CHANGED: Interface FastEthernet0/0.1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.1, changed state to up        子接口建立即啟動,不需要手動配置。

Router(config-subif)#encapsulation dot1q  1      配置封裝為dot1q。并與VLAN 1相關聯

Router(config-subif)#ip add 172.17.115.1 255.255.255.0   配置子接口IP

Router(config-subif)#int f0/0.5

%LINK-5-CHANGED: Interface FastEthernet0/0.5, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.5, changed state to up

Router(config-subif)#encapsulation dot1q  6

Router(config-subif)#ip add 172.17.110.1 255.255.255.0

Router(config-subif)#exi

Router(config)#int s0/0/0

Router(config-if)#ip add 193.1.1.9 255.255.255.252

Router(config-if)#no shu

%LINK-5-CHANGED: Interface Serial0/0/0, changed state to down

Router(config-if)#exi

Router(config)#ip route 192.168.1.1 255.255.255.0 193.1.1.9

%Inconsistent address and mask     出錯是因為需配置目的網段,非主機位址

Router(config)#ip route 192.168.1.0 255.255.255.0 193.1.1.10 通過下一跳IP193.1.1.10到達192.168.1.0網段的靜态路由。

Router(config)#ip route 192.168.1.0 255.255.255.0 193.1.1.10     2   管理距離預設為1,設定為2即為備用路由。

Router(config)#ip route 192.168.1.0 255.255.255.0 193.1.1.10    1  管理距離預設為1,設定為1或者不設定即實作負載均衡。負載均衡這點是個人了解,靜态路由基于管理距離進行路由。

Router(config)#ip route 192.168.2.0 255.255.255.0 193.1.1.10

Router(config)#ip route 193.1.1.16 255.255.255.252 193.1.1.10

Router(config)#ip route 1.1.1.0 255.255.255.0 193.1.1.10

Router(config)#ip route 10.10.2.0 255.255.255.0 193.1.1.10

Router(config)#exi

%SYS-5-CONFIG_I: Configured from console by console

Router#wr

Building configuration...

[OK]

Router#

S1配置:

Switch(config)#int vlan 1

Switch(config-if)#no shu

%LINK-5-CHANGED: Interface Vlan1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up

Switch(config-if)#exi

Switch(config)#int vlan 6

Switch(config-if)#int vlan 1

Switch(config-if)#ip default-gateway 172.17.115.1

Switch(config)#int f0/10

Switch(config-if)#switchport access vlan 6

%LINK-5-CHANGED: Interface Vlan6, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan6, changed state to up

% Access VLAN does not exist. Creating vlan 6

Switch(config-if)#int f0/11

Switch(config-if)#int f0/24

Switch(config-if)#switchport mode trunk

Switch(config-if)#int f0/2

Switch(config-if)#switchport trunk native vlan 6      本地管理VLAN改為VLAN 6。我并未給VLAN6配置位址。這裡隻是說一下有這個方法可以更改。

Switch(config)#exi

Router(config-if)#ip add 193.1.1.10 255.255.255.252

%LINK-5-CHANGED: Interface Serial0/0/0, changed state to up

Router(config-if)#clock rate 64000      配置時鐘速率為64000做為DCE端   

Router(config)#int s0/0/1

Router(config-if)#ip add 193.1.1.17 255.255.255.252

Router(config-if)#clock rate 64000

%LINK-5-CHANGED: Interface Serial0/0/1, changed state to down

Router(config)#int loopback 1               建立環回接口。預設已啟用

%LINK-5-CHANGED: Interface Loopback1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up

Router(config-if)#ip add 192.168.1.1 255.255.255.0

Router(config-if)#int loopback 2

%LINK-5-CHANGED: Interface Loopback2, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback2, changed state to up

Router(config-if)#ip add 192.168.2.1 255.255.255.0

Router(config)#ip route 172.17.115.0 255.255.255.0 193.1.1.9

Router(config)#ip route 172.17.110.0 255.255.255.0 193.1.1.9

Router(config)#ip route 1.1.1.0 255.255.255.0 193.1.1.18

Router(config)#ip route 10.10.0.0 255.255.0.0 193.1.1.18

Router(config)#int loop 1

Router(config-if)#ip add 1.1.1.1 255.255.255.0

Router(config-if)#int f0/0

Router(config-if)#ip add 10.10.2.1 255.255.0.0

Router(config-if)#int s0/0/1

Router(config-if)#ip add 193.1.1.18 255.255.255.0

%LINK-5-CHANGED: Interface Serial0/0/1, changed state to up

Router(config)#ip route 0.0.0.0 0.0.0.0 193.1.1.17   預設路由:是以流量通過下一跳193.1.1.17發送

配置完畢。測試全網互聯正常。

本文轉自  還不算暈  51CTO部落格,原文連結:http://blog.51cto.com/haibusuanyun/511035

繼續閱讀