目录

选取最优路由时的标准

默认路由

表示形式:

作用:

条件:

三层链路聚合:(设备选择CE12800)配置命令

SWC:

SWD:

三层测试

总结


选取最优路由时的标准:

1.子网掩码长度最长的最优先匹配

2.选取路由协议中优先级最小的最优匹配

DIRECT:0

OSPF:10

IS-IS:15

STATIC:60

RIP:100

OSPF ASE:150

OSPF NSSA:150

IBGP:256

EBGP:256

3.相同路由协议的情况下,选取metric值的最优先匹配。每种协议metric值定义的都不同,静态路由和路由优先级有关,这个是人为指定的,RIP协议和跳数有关,跳数越小越优先,OSPF协议和带宽有关,带宽最大最优先。metric是用来判定链路质量优劣的。

4.如果以上都没有路由可以匹配得上,就匹配默认路由。

默认路由

表示形式:

0.0.0.0/0 所有网段

作用:

当路由器在路由表中找不到目标网络的路由条目时,路由器把请求转发到默认路由接口

条件:

必须是末梢/末节网络

ospf metric 设置 ospf的metric_IP

默认路由是静态路由的一种特殊形式,它属于静态路由中的一种,使用它是有条件的,只能在末梢/末节网络中使用.

Ip route-static 0.0.0.0  0.0.0.0  10.1.1.2
出口网关的使用数据是丢给和出口网关对接的运营商路由器的入接口IP
需要配置默认路由
路由器都必备三步:
 < >undo terminal monitor   //关闭弹窗
 < >system-view    //进入系统视图
 [ ]sysname R1     //重命名
 //设置永不超时
 [ ]user-interface console 0
 [ ]idle-timeout 0 0
 路由器R1:
 [ ]int g0/0/0     //进入接口g0/0/0
 [ ]ip add 192.168.1.1 24   //设置IP地址和子网掩码长度
 [ ]undo shutdown       //打开接口
 [ ]int g0/0/1       //进入接口g0/0/1
 [ ]ip add 10.1.1.1 24       //设置IP地址和子网掩码长度
 [ ]undo shutdown      //打开接口
 [ ]ip route-static  0.0.0.0  0.0.0.0  10.1.1.2    //添加默认路由:网段0.0.0.0,子网掩码0.0.0.0,下一跳入接口10.1.1.2
 [ ]display ip routing-table      //查看路由表路由器R2:
 [ ]int g0/0/0     //进入接口g0/0/0
 [ ]ip add 10.1.1.2 24    //设置IP地址和子网掩码长度
 [ ]undo shutdown        //打开接口
 [ ]int g0/0/1      //进入接口g0/0/1
 [ ]ip add 10.1.2.2 24     //设置IP地址和子网掩码长度
 [ ]undo shutdown      //打开接口
 [ ]ip route-static 192.168.1.0  24  10.1.1.1   //添加静态路由:网段为192.168.1.0 子网掩码长度为24,下一跳入接口IP10.1.1.1
 [ ]ip route-static 10.1.3.0  24  10.1.2.3     //添加静态路由:网段为10.1.3.0 子网掩码长度为24,下一跳入接口IP 10.1.2.3
 [ ]ip route-static 172.16.10.0  24  10.1.2.3    //添加静态路由:网段为172.16.10.0 子网掩码长度为24,下一跳入接口IP  10.1.2.3
 [ ]display ip routing-table  //查看路由表路由器R3:
 [ ]int g0/0/0    //进入接口g0/0/0
 [ ]ip add 10.1.2.3 24    //设置IP地址和子网掩码长度
 [ ]undo shutdown        //打开接口
 [ ]int g0/0/1      //进入接口g0/0/1
 [ ]ip add 10.1.3.3 24      //设置IP地址和子网掩码长度
 [ ]undo shutdown     //打开接口
 [ ]ip route-static 192.168.1.0  24  10.1.2.2    //添加静态路由:网段为192.168.1.0 子网掩码长度为24,下一跳入接口IP  10.1.2.2
 [ ]ip route-static 10.1.1.0  24  10.1.2.2      //添加静态路由:网段为10.1.1.0 子网掩码长度为24,下一跳入接口IP  10.1.2.2
 [ ]ip route-static 172.16.10.0   24  10.1.3.4     //添加静态路由:网段为172.16.10.0 子网掩码长度为24,下一跳入接口IP  10.1.3.4
 [ ]display ip routing-table     //查看路由表路由器R4:
 [ ]int g0/0/0    //进入接口g0/0/0
 [ ]ip add 10.1.3.4  24    //设置IP地址和子网掩码长度
 [ ]undo shutdown        //打开接口
 [ ]int g0/0/1      //进入接口g0/0/1
 [ ]ip add  172.16.10.4  24      //设置IP地址和子网掩码长度
 [ ]undo shutdown     //打开接口
 [ ]ip route-static 0.0.0.0  0.0.0.0   10.1.3.3    //添加默认路由:网段0.0.0.0,子网掩码0.0.0.0,下一跳入接口10.1.3.3
 [ ]display ip routing-table     //查看路由表PC1:设置IP地址和子网掩码:192.168.1.100  255.255.255.0  设置网关:192.168.1.1
 PC2:设置IP地址和子网掩码:172.16.10.100  255.255.255.0  设置网关:172.16.10.4
 用PC1去ping网关192.168.1.1
 ping  192.168.1.1
 用PC1去ping PC2的IP地址
 ping  172.16.10.100

