e-计算机网络基础3-IP路由

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

192.100.0.0
192.100.192.0 192.201.0.0 192.202.0.0
255.255.0.0
255.255.224.0 255.255.0.0 255.255.0.0
192.201.0.1
192.202.0.1 C C
I00
I01 I00 I01
1
1 0 0
Example#5: Multi-routes / route backup
I00 .2 R0 I02 170.10.0.0/16 .2 I01
192.201.0.0/16
192.100.128.0/19 R1 .1
192.202.0.0/16
.1 R3 192.200.0.0/19 .1
192.100.64.0/19 192.100.0.0/19 Targ. SubnetID Mask Next Hop Outbound Intf. RIP Dist.
Example#1:Write the correct forwarding table for each router( including the default route)
I00 .2 170.10.0.0/16(public internet)
B.G.
I02
.2 I01
192.100.0.0/19
Principles for Multi-routes Scheduling
• For Reliability: Master/Slave Backup • For Traffic Balance: Scheduling packets according (say) bandwidth or traffic load over different candidate routes( between two hosts)
192.100.128.0
192.100.0.0 192.100.64.0
255.255.224.0
255.255.224.0 255.255.224.0
192.201.0.1
192.201.0.1 192.201.0.1
I00
I00 I00
1
1 1
Example#4(Route Aggregation): Order really matters!
Example#1: When an IP packet of dest. Addr. 202.39.2.79 arrives at R2, 1) R2 checks its forwarding table line after line until discovering a line such that
} else { /* d表示目标网络就是接口I连接的邻接网段, 例如, d表示网络距离且d=0.*/
将队列项[A, P]放入接口I的离出队列; /* 涵义同上 */ } found = TRUE; break;
} /* if…*/
} /* for…*/ if( ! found ) { /* 假设默认路由项是(0.0.0.0, 0.0.0.0, N*, I*, -) */ 将队列项[N*, P]放入接口I*的离出队列; /*涵义同上*/ }
192.100.128.0/19
I21 I22 .2 R2 .2
R1’s table( incomplete ) Tagt. SubnetID 192.100.32.0 192.100.128.0 Mask 255.255.224.0 255.255.224.0 Next Hop 192.100.0.2(M) 192.100.64.2(S) 192.100.64.2(M) 192.100.0.2(S) Outbound Intf. I11 I12 I12 I11 RIP Dist. 1 2 1 2
Vlan2
Vlan2 Vlan2 Vlan160
3
4 0 1
202.124.254.0 255.255.255.0 176.20ectly Connected”
Example#3(Route Aggregation): How few(!) route items are needed to correctly represent the topology?
I00 .2 170.10.0.0/16(public internet) .2 I01
B.G. I02
192.100.0.0/19
192.100.96.0/19 .1 R1 I10 .1 I12 192.100.64.0/19 .1 I11
192.100.32.0/19 .1 I31 .2 192.100.192.0/19 .1 R3 I30 I32
Targeted Subnet ID Mask
I20 .1 192.100.160.0/19 Next Hop Outbound Intef. RIP Dist.
Example#2: Determine the neighbor topology via forwarding table.
Targeted SubnetID Mask Next Hop Outbound Intf. RIP Dist.
Router
IP Addr. = 192.108.0.9
Routing on Internet(3):Router
Routing on Internet(4-1):Forwarding Table
Routing on Internet(4-2) How an IP Packet is forwarded by a Router?
RIP algorithm(no fault detections)
172.200.0.0
255.255.255.0 0.0.0.0
172.200.0.0
172.200.1.1 172.200.1.1
172.200.0.0
I21 I21
172.200.0.0
1
Routing on Internet(4-3): Default Route
Example#2: An IP packet of dst. Addr. 110.240.10.89 arrives at R2: 1)R2 does the same as in example#1, however, no matching route is found ! Tageted SubnetID= 110.240.10.89 &Mask 2)R2 forwards this packet according to “next hop” indicated by default route.
IP Pkt,Dst. Addr =170.100.2.9
170.100.0.0/16:192.101.0.1 170.200.0.0/16: 192.102.0.1
IP Addr. = 192.101.0.1
170.100.0.0/16: 192.108.0.9
170.200.0.0/16: XXXX
Routing on Internet(1) How is an IP Packet traverse over the Internet?
上海:南 北京:北
上海:东
上海:南
北京:北
北京:西
Routing on Internet(2)
How is an IP Packet is forwarded to its destination?
Targetted subnetID 172.100.0.0 172.2100.0
Mask 255.255.0.0 255.255.0.0
Next Hop 172.210.0.0 C
Outbound Intf. I22 I22
RIP Dist. 1 0
172.200.0.0
202.39.2.0 0.0.0.0
“targetted subnetID”=202.39.2.79 & “mask”
i.e., a matching route item is found; 2) R2 forwards the packet to one of its neighbor according to “next hop”.
172.200.0.0
255.255.255.0 0.0.0.0
172.200.0.0
172.200.1.1 172.200.1.1
172.200.0.0
I21 I21
172.200.0.0
1
Routing on Internet(4-4):Forwarding Algorithm
IP_Packet_Routing(IP分组P) { int found = FALSE; A=P的目标IP地址; for( 每个非默认路由项(D, M, N, I, d) ) { /*D是目标网络的IP地址, M是子网掩码, N是下一站路由器的IP地址,I是离出接口, d是路由的性能度量 */ if(A&M==D) { /* & 是逐位逻辑与 */ if( d表示P的目标网络并非邻接) { /* 例如, d表示网络距离且d>0. */ 将队列项[N, P]放入接口I的离出队列; /*[N, P]的涵义是: 将分组P载入数据链路帧, 帧的目标MAC地址与IP地址N对应. */
Targeted subnetID 172.100.0.0 172.2100.0
Mask 255.255.0.0 255.255.0.0
Next Hop 172.210.0.0 C
Outbound Intf. I22 I22
RIP Dist. 1 0
172.200.0.0
202.39.2.0 0.0.0.0
192.100.96.0/19 .1 R1 I10 .1 I12 192.100.64.0/19 .1 I11
192.100.32.0/19 .1 I31 .2 192.100.192.0/19 .1 R3 I30 I32
192.100.128.0/19
I21 I22 .2 R2 .2
e.g., R2’s table
}
IP分组转发算法:上机作业
题目:实现IP分组高速转发算法 要求:完成路由表详细的数据结构与算法设计,路由表要能支 持路由项的高速查询(关键性能)、插入、更新和删除;必须 逻辑正确、查询速度尽可能地高;用C语言实现程序并实际运 行;给出明确的测试方案;给出明确测试结果。 本题目不要求实现IP分组的实际输入/输出功能。 结果:写出设计报告(明确说明以上每项要求是如何具体实现 的,特别是数据结构的设计思想及详细实现)。
202.204.65.0 202.204.64.0
255.255.255.0 255.255.255.0
C C
Vlan160 Valn159
0 0
202.14.71.0
202.38.70.0
255.255.255.0 202.124.254.9
255.255.255.0 202.124.254.9 C 202.204.65.1
I00 .2 R0 I02 170.10.0.0/16 .2 I01
192.201.0.0/16
192.100.128.0/19 R1 .1
192.202.0.0/16
.1 R3 192.101.192.0/19
.1
192.100.64.0/19 192.100.0.0/19 Tagt. SubnetID Mask Next Hop Outbound Intf. RIP Dist.
Dynamic Route Discovery(1): RIP
• Route Vector Principles
How does RIP work on each router: 1)Initial forwarding table is setup to (only) indicate directly connected subnets. 2)Each router periodically multicasts its current forwarding table to its neighbors; 3) Each router tries to find/extract new route information from its neighbors’ reports.
相关文档
最新文档