补充说明用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