三层链路聚合:(设备选择CE12800)配置命令

ospf metric 设置 ospf的metric_静态路由_02

三层交换机CE1:
 [ ]int  eth-trunk 1   //创建eth-trunk  1
 [ ]undo portswitch   //接口开启三层功能
 [ ]ip add 10.1.1.1  24    //给eth-trunk1接口设置ip地址和子网掩码长度
 [ ]int  g1/0/0      //进入g1/0/0接口
 [ ]undo shutdown    // 开启 1/0/0接口
 [ ]eth-trunk 1       //加入eth-trunk 1组
 [ ]int  g1/0/1     //进入 1/01接口
 [ ]undo shutdown    //开启g1/0/1接口
 [ ]eth-trunk      //加入eth-trunk 1组
 [ ]int  g1/0/2     //进入 1/0/2接口
 [ ]undo shutdown    //开启g1/0/2接口
 [ ]eth-trunk      //加入eth-trunk 1组
 [ ]int g1/0/3      //进入g1/0/3接口
 [ ]undo shutdown   //开启g1/0/3接口
 [ ]undo portswitch   //开启三层功能
 [ ]ip add 192.168.1.1  24    //给g1/0/3接口设置IP地址及掩码长度
 [ ]ip route-static 192.168.2.0  24  10.1.1.2  //配置静态路由,目的网段是192.168.2.0掩码长度是24下一跳入接口IP为10.1.1.2三层交换机CE2:
 [ ]int  eth-trunk 1   //创建eth-trunk  1
 [ ]undo portswitch   //接口开启三层功能
 [ ]ip add 10.1.1.2  24   //给eth-trunk1接口设置ip地址和子网掩码长度
 [ ]int  g1/0/0      //进入g1/0/0接口
 [ ]undo shutdown    // 开启 1/0/0接口
 [ ]eth-trunk 1       //加入eth-trunk 1组
 [ ]int  g1/0/1     //进入 1/01接口
 [ ]undo shutdown    //开启g1/0/1接口
 [ ]eth-trunk      //加入eth-trunk 1组
 [ ]int  g1/0/2     //进入 1/0/2接口
 [ ]undo shutdown    //开启g1/0/2接口
 [ ]eth-trunk      //加入eth-trunk 1组
 [ ]int g1/0/3      //进入g1/0/3接口
 [ ]undo shutdown   //开启g1/0/3接口
 [ ]undo portswitch   //开启三层功能
 [ ]ip route-static 192.168.1.0 24 10.1.1.1  //配置静态路由,目的网段是192.168.2.0掩码长度是24下一跳入接口IP为10.1.1.1实验测试
 CE2 ping CE1上的eth-trunk端口IP
 ping 10.1.1.1
 //PC1设置IP地址,子网掩码,网关
 PC1: IP:192.168.1.10 255.255.255.0 192.168.1.1  
 //PC2设置IP地址,子网掩码,网关
 PC2:IP:192.168.2.10 255.255.255.0 192.168.2.1
 用PC1 ping PC2测试能否通信:
 PC1 :ping  192.168.2.10

总结

主要学习静态路由和三层链路聚合,需要掌握三层链路聚合的命令