Avatar CS Knowledge Wiki

10 路由基础

How to send the packet without knowing anything about the topology?

1.jpg

25.jpg

2.jpg

Route algorithm#

Routers forward a packet for one hop by looking at the IP address。

3.jpg

4.jpg

How to send the packet without knowing anything about the topology?

  • Send it to a random next hop.
  • Flooding: send it to everybody.
  • Source Routing: the original sender list all routers along the path
  • Distributed algorithm: routers construct a forwarding table by talking with each other

5.jpg

Flooding#

6.jpg

Flooding: routers forward a packet to every interface, except for the one it comes from

Cons:

  • infinite loops. TTL field was originally designed to avoid the infinite loops.
  • Inefficient usage of links: a packet would use all links at least once
  • Packets are delivered to everyone

Pros: packets arrive the destination at the shortest possible path

Source Routing#

7.jpg

Source Routing: the source hosts specify the whole path (A -> R1 -> R2 -> R3 -> B) or part of the path (the path has to go through R2)

Cons:

  • Revealing the underlying network topology causes potential vulnerabilities, and ISPs do not want to reveal that to users (due to security/competition)
  • Potentially large headers and all sources need to know the networking topology to do this

Pros:

  • No loops
  • No need for tables at routers

Routing tables#

8.jpg

Routing tables: map prefix of IP destination addresses to next hop IP address

  • X.Y/Z is a Z-bit prefix IP destination address
  • Looking up in the routing tables looks for the longest prefix match
If (the packet is for this router’s Ethernet address) {
        Check the IP version number and length of datagram;
        Decrement TTL, and update IP header checksum;
           If (TTL == 0)  drop;
           If (IP destination address is in the forwarding table) {
                Forward to the correct port;
plaintext

9.jpg

Routing tables#

10.jpg

11.jpg

12.jpg

How to construct routing tables?

  • If packets from any source router should be delivered to router X exactly once along the shortest path, the routing table for destination router X, is a spanning tree with root at router X.
  • Routers build a spanning tree for each destination.

13.jpg

14.jpg

15.jpg

16.jpg

17.jpg

18.jpg

19.jpg

20.jpg

21.jpg

22.jpg

23.jpg

24.jpg

26.jpg

27.jpg

28.jpg

29.jpg

Bellman-Ford algorithm#

Bellman-Ford algorithm: every router advising its # hops from the destination, and update that number when they received a smaller # hops (new number + 1 < old number) from its neighbors, and breaks ties at random.

30.jpg

31.jpg

32.jpg

33.jpg

34.jpg

35.jpg

36.jpg

37.jpg

38.jpg

39.jpg

40.jpg

41.jpg

42.jpg

Knowledge map

知识图谱

当前文档、同目录指南与引用关系。

准备中 全局图谱

正在构建知识图谱...

拖动节点 · 滚动缩放 · 点击打开

帮助与支持

这篇文档有帮助吗?

请给我们反馈以改进文档质量
(点击按钮后会打开邮箱)

帮助改进文档

所有文档均开源,发现问题或不清楚的地方?提交 PR 来帮助改进。

编辑此页面 了解如何贡献 →

需要更多帮助?

加入社区或直接联系获取支持

文件管理器 /
位置 /
内容
Knowledge explorer

知识图谱

全部知识 准备图谱...
文章 文档 标签 分类

正在加载知识网络...

拖动节点 · 滚动缩放 · 单击查看详情 · 双击打开页面
标签云 / Tag Cloud