引用:
作者: rezard
如果小弟記得沒錯的話...
最初的規範切割二個子網路是違規的
因為去頭去尾就沒有可用的子網了
最少要切成四個 去頭去尾剩下二個
後來新規範才可以的樣子...
這一題 25bits 難道有陷阱...
|
對不起,沒看清楚IP,所以必須重算了一下~~
小弟查了一下RFC做一下補充說明:
最先RFC 950因為屬於網路分級classical,IP位址是由 Network ID + Subnet ID + Host ID所構成,路由器判斷封包目的地時會先抓IP的前置位元network prefixes來判斷所屬層級,A級是0xxx、B級是10xx、C級是110x、D級是1110、E級是1111,確認層級後才判斷出Host ID從哪裡開始(Subnet ID為Host ID的最前頭),然後與mask一比(AND計算)才能得知有無切割子網路。
到了RFC 1812第22頁提到:
The classical IP addressing architecture used addresses and subnet
masks to discriminate the host number from the network prefix. With
network prefixes, it is sufficient to indicate the number of bits in
the prefix. Both representations are in common use. Architecturally
correct subnet masks are capable of being represented using the
prefix length description. They comprise that subset of all possible
bits patterns that have
o a contiguous string of ones at the more significant end,
o a contiguous string of zeros at the less significant end, and
o no intervening bits.
大意是說:雖然classical與classless二派均有使用,但是後來的classless子網路遮罩已經足以擔任原來前置位元的描述任務,所以子網路ID可以使用「任何型式」!(請留意最後一句話)
這就是小弟所說的陷阱:以一個類似B級網址、classless的表示法,容易讓人產生錯覺,連小弟都上當了…,上面版大的解法應該ok。