⑶配置12-16_RIP_BFD_OSPF_IS-IS_BGP
※配置12.RIPv2
[R2]interface g0/0/0
[R2-GigabitEthernet0/0/0]ip address 12.0.0.1 8
[R2-GigabitEthernet0/0/0]quit
[R2]interface loopback 0
[R2-LoopBack0]ip address 172.16.0.1 24 环回口必须指定具体地址
[R2-LoopBack0]interface loopback 1
[R2-LoopBack1]ip address 172.16.1.1 24
[R2-LoopBack1]interface loopback 2
[R2-LoopBack2]ip address 172.16.2.1 24
[R2-LoopBack2]interface loopback 3
[R2-LoopBack3]ip address 172.16.3.1 24
[R2-LoopBack3]quit
[R2]rip 1 启用RIP协议,进程号1 #RIP可以创建多个进程
[R2-rip-1]version 2 指定RIP版本号为2 /'vɝʒn/版本 #Specify RIP version /'spɛsɪfaɪ/指定
[R2-rip-1]network 12.0.0.0 开始宣告直连网段,不能接子网掩码
[R2-rip-1]network 172.16.1.0
Error: The network address is invalid, and the specified address must be major-n
et address without any subnets. 宣告网段只能宣告有类路由
[R2-rip-1]network 172.16.0.0
[R2-rip-1]silent-interface g0/0/1 将g0/0/1设置为被动借口/安静接口
[R2-rip-1]display this 显示本RIP进程宣告了哪些直连网段
[V200R003C00]
#
rip 1
version 2
network 12.0.0.0
network 172.16.0.0
#
[R3]interface g0/0/0
[R3-GigabitEthernet0/0/0]ip address 23.0.0.1 8
[R3-GigabitEthernet0/0/0]quit
[R3]interface loopback 0
[R3-LoopBack0]ip address 192.168.0.1 24
[R3-LoopBack0]interface loopback 1
[R3-LoopBack1]ip address 192.168.1.1 24
[R3-LoopBack1]interface loopback 2
[R3-LoopBack2]ip address 192.168.2.1 24
[R3-LoopBack2]interface loopback 3
[R3-LoopBack3]ip address 192.168.3.1 24
[R3-LoopBack3]quit
[R2]rip 1
[R3-rip-1]version 2
[R3-rip-1]network 23.0.0.0
[R3-rip-1]network 192.168.0.0
[R3-rip-1]network 192.168.1.0
[R3-rip-1]network 192.168.2.0
[R3-rip-1]network 192.168.3.0
[R3-rip-1]display this 显示本RIP进程宣告了哪些直连网段
[V200R003C00]
#
rip 1
version 2
network 192.168.0.0
network 192.168.1.0
network 192.168.2.0
network 192.168.3.0
network 23.0.0.0
#
[R3]display ip routing-table protocol rip 显示学到了哪些非直连的RIP网段信息
Destination/Mask Proto Pre Cost Flags NextHop Interface
12.0.0.0/8 RIP 100 1 D 23.0.0.2 GigabitEthernet 0/0/0
172.16.0.0/24 RIP 100 2 D 23.0.0.2 GigabitEthernet 0/0/0
172.16.1.0/24 RIP 100 2 D 23.0.0.2 GigabitEthernet 0/0/0
172.16.2.0/24 RIP 100 2 D 23.0.0.2 GigabitEthernet 0/0/0
172.16.3.0/24 RIP 100 2 D 23.0.0.2 GigabitEthernet 0/0/0
[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]ip address 12.0.0.2 8
[R1-GigabitEthernet0/0/0]interface g0/0/1
[R1-GigabitEthernet0/0/1]ip address 23.0.0.2 8
[R1-GigabitEthernet0/0/1]quit
[R1]rip 1
[R1-rip-1]version 2
[R1-rip-1]network 12.0.0.0
[R1-rip-1]network 23.0.0.0
[R1-rip-1]display this 显示本RIP进程宣告了哪些直连网段
[V200R003C00]
#
rip 1
version 2
network 12.0.0.0
network 23.0.0.0
#
注:
配置RIPv2目的,因为用得少,一些厂家删除了这个协议
- 减少初始配置工作量
- 避免配置错误引起的环路
- 避免因路由拓补变化,整体需要修改的维护工作量
- 必须宣告直连的网段
- RIP1和2版本宣告网段时,只能按照有类进行宣告!后面不能接子网掩码,
- 路由器若设置RIP版本为1,路由更新时将不带子网掩码,在无类地址面前识别不了其掩码,会导致路由有找不到目标的可能;版本2路由更新时自带掩码,可以避免这种情况!
#针对只需要接收而不需要发出RIP更新信息的接口,例如连接的是实际的终端,可以设置为被动接口
[R2-rip-1]silent-interface +接口名称 设置为安静接口
※配置13.BFD联动
BFD : Bidirectional Forwarding Detection 双向转发检测机制 /,baɪdə'rɛkʃənl/双向 /'fɔːwədɪŋ/转发 /dɪ'tɛkʃən/检测,
[R1]interface g0/0/1
[R1-GigabitEthernet0/0/1]ip address 192.168.1.2 24
[R1-GigabitEthernet0/0/1]interface g0/0/2
[R1-GigabitEthernet0/0/2]ip address 192.168.2.2 24
[R1-GigabitEthernet0/0/2]quit
[R1]rip
[R1-rip-1]version 2
[R1-rip-1]network 192.168.1.0
[R1-rip-1]network 192.168.2.0
[R1-rip-1]undo summary 关闭自动汇总
[R1-rip-1]quit
[R1]bfd 系统模式下启用双向转发检测机制
[R1-bfd]quit 重回系统模式
[R1]rip 1 进入RIP1
[R1-rip-1]bfd all-interfaces enable RIP1所有接口启用双向转发检测机制
[R1-rip-1]bfd all-interfaces min-rx-interval 100 min-tx-interval 100 detect-multiplier 10 所有接口BFD配置为:100ms收一次,100ms发一次,10次收不到(100ms*10)算挂了,重新收敛 #/'ɪntɚvl/间隔 [myltiplie](数)乘,使倍增
[R1-rip-1]quit
[R2]interface g0/0/2
[R2-GigabitEthernet0/0/2]ip address 192.168.1.1 24
[R2-GigabitEthernet0/0/2]interface g0/0/0
[R2-GigabitEthernet0/0/0]ip address 172.16.1.1 24
[R2-GigabitEthernet0/0/0]interface g0/0/1
[R2-GigabitEthernet0/0/1]ip address 192.168.3.1 24
[R2-GigabitEthernet0/0/1]quit
[R2]rip 1
[R2-rip-1]version 2
[R2-rip-1]network 192.168.1.0
[R2-rip-1]network 192.168.3.0
[R2-rip-1]network 172.16.0.0
[R2-rip-1]undo summary
[R2-rip-1]quit
[R2]bfd
[R2-bfd]quit
[R2]rip 1
[R2-rip-1]bfd all-interfaces enable
[R3]interface g0/0/2
[R3-GigabitEthernet0/0/2]ip address 172.16.1.2 24
[R3-GigabitEthernet0/0/2]quit
[R3]rip 1
[R3-rip-1]version 2
[R3-rip-1]network 172.16.0.0
[R3-rip-1]undo summary
[R3-rip-1]quit
[R4]interface g0/0/1
[R4-GigabitEthernet0/0/1]ip address 192.168.2.1 24
[R4-GigabitEthernet0/0/1]interface g0/0/2
[R4-GigabitEthernet0/0/2]ip address 192.168.3.2 24
[R4-GigabitEthernet0/0/2]quit
[R4]rip 1
[R4-rip-1]version 2
[R4-rip-1]network 192.168.2.0
[R4-rip-1]network 192.168.3.0
[R4-rip-1]undo summary
[R4-rip-1]quit
补充,查询命令
<R1>display rip 1 neighbor 显示R1 RIP1 邻居关系及路由表
※配置14.OSPF
[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]ip address 11.0.0.2 8
[R1-GigabitEthernet0/0/0]interface g0/0/1
[R1-GigabitEthernet0/0/1]ip address 13.0.0.2 8
[R1-GigabitEthernet0/0/1]interface loopback 0
[R1-LoopBack0]ip address 10.0.0.1 8
[R1-LoopBack0]interface loopback 1
[R1-LoopBack1]ip address 3.0.0.1
[R1-LoopBack1]quit
[R1]ospf 1 router-id 1.1.1.1 开启ospf,进程号1,路由身份号1.1.1.1 (id=identity /aɪ'dɛntəti/身份证)
[R1-ospf-1]area 1 进区域1,准备宣告
[R1-ospf-1-area-0.0.0.1]network 10.0.0.0 0.255.255.255 宣告,加通配符
[R1-ospf-1-area-0.0.0.1]network 3.0.0.0 0.255.255.255
[R1-ospf-1-area-0.0.0.1]area 0
[R1-ospf-1-area-0.0.0.0]network 11.0.0.0 0.255.255.255
[R1-ospf-1-area-0.0.0.0]network 13.0.0.0 0.255.255.255
[R1-ospf-1-area-0.0.0.0]quit
[R1]
[R2]interface g0/0/0
[R2-GigabitEthernet0/0/0]ip address 11.0.0.1 8
[R2-GigabitEthernet0/0/0]interface g0/0/1
[R2-GigabitEthernet0/0/1]ip address 12.0.0.1 8
[R2-GigabitEthernet0/0/1]interface loopback 0
[R2-LoopBack0]ip address 192.168.1.1 24
[R2-LoopBack0]interface loopback 1
[R2-LoopBack1]ip address 1.0.0.1 8
[R2-LoopBack1]quit
[R2]ospf 1 router-id 2.2.2.2 开启ospf,进程号1,路由身份号2.2.2.2
[R2-ospf-1]area 2 进区域2,准备宣告
[R2-ospf-1-area-0.0.0.2]network 192.168.1.0 0.0.0.255
[R2-ospf-1-area-0.0.0.2]network 1.0.0.0 0.255.255.255
[R2-ospf-1-area-0.0.0.2]area 0 进区域0,准备宣告
[R2-ospf-1-area-0.0.0.0]network 11.0.0.0 0.255.255.255
[R2-ospf-1-area-0.0.0.0]network 12.0.0.0 0.255.255.255
[R2-ospf-1-area-0.0.0.0]quit
[R2]
[R3]interface g0/0/0
[R3-GigabitEthernet0/0/0]ip address 12.0.0.2 8
[R3-GigabitEthernet0/0/0]interface g0/0/1
[R3-GigabitEthernet0/0/1]ip address 13.0.0.1 8
[R3-GigabitEthernet0/0/1]interface loopback 0
[R3-LoopBack0]ip address 172.16.0.1 16
[R3-LoopBack0]interface loopback 1
[R3-LoopBack1]ip address 2.0.0.1 8
[R3-LoopBack1]quit
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 3
[R3-ospf-1-area-0.0.0.3]network 172.16.0.0 0.0.255.255
[R3-ospf-1-area-0.0.0.3]network 2.0.0.0 0.255.255.255
[R3-ospf-1-area-0.0.0.3]area 0
[R3-ospf-1-area-0.0.0.0]network 12.0.0.0 0.255.255.255
[R3-ospf-1-area-0.0.0.0]network 13.0.0.0 0.255.255.255
[R3-ospf-1-area-0.0.0.0]quit
[R3]
注:
- 一定要先配置好各接口地址,在网络可达情况下,才能实现OSPF
- 需要路由各网卡ip所属网段的掩码与宣告网段反掩码(通配符)保持一致,防止不通(直播中该实验配得不一致,发现不了ospf邻居display ospf peer)
- #删除ospf配置,命令undo ospf 1
※配置15.IS-IS
[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]ip add 172.16.30.2 24
[R1-GigabitEthernet0/0/0]quit
[R1]isis 1 看下面注释↓
[R1-isis-1]is-level level-1
[R1-isis-1]network-entity 10.0000.0000.0000.0001.00
[R1-isis-1]interface g0/0/0
[R1-GigabitEthernet0/0/0]isis enable 1
[R2]interface g0/0/0
[R2-GigabitEthernet0/0/0]ip address 172.16.10.2 24
[R2-GigabitEthernet0/0/0]quit
[R2]isis 1
[R2-isis-1]is-level level-1
[R2-isis-1]network-entity 10.0000.0000.0000.0002.00
[R2-isis-1]interface g0/0/0
[R2-GigabitEthernet0/0/0]isis enable 1
[R3]interface g0/0/0
[R3-GigabitEthernet0/0/0]ip address 172.16.30.1 24
[R3-GigabitEthernet0/0/0]interface g0/0/1
[R3-GigabitEthernet0/0/1]ip address 172.16.10.1 24
[R3-GigabitEthernet0/0/1]interface g0/0/2
[R3-GigabitEthernet0/0/2]ip address 59.74.112.1 24
[R3-GigabitEthernet0/0/2]quit
[R3]isis 1 启用isis,进程号1
[R3-isis-1]is-level level-1-2 定义路由器类型,L1-非核心路由/L2-核心路由/L1-2边界路由
[R3-isis-1]network-entity 10.0000.0000.0000.0003.00 看下面注释↓
[R3-isis-1]interface g0/0/0 必须进接口开启isis
[R3-GigabitEthernet0/0/0]isis enable 1 接口开启isis1
[R3-GigabitEthernet0/0/0]interface g0/0/1 进接口开启isis
[R3-GigabitEthernet0/0/1]isis enable 1 接口开启isis
[R3-GigabitEthernet0/0/1]interface g0/0/2 进接口开启isis
[R3-GigabitEthernet0/0/2]isis enable 1 接口开启isis,必须一个个接口开启isis
[R4]interface g0/0/0
[R4-GigabitEthernet0/0/0]ip address 59.74.112.2 24
[R4-GigabitEthernet0/0/0]interface loopback 0
[R4-LoopBack0]ip address 172.15.60.1 24
[R4-LoopBack0]quit
[R4]isis 1
[R4-isis-1]is-level level-2
[R4-isis-1]network-entity 20.0000.0000.0000.0004.00
[R4-isis-1]interface g0/0/0
[R4-GigabitEthernet0/0/0]isis enable 1
注:
- network-entity 10.0000.0000.0000.0003.00 定义网络实体名中: 区域号.系统ID.系统选择符(IP网络必须为00) #/'ɛntəti/实体
- 查询命令
- <R1>display isis lsdb 查看isis链路状态数据库
LSPID Seq Num Checksum Holdtime Length ATT/P/OL
-------------------------------------------------------------------------------
0000.0000.0001.00-00* 0x00000004 0x4d51 578 70 0/0/0
0000.0000.0001.01-00* 0x00000002 0xcfbb 578 55 0/0/0
0000.0000.0002.00-00 0x00000005 0xfaa 728 70 1/0/0
0000.0000.0002.01-00 0x00000002 0xdaac 728 55 0/0/0
0000.0000.0003.00-00 0x00000009 0xc879 1093 113 1/0/0
2. <R1>display isis route 查看isis路由表
IPV4 Destination IntCost ExtCost ExitInterface NextHop Flags
-------------------------------------------------------------------------------
0.0.0.0/0 10 NULL GE0/0/0 172.16.30.1 A/-/-/-
59.74.112.0/24 20 NULL GE0/0/0 172.16.30.1 A/-/-/-
172.16.30.0/24 10 NULL GE0/0/0 Direct D/-/L/- [dɪˈrɛkt]直连
172.16.10.0/24 20 NULL GE0/0/0 172.16.30.1 A/-/-/-
※配置16.BGP,一般是运营商用到比较多,普通企业很少用到
接口IP配置略...
[R1]bgp 65008
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 59.74.112.1 as-number 65009
[R1-bgp]ipv4-family unicast 进入 IPv4 单播地址族视图
[R1-bgp-af-ipv4]network 172.16.60.0 24 通告本子网给其他BGP路由器学习,正掩码
[R1-bgp-af-ipv4]quit
[R2]bgp 65009 创建BGP,as号为65009,同时进入as该区域准备配置
[R2-bgp]router-id 2.2.2.2 设置路由ID,作为身份识别符号,必须唯一
[R2-bgp]peer 59.74.112.2 as-number 65008 指定邻居接口ip地址(或邻居router-id也可以)+邻居所属的as号 #若as号相同,则为IBGP,不同则为EBGP
[R2-bgp]peer 172.16.30.2 as-number 65009
[R2-bgp]peer 172.16.10.2 as-number 65009
[R1-bgp]ipv4-family unicast 进入 IPv4 单播地址族视图 #美[unicast]单播
[R2-bgp-af-ipv4]import-route ? 引入另一种路由协议产生源(实验中引入了直连路由表项) #/'ɪmpɔt/引入.进口,输入
direct Connected routes
isis Intermediate System to Intermediate System (IS-IS) routes
ospf Open Shortest Path First (OSPF) routes
rip Routing Information Protocol (RIP) routes
static Static routes
unr User network routes
#其实也相当于如下宣告命令,等于减少了工作量,提高了效率
#[R2-bgp-af-ipv4]network 172.16.30.0 24
#[R2-bgp-af-ipv4]network 172.16.10.0 24
#[R2-bgp-af-ipv4]network 59.74.112.0 24
[R3]bgp 65009
[R3-bgp]router-id 3.3.3.3
[R3-bgp]peer 172.16.30.1 as-number 65009
[R3-bgp]peer 172.16.20.2 as-number 65009
[R4]bgp 65009
[R4-bgp]router-id 4.4.4.4
[R4-bgp]peer 172.16.10.1 as-number 65009
[R4-bgp]peer 172.16.20.1 as-number 65009
#查看命令
<R3>display bgp peer 查看BGP邻居关系
<R3>display bgp routing-table 查看BGP路由信息
* - valid 可用,有效的 #/'vælɪd/, > - best
注:
- 实验中确实一个个指定了邻居和邻居as号,但是在下一步实验-IPv4 单播地址族视图中,仅仅只有R1通告了新增的loopback0环回网段,供其他BGP路由器学习,并没有像OSPF那样一个个宣告直连网段!
- 然后在R2路由器IPv4 单播地址族视图下,引入了直连路由表项达到了实验目的.(除了引入直连路由表项,若配了OSPF,也可以达到目的)