思科静态路由配置_思科交换机trunk配置命令

思科静态路由配置_思科交换机trunk配置命令1.配置静态路由路由器可以将不同网段之间的网络连接到一起,当路由器接收到数据包后要查看数据包中的目标IP,再检查自己的路由表,如果路由表中有和目标IP相匹配的路由条目,路由器才能将数据包按照该路由条目所指定的端口转发出去,实现不同网络之间的通信,那么路由器中的路由表是如何实现的呢?配置了路由器接口IP并为UP状态路由表中自动生成直连路由,对于非直连的路由,需通过静态路由管理员手工添加或通过配置动…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE稳定放心使用

1.配置静态路由
路由器可以将不同网段之间的网络连接到一起,当路由器接收到数据包后要查看数据包中的目标IP,再检查自己的路由表,如果路由表中有和目标IP相匹配的路由条目,路由器才能将数据包按照该路由条目所指定的端口转发出去,实现不同网络之间的通信,那么路由器中的路由表是如何实现的呢?配置了路由器接口IP并为UP状态路由表中自动生成直连路由,对于非直连的路由,需通过静态路由管理员手工添加或通过配置动态路自动学习。
配置静态路由

配置浮动静态路由
配置缺省路由
网络环境及IP地址规划
图-1
本例中的配置练习采用思科模拟器 —— Cisco Packet Tracer 6.0,Route采用2621路由器实现。
实现此案例需要按照如下步骤进行。

在这里插入图片描述

R1上配置接口IP

> R1(config)#interface fastEthernet 0/0 R1(config-if)#ip address 192.168.1.254 255.255.255.0 
> R1(config-if)#no shutdown  
> R1(config-if)#exit 
> R1(config)#interface fastEthernet 0/1
> R1(config-if)#ip address 192.168.2.1 255.255.255.0 
> R1(config-if)#no shutdown

R2上配置接口IP

> R2(config)#interface fastEthernet 0/1 R2(config-if)#ip address192.168.2.2 255.255.255.0 
> R2(config-if)#no shutdown 
>  R2config-if)#exit 
>  R2(config)#interface fastEthernet 0/0 R2(config-if)#ip addres 192.168.3.254 255.255.255.0 
>  R2(config-if)#no shutdown

R1上添加静态路由

> R1(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.2

R1上查看路由表

> R1#show ip route  Codes:
>  C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
>        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
>        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
>        E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
>        i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
>        * - candidate default, U - per-user static route, o - ODR
>        P - periodic downloaded static route Gateway of last resort is not set
>         C    192.168.1.0/24 is directly connected, FastEthernet0/0 
>        C 192.168.2.0/24 is directly connected, FastEthernet0/1 
>        S    192.168.3.0/24 [1/0] via 192.168.2.2 //S表示静态路由

R2上添加静态路由

> R2(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1

R2上查看路由条目

> R2#show ip route  Codes: C - connected, S - static, I - IGRP, R - RIP,
> M - mobile, B - BGP
>        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
>        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
>        E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
>        i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
>        * - candidate default, U - per-user static route, o - ODR
>        P - periodic downloaded static route Gateway of last resort is not set
 S    192.168.1.0/24 [1/0] via 192.168.2.1          //S表示静态路由 
 C    192.168.2.0/24 is directly connected, FastEthernet0/1 
 C      192.168.3.0/24 is directly connected, FastEthernet0/0

配置PC1的IP地址为192.168.1.1,网关为192.168.1.254
配置PC2的IP地址为192.168.3.1,网关为192.168.3.254

测试网络连通性,PC1 ping 192.168.3.1

> PC>ping 192.168.3.1
 Pinging 192.168.3.1 with 32 bytes of data: 
 Reply from 192.168.3.1: bytes=32 time=1ms TTL=126 
 Reply from 192.168.3.1:bytes=32 time=11ms TTL=126 
 Reply from 192.168.3.1: bytes=32 time=10msTTL=126 
 Reply from 192.168.3.1: bytes=32 time=11ms TTL=126 
> Ping statistics for 192.168.3.1:
>     Packets: Sent = 4, Received = 4, Lost = 0 (0% loss)
>  Approximate round trip times in milli-seconds:
>     Minimum = 1ms, Maximum = 11ms, Average = 8ms

配置浮动静态路由
1)在以上静态路由实验的基础上,先分别进入R1与R2的特权模式输入write命令保存配置信息,然后分别进入R1与R2的物理配置界面,点击开关按钮关闭路由器,添加NM-1FE-TX模块并再次点击开关按钮,

2)添加模块后将R1的F1/0接口连接到R2的F1/0接口修改拓扑
在这里插入图片描述

3 配置R1的F1/0接口IP

> R1(config)#interface fastEthernet 1/0 R1(config-if)#ip address 192.168.4.1 255.255.255.0 
> R1(config-if)#no shutdown

4 配置R2的F1/0接口IP

