Cisco简单配置(三)—静态路由

 静态路由(Static routing)是一种路由的方式,由网络管理员手动配置,而非动态决定。与动态路由不同,静态路由是固定的,不会改变,即使网络状况已经改变或是重新被组态。

静态路由的优点: 

使用静态路由的另一个好处是网安全保密性高 ;

不占用网络带宽;

适用于中小型网络

缺点:

配置后修改麻烦,容易出错; 

当网络的拓扑结构和链路状态发生变化时,路由器中的静态路由信息需要大范围地调整,难度和复杂程度非常高;

当网络发生变化或网络发生故障时,不能重选路由,很可能使路由失败

拓扑搭建

配置路由器的接口IP

Router>enable 
Router#configure 
Router(config)#hostname R1
R1(config)#interface gigabitEthernet 0/0
R1(config-if)#ip address 10.10.1.2 255.255.255.0
R1(config-if)#no shutdown 
R1(config-if)#exit
R1(config)#interface gigabitEthernet 0/1
R1(config-if)#ip address 10.10.2.1 255.255.255.0
R1(config-if)#no shutdown 
Router>enable 
Router#configure 
Router(config)#hostname R2
R2(config)#interface gigabitEthernet 0/0
R2(config-if)#ip address 10.10.2.2 255.255.255.0
R2(config-if)#no shutdown 
R2(config-if)#exit
R2(config)#interface gigabitEthernet 0/1
R2(config-if)#ip address 10.10.3.1 255.255.255.0
R2(config-if)#no shutdown 
Router>enable 
Router#configure 
Router(config)#hostname R3
R3(config)#interface gigabitEthernet 0/1
R3(config-if)#ip address 10.10.3.2 255.255.255.0
R3(config-if)#no shutdown 
R3(config-if)#exit
R3(config)#interface gigabitEthernet 0/0
R3(config-if)#ip address 10.10.4.1 255.255.255.0
R3(config-if)#no shutdown 

配置交换机SVI

一般来说,交换机是不需要配置接口IP的,我们这里配置是为了测试;实际应用中,配置接口IP都是为了远程登录交换机

Switch>en
Switch#configure 
Switch(config)#hostname S1
S1(config)#interface vlan 1
S1(config-if)#ip address 10.10.1.1 255.255.255.0
S1(config-if)#no shutdown 
S1(config)#ip default-gateway 10.10.1.2
Switch>en
Switch#configure 
Switch(config)#hostname S2
S2(config)#interface vlan 1
S2(config-if)#ip address 10.10.4.2 255.255.255.0
S2(config-if)#no shutdown 
S2(config-if)#exit
S2(config)#ip default-gateway 10.10.4.1

连通性测试

S1 ping R1

 S2 ping R2

 在我们没配置静态路由之前,S1只能和R1ping通,不能和R2、R3通

 配置静态路由

R1(config)#ip route 10.10.3.0 255.255.255.0 g0/1
R1(config)#ip route 10.10.4.0 255.255.255.0 g0/1

对于R1来说,不知道的网段只有10.10.3.0 和10.10.4.0 ;只要将其加入到自己的路由表,那么R1便知道了其他网段的存在 

查看R1 的路由表 

 可以看见,此时R1 的路由表便有了两条S的路由信息,S表示静态路由

R2(config)#ip route 10.10.1.0 255.255.255.0 g0/0
R2(config)#ip route 10.10.4.0 255.255.255.0 g0/1

 

R3(config)#ip route 10.10.1.0 255.255.255.0 g0/1
R3(config)#ip route 10.10.2.0 255.255.255.0 g0/1

此时连通性

 

 没有问题,已经全部能够Ping通了

 

 

 OK,两台PC 之间也可完成通信了

  • 5
    点赞
  • 56
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值