静态路由实验
负载均衡的一点是个人理解,有不正确之处欢迎批评指正。
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
最终实现全网互联。
R1配置:Router>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)#no shu
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)#switchport access vlan 6
Switch(config-if)#int f0/24
Switch(config-if)#switchport mode trunk
Switch(config-if)#int f0/2
Switch(config-if)#switchport mode trunk
Switch(config-if)#switchport trunk native vlan 6 本地管理VLAN改为VLAN 6。我并未给VLAN6配置地址。这里只是说一下有这个方法可以更改。
Switch(config-if)#exi
Switch(config)#exi
R2配置: DCE
Router(config)#int s0/0/0
Router(config-if)#ip add 193.1.1.10 255.255.255.252
Router(config-if)#no shu
%LINK-5-CHANGED: Interface Serial0/0/0, changed state to up
Router(config-if)#clock rate 64000 配置时钟速率为64000做为DCE端
Router(config-if)#exi
Router(config)#exi
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
Router(config-if)#no shu
%LINK-5-CHANGED: Interface Serial0/0/1, changed state to down
Router(config-if)#exi
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-if)#exi
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)#exi
%SYS-5-CONFIG_I: Configured from console by console
Router#wr
Building configuration...
[OK]
Router#
R3配置:默认路由
Router(config)#int loop 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 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)#no shu
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
Router(config-if)#int s0/0/1
Router(config-if)#ip add 193.1.1.18 255.255.255.0
Router(config-if)#no shu
%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发送
Router(config)#exi
%SYS-5-CONFIG_I: Configured from console by console
Router#wr
Building configuration...
[OK]
Router#
配置完毕。测试全网互联正常。
本文出自 “还不算晕” 博客,请务必保留此出处http://haibusuanyun.blog.51cto.com/2701158/511035
标签:静态,ip,route,默认,193.1,255.255,Router,config,路由 From: https://blog.51cto.com/u_1652968/6087829