> R2(config)#interface fastEthernet 1/0 R2(config-if)#ip address 192.168.4.2 255.255.255.0
>  R2(config-if)#no shutdown

5 R1上添加静态浮动路由

> R1(config)#ip route 192.168.3.0 255.255.255.0 192.168.4.2 50  

6 R2上添加静态浮动路由

> R2(config)#ip route 192.168.1.0 255.255.255.0 192.168.4.1 50

7 R1上查看路由表

> R1#show ip route  Codes: C - connected, S - static, I - IGRP, R - RIP,
> M - mobile, B - BGP
>        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
>        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
>        E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
>        i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
>        * - candidate default, U - per-user static route, o - ODR
>        P - periodic downloaded static route Gateway of last resort is not set C   
>         192.168.1.0/24 is directly connected, FastEthernet0/0 C  
> 192.168.2.0/24 is directly connected, FastEthernet0/1 S  
> 192.168.3.0/24 [1/0] via 192.168.2.2 C   
> 192.168.4.0/24 is directly connected, FastEthernet1/0
> R1#show ip rou
>  R1#show ip route 
>  Codes: C - connected, S - static, I -
> IGRP, R - RIP, M - mobile, B - BGP
>        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
>        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
>        E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
>        i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
>        * - candidate default, U - per-user static route, o - ODR
>        P - periodic downloaded static route Gateway of last resort is not set C    
>        192.168.1.0/24 is directly connected, FastEthernet0/0 C  
> 192.168.2.0/24 is directly connected, FastEthernet0/1 S  
>   192.168.3.0/24 [1/0] via 192.168.2.2  //只有下一跳为192.168.2.2的静态路由 C    
>   192.168.4.0/24 is directly connected, FastEthernet1/0

8 禁用F/01接口

> R1(config)#interface fastEthernet 0/1
>  R1(config-if)#shutdown

9 R1上查看路由表

> C    192.168.1.0/24 is directly connected, FastEthernet0/0   
>  S   192.168.3.0/24 [50/0] via 192.168.4.2//下一跳接口为192.168.4.2的路由生效 
>  C   192.168.4.0/24 is directly connected, FastEthernet1/0

10 测试网络连通性,PC1 ping 192.168.3.1

> PC>ping 192.168.3.1  
>  Pinging 192.168.3.1 with 32 bytes of data: 
>  Reply from 192.168.3.1: bytes=32 time=0ms TTL=126
>   Reply from 192.168.3.1: bytes=32 time=10ms TTL=126
>    Reply from 192.168.3.1: bytes=32 time=11ms TTL=126 
>    Reply from 192.168.3.1: bytes=32 time=1ms TTL=126 
>    Ping statistics for 192.168.3.1:
>     Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
>      Approximate round trip times in milli-seconds:
>     Minimum = 0ms, Maximum = 11ms, Average = 5ms

配置缺省路由
1 网络环境及IP地址规划,如图-4所示
在这里插入图片描述

2 R1上配置接口IP

> Router(config)#interface fastEthernet 0/0 
> R1(config-if)#ip address192.168.1.254 255.255.255.0 
> R1(config-if)#no shutdown  
> R1(config-if)#exit 
> R1(config)#interface fastEthernet 0/1
> R1(config-if)#ip address 192.168.2.1 255.255.255.0 
> R1(config-if)#no shutdown

3 R2上配置接口IP

> R2(config)#interface f0/1 
> R2(config-if)#ip address 192.168.2.2 255.255.255.0 
> R2(config-if)#no shutdown  
> R2(config-if)#exit 
> R2(config)#interface fastEthernet 0/0 
> R2(config-if)#ip addres 192.168.3.1 255.255.255.0 
> R2(config-if)#no shutdown

4 R3上配置接口IP

R3(config)#interface fastEthernet 0/1
R3(config-if)#ip address 192.168.3.2 255.255.255.0
R3(config-if)#no shutdown 
R3(config-if)#exit
R3(config)#interface fastEthernet 0/0
R3(config-if)#ip address 192.168.4.254 255.255.255.0
R3(config-if)#no shutdown

5 R1、R2、R3上分别添加静态路由

