補充說明用vi打的 也許版面在論壇會怪怪的
((上網四要素))
IP
Netmask //子網路遮照
Gateway //通訊匝
DNS //名稱伺服器
IP轉換 (10進位與2進位的轉變)
ex:
IP: 192.168.2.100 = 11000000.10101000.00000010.01100100
Netmask: 255.255.255.0 = 11111111.11111111.11111111.00000000
以11000000說明
1 1 0 0 0 0 0 0
128 64 32 16 8 4 2 1
128+64=192
((進位表示))
HEX=16進位
DEC=10進位
OCT=8進位
BIN=2進位
=============================================================
((HUB連接A與B)) netmask=255.255.255.0
A B
IP 192.168.2.100 192.168.2.200
Netmask 255.255.255.0 255.255.255.0
Network 192.168.2.0 192.168.2.0
IP: 192.168.2.100(10) = 11000000.10101000.00000010.01100100(2)
Netmask: 255.255.255.0(10) = 11111111.11111111.11111111.00000000(2)
-----------------------------------------------------------------------------------------
Network: 192.168.2.0(10) = 11000000.10101000.00000010.00000000(2)
((AND運算法))
IP 192(10) 11000000(2)
Netmask AND 255(10) 11111111(2)
---------------------------------------------------
Network 192(10) 11000000(2)
((HUB連接A與B)) netmask=255.255.255.128
A B
IP 192.168.2.100 192.168.2.200
Netmask 255.255.255.128 255.255.255.128
Network 192.168.2.0 192.168.2.128 (
會因此而無法直接連線)
IP: 192.168.2.100(10) = 11000000.10101000.00000010.01100100(2)
Netmask: 255.255.255.128(10) = 11111111.11111111.11111111.10000000(2)
-----------------------------------------------------------------------------------------
Network: 192.168.2.0(10) = 11000000.10101000.00000010.00000000(2)
IP: 192.168.2.200(10) = 11000000.10101000.00000010.11001000(2)
Netmask: 255.255.255.128(10) = 11111111.11111111.11111111.10000000(2)
-----------------------------------------------------------------------------------------
Network: 192.168.2.128(10) = 11000000.10101000.00000010.10000000(2)
((Netmask))
11111111.11111111.11111111.00000000
^^^^^^^^^^^^^^^^^^^^ ----------------Rang範圍 0~255
Network Address Host Address
表示在同一段Network內,有0~255的Host Address
11111111.11111111.11111111.10000000
^^^^^^^^^^^^^^^^^^^^^--------------Rang範圍0~127
Network Address Host Address
表示在同一段Network內,有0~127的Host Address
11111111.11111111.11111111.11100000
^^^^^^^^^^^^^^^^^^^^^^^--------------Rang範圍0~31
Network Address Host Address
表示在同一段Network內,有0~31的Host Address
((Netmask要點))
1.網路位置(Network Address)必為連續的1
00000000 (10) 0 (8)
10000000 128
11000000 192
11100000 224
11110000 240
11111000 248
11111100 252
11111110 254
11111111 255
2.CIDR值 (看網路位置有多少個連續的1)
255.255.255.0 ==> CIDR=24
255.255.255.252 ==> CIDR=30
192.168.2.100/255.255.255.0 與 192.168.2.100/24 是相同的
CIDR=20
=>255.255.240.0
CIDR=25
=>255.255.255.128
若IP/Netmask 192.168.2.100/24
求IP Range
IP Range = 192.168.2.0 ~ 192.168.2.255
若IP/Netmask 192.168.2.100/25
求IP Range
IP Range = 192.168.2.0 ~ 192.168.2.127
Netmask: 255.255.255.0 => host:256
255.255.255.128 => host:128
255.255.255.192 => host:64
255.255.255.224 => host:32
255.255.255.240 => host:16
!!! IP Range !!!
第一個IP位置稱為網路位置(Network)
最後一個IP位置稱為廣撥位置(Broadcast)
Network及Broadcast位置不可拿來使用
ex:
168.32.1.9/25
可用IP = 128-2=126
172.60.2.90/29
可用IP = 8-2=6
((Private IP Address 私人IP位置))
從internet無法連至Private IP
其IP範圍有三段
1. A class 10.0.0.0 ~ 10.255.255.255
2. B class 172.16.0.0 ~ 172.31.255.255
3. C class 192.168.0.0 ~ 192.168.255.255
若要用Private IP連向Internet作法!!
(1)Router支援NAT功能 (Network Address Translation)網路位置轉換
(2)架設Proxy Server (代理伺服器)
透過Proxy Server連到Internet