IPv4 - Classless Addressing (CIDR)
課程影片
第 7J 講 路由器運作原理以及網路互連技術 L07 10
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
第 7K 講 路由器運作原理以及網路互連技術 L07 11
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
目標:將小網段組合成大網段
一次分配一個 Class B 網段太多,而分配多個 Class C 網段又會使路由表變得太大,那該怎麼辦?一個折衷的做法是:分配多個「連續的」 Class C 網段。這時,因為這些 Class C 網段是連續的,所以它們會具有共同的前綴。因此靠這個共同的前綴,就可以作為識別「這是哪一群 Class C 網段」的依據了。而路由表也從需要存多個 Class C IP,變成只要存這個共同的前綴即可。
舉例來說,現在有如下 16 個「連續」的 Class C 網段,這時就可以把他們合併起來當作是一個網段,路由的。
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
術語:<IP>/X
–- 從 <IP>
開始前 X 位元一樣的所有 IP
在這種時候,通常會用 <IP>/X
這個記號,表示「跟 <IP>
的前 X 個位元」具有相同前綴的所有 IP,用上述方法行程的網段。舉例來說,上面的例子,可以用 192.4.16/20
,表示以「192.4.16
」的前 20 個位元為前綴的所有 IP。
對路由表的影響:Route Aggregation
如果有 個大小為 的連續網段,那麼好像就可以把它們看成一個大小為 的網段,並且這些 IP 的前 位元都一樣。因此若想要知道怎麼找到這些 IP 的其中一個,在路由表就只要記得這個前綴就可以了。
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Longest Prefix Matching
反過來說,在這個設計之下,因為前綴相近的 IP 會分配在相近的地方,所以就可以使用「匹配的最長前綴」作為路由的依據。如果有多個前綴成功匹配,那麼就把封包往最長的那個前綴對應的 port 送。