라우팅
도입됨이 수업의 내용
| English | 의미 |
|---|---|
| routing table/ˈraʊtɪŋ ˈteɪbl/ | 경로 표 |
| longest prefix match/ˈlɒŋɡɪst ˈpriːfɪks mætʃ/ | 최장 전위 일치 |
| Prefix aggregation/ˈpriːfɪks ˌæɡrɪˈɡeɪʃn/ | combining several network prefixes into one shorter prefix to shrink routing tables |
| Link-state/lɪŋk steɪt/ | routing in which every router learns the whole network map and computes shortest paths itself |
| Distance-vector/ˈdɪstəns ˈvektə/ | routing in which each router tells its neighbours its distance to every destination |
| BGP/ˌbiː dʒiː ˈpiː/ | the routing protocol used between autonomous systems on the Internet |
| count to infinity/kaʊnt tʊ ɪnˈfɪnɪti/ | the slow growth of distance-vector distances to a destination that has become unreachable |
Tables and prefixes
- A router's routing table 路由表 maps destination prefixes to next hops. The longest prefix match 最长前缀匹配 rule picks the most specific route, and the default route catches everything else.
- Table
10.0.0.0/8 → X,10.1.0.0/16 → Y,10.1.2.0/24 → Z, default → W:10.1.2.200goes to Z,10.9.9.9to X and192.168.1.1to W.
Destination 10.1.2.200 with /8, /16 and /24 entries present goes to —
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
Longest prefix match: three match, the /24 is most specific.
Table 10.0.0.0/8 → X, 10.1.0.0/16 → Y, 10.1.2.0/24 → Z. Where does 10.1.3.7 go?
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
It misses the /24 but matches the /16, which beats the /8.
Dijkstra, in numbers
- Course weights: A–B 4, A–C 2, B–C 1, B–D 5, C–D 8, C–E 10, D–E 2, E–F 3, D–F 6. From A, the nodes settle in the order C, B, D, E, F, at distances 2, 3, 8, 10, 13.
- F's best path is A C B D E F, at $2+1+5+2+3 = 13$: going through E ($10 + 3$) beats D's direct link ($8 + 6 = 14$). Settled nodes are final; never update their distances again.

On the course graph, node F settles at —
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
A C B D E F: 2 + 1 + 5 + 2 + 3 = 13. Going through E is cheaper than the direct link from D (14).
On the course graph, put the nodes in the order Dijkstra settles them from A.
난이도 3/5 · 200코인 + 오늘 첫 완료 시 작은 보너스 추가
Each round settles the closest unsettled node: B is reached through C ($2 + 1$), D through B ($3 + 5$), E through D ($8 + 2$) and F through E ($10 + 3$), which beats D's direct $8 + 6 = 14$.
Why hierarchy
- A flat table would hold one entry per address: about $4 \times 10^9$ rows for IPv4. Prefix aggregation 前缀聚合 lets one announcement stand for a whole block: a /12 covers $2^{32-12} = 2^{20}$, about a million, addresses.
- With aggregation the global IPv4 table holds about a million routes today: large, but some 4,000 times smaller than one row per address. No router outside a network needs to know its individual hosts.
A /12 announcement covers — addresses
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
32 - 12 = 20 host bits: 2^20 addresses aggregated away.
Share the map or share the distances
- Link-state 链路状态 routing (OSPF): every router floods its own links to all the others, so each one holds the whole map and runs Dijkstra itself.
- Distance-vector 距离向量 routing (RIP): a router tells only its neighbours its current distance to each destination, and takes the best "link cost + neighbour's distance". It is simpler and needs no map, but it learns bad news slowly (next steps).
Router X reaches Y at cost 3 and Z at cost 1. Y reports distance 4 to D; Z reports distance 8. What is X's distance to D?
난이도 2/5 · 140코인 + 오늘 첫 완료 시 작은 보너스 추가
min(3 + 4, 1 + 8) = min(7, 9) = 7, via Y.
In link-state routing, each router holds the whole network map.
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
Flooding gives every router every link; each runs Dijkstra.
Worked example: a distance-vector update
- Router X has neighbours Y (link cost 1) and Z (cost 4). Y reports destination D at 5; Z reports D at 1.
- X takes the best total: $\min(1 + 5, 4 + 1) = \mathbf{5}$, via Z. This is the Bellman–Ford step, repeated whenever a neighbour's report changes.
Costs X–Y 1 and X–Z 4; Y reports D at 5, Z reports D at 1. X's distance to D?
난이도 2/5 · 140코인 + 오늘 첫 완료 시 작은 보너스 추가
$\min(1 + 5, 4 + 1) = 5$, via Z.
Bad news travels slowly, and BGP
- Routers A–B–C sit in a line, each link cost 1, so B is 1 from C and A is 2 (via B). The B–C link fails. B now hears A say "C is 2" and believes it: B sets 3, via A.
- A hears 3 from B and sets 4; B then sets 5, and so on. They count to infinity 无穷计数, and RIP stops at 16, which means "unreachable".
- Split horizon, never telling a neighbour about a route learned from it, stops this two-router loop.
- Between organisations' networks (autonomous systems), BGP 边界网关协议 advertises whole paths of autonomous systems, not just distances. Seeing the full path lets a router reject loops, and it chooses routes by business policy, not only by shortest distance.
In the line A–B–C, after the B–C link fails, B can believe A's old report "C is 2" and set its own distance to 3, via A.
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
B cannot tell that A's route to C went through B itself. That is the start of count to infinity; split horizon stops it by not reporting a route back to the neighbour it came from.
Which protocol routes between autonomous systems on the internet?
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
BGP is the path-vector protocol between networks; OSPF runs inside one.
Marks that slip away
- First match instead of longest match.
10.1.2.200goes to the /24 route, even though the /8 also matches. - Updating a settled node. In Dijkstra a settled distance is final; only unsettled nodes change.
- Taking the fewest hops. F's best path A C B D E F has five hops at cost $13$; A C D F has three hops but costs $2 + 8 + 6 = 16$.
Recap
- Longest prefix match picks the most specific route; the default catches the rest.
- Dijkstra from A settles the nearest node first:
| Settled | C | B | D | E | F |
|---|---|---|---|---|---|
| From A | 2 | 3 | 8 | 10 | 13 |
- Aggregation keeps the global table near a million routes instead of $4 \times 10^9$.
어떤 문제가 있었나요? 사이트 팀만 이 내용을 볼 수 있습니다.