静态路由默认路由的配置

简介:

静态路由实验

负载均衡的一点是个人理解,有不正确之处欢迎批评指正。             

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       管理距离默认为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#

 

配置完毕。测试全网互联正常。

本文转自  还不算晕  51CTO博客,原文链接:http://blog.51cto.com/haibusuanyun/511035

相关文章
|
6月前
|
算法 网络协议 网络架构
什么情况下适合使用静态路由?什么情况下适合使用动态路由?
什么情况下适合使用静态路由?什么情况下适合使用动态路由?
64 0
|
8月前
|
网络协议 定位技术 网络架构
静态路由与默认路由详解
静态路由与默认路由详解
118 0
|
网络协议 安全 算法
动态主机配置协议(DHCPv4)的无类静态路由选项
IP 协议 [1] 使用路由器将数据包从连接到一个 IP 子网的主机传输到连接到不同 IP 子网的主机。当 IP 主机(源主机)希望将数据包传输到另一台 IP 主机(目的地)时,它会查阅其路由表以确定应该用于将数据包转发到目标主机的路由器的 IP 地址。
215 0
动态主机配置协议(DHCPv4)的无类静态路由选项
|
网络协议 网络架构
RIP动态路由配置 命令| 配置题
RIP动态路由配置 命令| 配置题
RIP动态路由配置 命令| 配置题
|
网络协议 网络架构
路由与交换系列之IPv6与IPv6默认路由与静态路由的配置实验分享
1.理解汇总路由的运作原理。 2. 深刻理解IPv6协议原理。 3.掌握IPv6默认路由的配置方法 4.掌握IPv6静态路由的配置方法
3652 1
路由与交换系列之IPv6与IPv6默认路由与静态路由的配置实验分享
|
网络协议 网络架构
路由与交换系列之简单的路由策略与默认路由汇总路由的运用
路由策略使用不同的匹配条件和匹配模式选择路由和改变路由属性。在特定的场景 中,路由策略的6种过滤器也能单独使用,实现路由过滤。
3647 1
路由与交换系列之简单的路由策略与默认路由汇总路由的运用
|
网络协议 网络架构
IP路由基础、路由器静态路由配置方法、自治系统、缺省路由的配置方法、路由选路规则、缺省路由、备份路由、等价路由、三种查询路由表命令
路由器特点,网络IP地址规划网络间的特性,基本路由思想,编辑静态路由部分,查询设备整个路由表,查看特定的路由协议时使用,查询目的地址2.2.2.2的路由条目,IP路由表代码写法,IP路由表里的信息,路由表来源,路由表的信息,路由表选路规则,缺点:缺省路由,备份路由,等价路由,做实验的步骤......
IP路由基础、路由器静态路由配置方法、自治系统、缺省路由的配置方法、路由选路规则、缺省路由、备份路由、等价路由、三种查询路由表命令
【laravle】在设置路由时注意点
【laravle】在设置路由时注意点
64 0
【laravle】在设置路由时注意点