R1(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.2
R1(config)#ip route 192.168.4.0 255.255.255.0 192.168.2.2
R2(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1
R2(config)#ip route 192.168.4.0 255.255.255.0 192.168.3.2
R3(config)#ip route 192.168.1.0 255.255.255.0 192.168.3.1
R3(config)#ip route 192.168.2.0 255.255.255.0 192.168.3.1

6 R1上查看路由表

R1#show ip route 
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route
Gateway of last resort is not set
C    192.168.1.0/24 is directly connected, FastEthernet0/0
C    192.168.2.0/24 is directly connected, FastEthernet0/1
S    192.168.3.0/24 [1/0] via 192.168.2.2    //静态路由
S    192.168.4.0/24 [1/0] via 192.168.2.2    //静态路由

7 R2上查看路由表

R2#show ip route 
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route
Gateway of last resort is not set
S    192.168.1.0/24 [1/0] via 192.168.2.1    //静态路由
C    192.168.2.0/24 is directly connected, FastEthernet0/1
C    192.168.3.0/24 is directly connected, FastEthernet0/0
S    192.168.4.0/24 [1/0] via 192.168.3.2    //静态路由

8 R3上查看路由表

R3#show ip route 
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route
Gateway of last resort is not set
S    192.168.1.0/24 [1/0] via 192.168.3.1    //静态路由
S    192.168.2.0/24 [1/0] via 192.168.3.1    //静态路由
C    192.168.3.0/24 is directly connected, FastEthernet0/1
C    192.168.4.0/24 is directly connected, FastEthernet0/0

9 配置PC的IP地址

这个配置不用命令只需要自己点开电脑软件里的pc机直接配置就好

10 测试网络连通性,PC1 ping 192.168.2.2、192.168.3.1、192.168.3.2、192.168.4.1
PC>ping ping 192.168.2.2、192.168.3.1、192.168.3.2、192.168.4.1 以此类推ping下去如果都是以下命令就都通了

Reply from 192.168.2.2: bytes=32 time=0ms TTL=254

11 R1、R3取消静态路由

R1(config)#no ip route 192.168.3.0 255.255.255.0 192.168.2.2
R1(config)#no ip route 192.168.4.0 255.255.255.0 192.168.2.2
R3(config)#no ip route 192.168.1.0 255.255.255.0 192.168.3.1
R3(config)#no ip route 192.168.2.0 255.255.255.0 192.168.3.1

12 R1、R3添加默认路由

R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.2.2
R3(config)#ip route 0.0.0.0 0.0.0.0 192.168.3.1

13 最后分别查看一下R1的路由表和R3的路由表、在测试一下网络连通性没有问题就可以了

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/189866.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • Dreamweaver 2020 安装教程

    Dreamweaver 2020 安装教程AdobeDreamweaver,简称“DW”,中文名称”梦想编织者”,是集网页制作和管理网站于一身的所见即所得网页代码编辑器。利用对HTML、CSS、JavaScript等内容的支持,设计人员和开发人员可以在几乎任何地方快速制作和进行网站建设。它第一套针对专业网页设计师特别发展的视觉化网页开发工具,利用它可以轻而易举地制作出跨越平台限制和跨越浏览器限制的充满动感的网页。受众人群:网页设计师,UI设计师,电商美工,学生及业余爱好者1、所见即所得的强大功能没有一个Web编辑软件能像Dream

    2022年5月29日
    38
  • kettle python_Kettle入门教程

    kettle python_Kettle入门教程最近做的项目用到了ETL工具Kettle,这个工具相当好用,可以将各种类型数据作为数据流,经过处理后再生成各种类型的数据。正如其名“水壶”,将各个地方的水倒进水壶里,再用水壶倒入不同的容器。不过一来初学乍用,二来对此任务不是很感兴趣,研究的不是很深入,可能是以一种不科学的方法使用的,但观教程,常用的内容似乎也涉及到了,并且Y大说过,要善于总结,于是有了这篇,作为入门说明吧。一、下载与安装官网地址大…

    2022年5月23日
    46
  • amos路径分析结果怎么看_路径分析图怎么解读

    amos路径分析结果怎么看_路径分析图怎么解读基础准备草堂君在前面几篇文章中,介绍了AMOS软件的操作、分析原理、结构方程模型和各种拟合指标含义等内容,大家可以点击下面的文章链接回顾,也可以从公众号导航栏获取AMOS分析技术(导航页)回顾:AMOS分析技术:软件安装及菜单功能介绍;这次是视频教程AMOS分析技术:结构方程模型的拟合度评价指标AMOS分析技术:模型整体拟合度指标AMOS分析

    2022年8月24日
    9
  • 用new创建数组

    用new创建数组用new创建数组用new创建数组的优势由于new创建的对象是在运行时确立的,所以有着具体情况具体分析的优点,那么什么叫做具体情况具体分析呢?我觉得c++primerplus的一个例子十分贴切——比如你在度假,已经做好每天的参观计划,可突然有一天天气不好或你心情不好,此时你就不想参观了,如果此时是在编译状态,系统是不允许的,你必须按照计划去参观,但运行时状态,系统是允许的,此时你就可以呆在酒店尽情的玩耍了。用new创建数组也有此优点,即数组长度可以根据情况而定。比如说创建10个元素的数组,可以如下代

    2022年5月15日
    35
  • navicat15激活码最新【在线注册码/序列号/破解码】

    navicat15激活码最新【在线注册码/序列号/破解码】,https://javaforall.net/100143.html。详细ieda激活码不妨到全栈程序员必看教程网一起来了解一下吧!

    2022年3月20日
    119
  • 推荐安卓开发神器(里面有各种UI特效和实例)

    推荐安卓开发神器(里面有各种UI特效和实例)

    2021年8月31日
    49

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号