TCP/IP_第八章_静态路由_实验案例二

实验案例二:配置静态路由实现路由选路

1、实验环境

如图8.11所示,三台路由器R1, R2,R3两两互连。R2上配置了Loopback地址192.168.20 .1/24,模拟192.168.20.0/24网段;R3上配置了两个Loopback地址192.168.10.1/24、192.168 .30.1/24.分别用来模拟192.168.10.0/24和192.168.30.0/24网段。

2、需求描述

需要实现当192.168.20.0/24访问192.168.30.0/24时,数据从R2到R3,而当192.168.20.0/24访问192.168.10.0/24时,数据从R2经过R1再到R3,返回的路由都从R3到R2,

3、推荐步骤

步骤1:在R2上配置到192.168.30.0/24的静态路由。

步骤2:在R2上配置到192.168.10.0/24的静态路由,在R1上也应该配置到192.168.10.0/24的静态路由。

步骤3:在 R3上配置回程的静态路由。

4、实验步骤

(1)路由器R1上的基础配置

复制代码
R1(config)#interface gigabitEthernet 0/3/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shutdown 
R1(config-if)#exit
R1(config)#interface gigabitEthernet 0/2/0
R1(config-if)#ip address 192.168.2.1 255.255.255.0
R1(config-if)#no shutdown 
R1(config-if)#exit

(2)路由器R2上的基础配置

复制代码
R2(config)#interface gigabitEthernet 0/3/0
R2(config-if)#ip address 192.168.1.2 255.255.255.0
R2(config-if)#no shutdown 
R2(config-if)#exit
R2(config)#interface gigabitEthernet 0/2/0
R2(config-if)#ip address 192.168.3.2 255.255.255.0
R2(config-if)#no shutdown 
R2(config-if)#exit
R2(config)#interface gigabitEthernet 0/0
R2(config-if)#ip address 192.168.20.254 255.255.255.0
R2(config-if)#no shutdown 
R2(config-if)#exit

(3)路由器R3上的基础配置

复制代码
R3(config)#interface gigabitEthernet 0/3/0
R3(config-if)#ip address 192.168.2.3 255.255.255.0
R3(config-if)#no shutdown 
R3(config-if)#exit
R3(config)#interface gigabitEthernet 0/2/0
R3(config-if)#ip address 192.168.3.3 255.255.255.0
R3(config-if)#no shutdown 
R3(config-if)#exit
R3(config)#interface gigabitEthernet 0/0
R3(config-if)#ip address 192.168.10.254 255.255.255.0
R3(config-if)#no shutdown 
R3(config-if)#exit
R3(config)#interface gigabitEthernet 0/1
R3(config-if)#ip address 192.168.30.254 255.255.255.0
R3(config-if)#no shutdown 
R3(config-if)#exit

(4)各路由器上配置静态路由

复制代码
##R1上的静态路由配置
R1(config)#ip route 192.168.20.0 255.255.255.0 192.168.1.2
R1(config)#ip route 192.168.10.0 255.255.255.0 192.168.2.3

##R2上的静态路由配置
R2(config)#ip route 192.168.10.0 255.255.255.0 192.168.1.1
R2(config)#ip route 192.168.30.0 255.255.255.0 192.168.3.3

##R3上的静态路由配置
R3(config)#ip route 192.168.20.0 255.255.255.0 192.168.3.2

5、实验调试

(1)查看各路由器上的静态路由条目

复制代码
##R1上的静态路由条目
R1#show ip route static 
S    192.168.10.0/24 [1/0] via 192.168.2.3
S    192.168.20.0/24 [1/0] via 192.168.1.2

##R2上的静态路由条目
R2#show ip route static 
S    192.168.10.0/24 [1/0] via 192.168.1.1
S    192.168.30.0/24 [1/0] via 192.168.3.3

##R3上的静态路由条目
R3#show ip route static 
S    192.168.20.0/24 [1/0] via 192.168.3.2

(2)ping测试结果

观察PC1到PC2的流量方向

pc1topc2

观察PC1到PC3的流量方向

pc1topc3

(3)分析结果

  1. 路由器根据路由表能够将数据包转发到正确的目的地。
  2. 路由器在转发过程中选择最佳路径。
  3. 静态路由需要管理员手工配置。
  4. 静态路由是单向的。
相关推荐
qq_1715388540 分钟前
TCP/IP协议精解:IP协议——互联网世界的邮政编码系统
网络·网络协议·tcp/ip
珹洺1 小时前
计算机网络:(七)网络层(上)网络层中重要的概念与网际协议 IP
网络·tcp/ip·计算机网络
小皮侠1 小时前
nginx的使用
java·运维·服务器·前端·git·nginx·github
兮动人1 小时前
获取终端外网IP地址
java·网络·网络协议·tcp/ip·获取终端外网ip地址
怦然星动_2 小时前
eNSP中实现vlan间路由通信(路由器)
网络·智能路由器
ddfa12343 小时前
XML 笔记
xml·服务器
海外空间恒创科技3 小时前
一台香港原生ip站群服务器多少钱?
服务器·网络协议·tcp/ip
Charlene Fung3 小时前
vs code远程自动登录服务器,无需手动输入密码的终极方案(windows版)
运维·服务器·vscode·ssh
碣石潇湘无限路3 小时前
【部署与总结】从本地运行到公网服务器的全过程
运维·服务器
linux修理工4 小时前
ipmitool 使用简介(ipmitool sel list & ipmitool sensor list)
运维·服务器