Giáo trình IP - CCNP

download Giáo trình IP - CCNP

of 20

description

Networking

Transcript of Giáo trình IP - CCNP

  • TRUNG TM TIN HC VNPRO 149/1D Ung Vn Khim, Phng 25, Qun Bnh Thnh, Tp.HCM Tel: 08 35124257 Fax: 08 35124314 Website: www.vnpro.vn Forum: http://www.vnpro.org Livechat: www.vnpro,vn/support Email: [email protected]

    a ch IP GV: L c Phng.

    1

    a ch IP, chia subnet, VLSM, summary. a ch IP l mt chuyn quan trng trong chng trnh o to chuyn vin mng CCNA. c th theo hc tt chng trnh CCNA, vt qua c cc k thi ly chng ch quc t v theo hc tip c cc chng ch cao cp hn cng nh hon thnh tt c cc cng vic trong lnh vc mng, ngi hc vin, k s, chuyn vin phi nm vng cc kin thc v k nng lin quan n a ch IP. Ti liu sau s cung cp nhng im chnh yu, quan trng ca chuyn nn tng ny. 1. Mt vi im c bn cn nh : - Chuyn i nh phn thp phn: cn nm vng cch chuyn i gia s nh phn v thp phn. VD: 5 101 ; 10 1010; 64 1000000. - Vi n bit nh phn, ta c th thit lp c: 2n s nh phn n bit vi gi tr thp phn tng ng chy t 0 n 2n 1. VD:

    Vi n = 2, ta lp c 22 = 4 s nh phn 2 bit chy t 0 n 3 ( = 22 1 ): 00 0 01 1 10 2 11 3

    Vi n = 3, ta lp c 23 = 8 s nh phn 3 bit chy t 0 n 7 ( = 23 1 ): 000 0 100 4 001 1 101 5 010 2 110 6 011 3 111 7

    - C gng nh mt s ly tha ca 2, t nht cho n 28 : 20 = 1 24 = 16 28 = 256 21 = 1 25 = 32 22 = 4 26 = 64 23 = 8 27 = 128 - Sau y l cc chui nh phn 8 bit cng cc s thp phn tng ng cn phi

    thuc phc v cho vic tnh nhanh subnet mask:

  • TRUNG TM TIN HC VNPRO 149/1D Ung Vn Khim, Phng 25, Qun Bnh Thnh, Tp.HCM Tel: 08 35124257 Fax: 08 35124314 Website: www.vnpro.vn Forum: http://www.vnpro.org Livechat: www.vnpro,vn/support Email: [email protected]

    a ch IP GV: L c Phng.

    2

    Chui nh phn 8 bit. Gi tr thp phn tng ng.

    00000000 0 10000000 128 11000000 192 11100000 224 11110000 240 11111000 248 11111100 252 11111110 254 11111111 255

    Bng 1.1 Cc chui nh phn 8 bit cn nh - Bng bc nhy: bng ny c s dng tnh ton trong php chia subnet

    Bng 1.2 Bng tng ng s bit mn v bc nhy

    2. a ch IP: a ch IP l a ch logic c s dng trong giao thc IP ca lp Internet thuc m hnh TCP/IP (tng ng vi lp th 3 lp network ca m hnh OSI). Mc ny trnh by cc im chnh cn ghi nh v a ch IP. 2.1. Cu trc a ch IP - a ch IP gm 32 bit nh phn, chia thnh 4 cm 8 bit (gi l cc octet). Cc octet c biu din di dng thp phn v c ngn cch nhau bng cc du chm. - a ch IP c chia thnh hai phn: phn mng (network) v phn host.

    S bit mn 1 2 3 4 5 6 7 8 Bc nhy 128 64 32 16 8 4 2 1

  • TRUNG TM TIN HC VNPRO 149/1D Ung Vn Khim, Phng 25, Qun Bnh Thnh, Tp.HCM Tel: 08 35124257 Fax: 08 35124314 Website: www.vnpro.vn Forum: http://www.vnpro.org Livechat: www.vnpro,vn/support Email: [email protected]

    a ch IP GV: L c Phng.

    3

    Hnh 2.1 Cu trc a ch IP - Vic t a ch IP phi tun theo cc quy tc sau: Cc bit phn mng khng c php ng thi bng 0.

    VD: a ch 0.0.0.1 vi phn mng l 0.0.0 v phn host l 1 l khng hp l.

    Nu cc bit phn host ng thi bng 0, ta c mt a ch mng. VD: a ch 192.168.1.1 l mt a ch c th gn cho host nhng a ch 192.168.1.0 l mt a ch mng, khng th gn cho host c.

    Nu cc bit phn host ng thi bng 1, ta c mt a ch qung b (broadcast). VD: a ch 192.168.1.255 l mt a ch broadcast cho mng 192.168.1.0

    2.2. Cc lp a ch IP: Khng gian a ch IP c chia thnh cc lp nh sau: a) Lp A:

    Hnh 2.2 Cu trc a ch lp A

  • TRUNG TM TIN HC VNPRO 149/1D Ung Vn Khim, Phng 25, Qun Bnh Thnh, Tp.HCM Tel: 08 35124257 Fax: 08 35124314 Website: www.vnpro.vn Forum: http://www.vnpro.org Livechat: www.vnpro,vn/support Email: [email protected]

    a ch IP GV: L c Phng.

    4

    - a ch lp A s dng mt octet u lm phn mng, ba octet sau lm phn host. - Bit u ca mt a ch lp A lun c gi l 0. Do , cc a ch mng lp A gm: 1.0.0.0 127.0.0.0. Tuy nhin, mng 127.0.0.0 c s dng lm mng loopback nn a ch mng lp A s dng c gm 1.0.0.0 126.0.0.0 (126 mng). Ch : a ch 127.0.0.1 l a ch loopback trn cc host. kim tra chng giao thc TCP/IP c c ci t ng hay khng, t du nhc h thng, ta nh lnh ping 127.0.0.1, nu kt qu ping thnh cng th chng giao thc TCP/IP c ci t ng n. - Phn host c 24 bit => mi mng lp A c (224 2) host. - V d: 10.0.0.1, 1.1.1.1, 2.3.4.5 l cc a ch lp A. b) Lp B:

    Hnh 2.3 Cu trc a ch lp B. - a ch lp B s dng hai octet u lm phn mng, hai octet sau lm phn host. - Hai bit u ca mt a ch lp B lun c gi l 1 0. Do cc a ch mng lp B gm: 128.0.0.0 -> 191.255.0.0 C tt c 214 mng trong lp B. - Phn host: 16 bit Mt mng lp B c 216 2 host. - V d: cc a ch 172.16.1.1, 158.0.2.1 l cc a ch lp B.

  • TRUNG TM TIN HC VNPRO 149/1D Ung Vn Khim, Phng 25, Qun Bnh Thnh, Tp.HCM Tel: 08 35124257 Fax: 08 35124314 Website: www.vnpro.vn Forum: http://www.vnpro.org Livechat: www.vnpro,vn/support Email: [email protected]

    a ch IP GV: L c Phng.

    5

    c) Lp C:

    Hnh 2.4 Cu trc a ch lp C. - a ch lp C s dng ba octet u lm phn mng, mt octet sau lm phn host. - Ba bit u ca mt a ch lp C lun c gi l 1 1 0. Do , cc a ch mng lp C gm: 192.0.0.0 -> 223.255.255.0 C tt c 221 mng trong lp C. - Phn host: 8 bit Mt mng lp C c 28 2 = 254 host. - V d: cc a ch 192.168.1.1, 203.162.4.191 l cc a ch lp C. d) Lp D: - a ch: 224.0.0.0 -> 239.255.255.255 - Dng lm a ch multicast. V d: 224.0.0.5 dng cho OSPF 224.0.0.9 dng cho RIPv2 e) Lp E: - T 240.0.0.0 tr i. - c dng cho mc ch d phng. Ch : Cc lp a ch IP c th s dng t cho cc host l cc lp A, B, C. thun tin cho vic nhn din mt a ch IP thuc lp no, ta quan st

    octet u ca a ch, nu octet ny c gi tr:

  • TRUNG TM TIN HC VNPRO 149/1D Ung Vn Khim, Phng 25, Qun Bnh Thnh, Tp.HCM Tel: 08 35124257 Fax: 08 35124314 Website: www.vnpro.vn Forum: http://www.vnpro.org Livechat: www.vnpro,vn/support Email: [email protected]

    a ch IP GV: L c Phng.

    6

    1 126: a ch lp A. 128 191: a ch lp B.

    192 223: a ch lp C. 224 239: a ch lp D. 240 255: a ch lp E. 2.3. a ch Private v Public: - a ch IP c phn thnh hai loi: private v public. Private: ch c s dng trong mng ni b (mng LAN), khng c

    nh tuyn trn mi trng Internet. C th c s dng lp i lp li trong cc mng LAN khc nhau.

    Public: l a ch IP s dng cho cc gi tin i trn mi trng Internet, c nh tuyn trn mi trng Internet, khng s dng trong mng LAN. a ch public phi l duy nht cho mi host tham gia vo Internet.

    - Di a ch private (c quy nh trong RFC 1918):

    Lp A: 10.x.x.x Lp B: 172.16.x.x -> 172.31.x.x Lp C: 192.168.x.x

    - K thut NAT (Network Address Translation) c s dng chuyn i gia IP private v IP public. - ngha ca a ch private: c s dng bo tn a ch IP public ang dn cn kit

    2.4. a ch qung b (broadcast): Gm hai loi: - Direct: VD: 192.168.1.255 - Local: VD: 255.255.255.255 - phn bit hai loi a ch broadcast ny, ta xem xt v d sau:

    Xt my c a ch IP l 192.168.2.1 chng hn. Khi my ny gi broadcast n 255.255.255.255, tt c cc my thuc mng 192.168.2.0 (l mng my gi gi tin ng trong ) s nhn c gi broadcast ny, cn nu n gi broadcast n a ch 192.168.1.255 th tt c cc my thuc mng 192.168.1.0 s nhn c gi broadcast (cc my thuc mng 192.168.2.0 s khng nhn c gi broadcast ny).

  • TRUNG TM TIN HC VNPRO 149/1D Ung Vn Khim, Phng 25, Qun Bnh Thnh, Tp.HCM Tel: 08 35124257 Fax: 08 35124314 Website: www.vnpro.vn Forum: http://www.vnpro.org Livechat: www.vnpro,vn/support Email: [email protected]

    a ch IP GV: L c Phng.

    7

    2.5. Bi tp: Cho bit a ch no sau y c th dng cho host:

    150.100.255.255 175.100.255.18 195.234.253.0 100.0.0.23 188.258.221.176 127.34.25.189 224.156.217.73

    3. Chia subnet: 3.1. Subnet mask v s prefix: - Subnet mask : Subnet mask l mt di 32 bit nh phn i km vi mt a ch IP, c cc host s dng xc nh a ch mng ca a ch IP ny. lm c iu , host s em a ch IP thc hin php tnh AND tng bit mt ca a ch vi subnet mask ca n, kt qu host s thu c a ch mng tng ng ca a ch IP. V d: Xt a ch 192.168.1.1 vi subnet mask tng ng l 255.255.255.0 Dng thp phn Dng nh phn a ch IP 192.168.1.1 11000000.10101000.00000001.00000001 Subnet mask 255.255.255.0 11111111.11111111.11111111.00000000 a ch mng 192.168.1.0 11000000.10101000.00000001.00000000 ( php ton AND: 0 AND 0 = 0

    0 AND 1 = 0 1 AND 0 = 0 1 AND 1 = 1 )

    i vi chng ta, quy tc gi nh subnet mask rt n gin: phn mng chy n u, bit 1 ca subnet mask chy n v ng vi cc bit phn host, cc bit ca subnet mask c thit lp gi tr 0. Mt s subnet mask chun: Lp A : 255.0.0.0 Lp C: 255.255.255.0 Lp B: 255.255.0.0 - S prefix: Nh nu ra trn, subnet mask c s dng km vi a ch IP mt host c th cn c vo xc dnh c a ch mng tng ng ca a ch ny. V vy, khi khai bo mt a ch IP ta lun phi khai bo km theo mt subnet mask. Tuy nhin, subnet mask d c vit di dng s thp phn vn kh di dng nn m t mt a ch IP mt cch ngn gn hn, ngi ta dng mt i lng

  • TRUNG TM TIN HC VNPRO 149/1D Ung Vn Khim, Phng 25, Qun Bnh Thnh, Tp.HCM Tel: 08 35124257 Fax: 08 35124314 Website: www.vnpro.vn Forum: http://www.vnpro.org Livechat: www.vnpro,vn/support Email: [email protected]

    a ch IP GV: L c Phng.

    8

    c gi l s prefix. S prefix n gin ch l s bit mng trong mt a ch IP, c vit ngay sau a ch IP, v c ngn cch vi a ch ny bng mt du /. V du: 192.168.1.1/24, 172.16.0.0/16 hay 10.0.0.0/8,.v.v - Nguyn l c bn ca k thut chia subnet: c th chia nh mt mng ln thnh nhiu mng con bng nhau, ngi ta thc hin mn thm mt s bit bn phn host lm phn mng, cc bit mn ny c gi l cc bit subnet. Ty thuc vo s bit subnet m ta c c cc s lng cc mng con khc nhau vi cc kch c khc nhau:

    Hnh 2.5 Mn thm bit chia subnet. 4. Cc dng bi tp v chia subnet: 4.1. Cho mt mng ln v s bit mn. Xc nh : - S subnet - S host/subnet - a ch mng ca mi subnet. - a ch host u ca mi subnet. - a ch host cui ca mi subnet. - a ch broadcast ca mi subnet. - Subnet mask c s dng. Cch tnh: - Gi n l s bit mn v m l s bit host cn li. Ta c: + S subnet c th chia c:

    2n nu c h tr subnet zero. 2n 2 nu khng h tr subnet zero. Lut subnet zero: nu h iu hnh trn host khng bt tnh nng subnet zero, khi chia subnet ta phi b i khng dng hai mng con ng vi cc bit subnet bng 0 ht v cc bit subnet bng 1 ht. Ngc li nu h iu hnh bt tnh nng subnet zero , ta c quyn s dng hai mng con ny. Nhn chung, cc h iu hnh ngy nay u bt tnh nng subnet zero mt cch mc nh, do nu khng thy ni g thm trong yu cu, ta s dng cch chia c h tr subnet zero.

    + S host c th c trn mi subnet: 2m 2 (host/subnet).

  • TRUNG TM TIN HC VNPRO 149/1D Ung Vn Khim, Phng 25, Qun Bnh Thnh, Tp.HCM Tel: 08 35124257 Fax: 08 35124314 Website: www.vnpro.vn Forum: http://www.vnpro.org Livechat: www.vnpro,vn/support Email: [email protected]

    a ch IP GV: L c Phng.

    9

    - Vi mi subnet chia c:

    + a ch mng c octet b chia ct l bi s ca bc nhy (Octet b chia ct l octet va c cc bit thuc phn mng va c cc bit thuc phn host). Bc nhy tng ng vi s bit mn c th c tra trong bng 1.2 ca mc 1. + a ch host u = a ch mng + 1 (cn hiu cng 1 y l li v sau mt a ch). + a ch broadcast = a ch mng k tip 1 (cn hiu tr 1 y l li v pha trc mt a ch). + a ch host cui = a ch broadcast 1 (cn hiu tr 1 y l li v pha trc mt a ch).

    - tnh ra subnet mask c s dng, ta s dng cch nh: phn mng ca a ch chy n u, cc bit 1 ca subnet mask chy n v bng 1.1 ca mc 1. VD1: Xt mng 192.168.1.0/24 , mn 2 bit, cn li 6 bit host, bc nhy l 64. Ta c: - S subnet c th c: 22 = 4 subnet. - S host trn mi subnet = 26 2 = 62 host. - Cc a ch mng s c octet b chia ct (octet th 4) l bi s ca 64. - Lit k cc mng nh sau: 192.168.1.0/26 -> a ch mng 192.168.1.1/26 ->a ch host u. .

    192.168.1.62/26 ->a ch host cui. 192.168.1.63/26 ->a ch broadcast. ---------------------------------------------

    192.168.1.64/26 -> a ch mng 192.168.1.65/26 ->a ch host u .. 192.168.1.126/26 ->a ch host cui 192.168.1.127/26 ->a ch broadcast. --------------------------------------------- 192.168.1.128/26 -> a ch mng 192.168.1.129/26 ->a ch host u. .

    192.168.1.190/26 ->a ch host cui. 192.168.1.191/26 ->a ch broadcast. ---------------------------------------------

  • TRUNG TM TIN HC VNPRO 149/1D Ung Vn Khim, Phng 25, Qun Bnh Thnh, Tp.HCM Tel: 08 35124257 Fax: 08 35124314 Website: www.vnpro.vn Forum: http://www.vnpro.org Livechat: www.vnpro,vn/support Email: [email protected]

    a ch IP GV: L c Phng.

    10

    192.168.1.192/26 -> a ch mng 192.168.1.193/26 ->a ch host u. .

    192.168.1.254/26 ->a ch host cui. 192.168.1.255/26 ->a ch broadcast. Vy, mt mng lp C 192.168.1.0/24 c chia thnh 4 mng :192.168.1.0/26, 192.168.1.64/16, 192.168.1.128/26, 192.168.1.192/26. Subnet mask c s dng trong v d ny l 255.255.255.192 VD2: Xt mng 172.16.0.0/16, mn 2 bit. Octet b chia ct ( thnh 2 phn l net v host ) l octet th 3. - S bit mn l 2 => s mng con c th c (tnh theo lut subnet zero): 22 = 4 mng. S bit mng by gi l 18 bit. - S bit host cn li: 32 18 = 14 bit. => s host/subnet = 214 2 host. - Cc a ch mng s c octet th 3 l bi s ca 64 (octet ny b mn 2 bit) - Ta c di a ch nh sau: 172.16.0.0/18 -> a ch mng 172.16.0.1/18 -> a ch host u .. . 172.16.63.254/18 -> a ch host cui. 172.16.63.255/18 -> a ch broadcast ------------------------------------------------------ 172.16.64.0/18 -> a ch mng 172.16.64.1.18 -> a ch host u ... 172.16.127.254/18 -> a ch host cui. 172.16.127.255/18 -> a ch broadcast. -------------------------------------------------------- 172.16.128.0/18 -> a ch mng 172.16.128.1/18 -> a ch host u 172.16.191.254/18 -> a ch host cui 172.16.191.255/18 -> a ch broadcast

  • TRUNG TM TIN HC VNPRO 149/1D Ung Vn Khim, Phng 25, Qun Bnh Thnh, Tp.HCM Tel: 08 35124257 Fax: 08 35124314 Website: www.vnpro.vn Forum: http://www.vnpro.org Livechat: www.vnpro,vn/support Email: [email protected]

    a ch IP GV: L c Phng.

    11

    -------------------------------------------------------

    172.16.192.0/18 -> a ch mng 172.16.192.1/18 -> a ch host u 172.16.192.254/18 -> a ch host cui 172.16.192.255/18 -> a ch broadcast ------------------------------------------------------- Subnet mask trong v d 2 l 255.255.192.0 VD3: Xt mng 172.16.0.0/16, mn 10 bit => octet b chia ct (thnh hai phn net v host ) l octet th 4. Ta c - S bit mn l 10 => s bit mng l 26 bit. S subnet c th c: 210 = 1024 mng. - S bit host cn li: 32 26 = 6 bit => s host trn mi subnet: 26 2 = 62 host. - a ch mng c octet th 4 l bi s ca 64 (octet ny b mn 2 bit) - Ta c di a ch nh sau: 172.16.0.0/26 -> a ch mng 172.16.0.1/26 -> a ch host u .. 172.16.0.62/26 -> a ch host cui 172.16.0.63/26 -> a ch broadcast ------------------------------------------------- 172.16.0.64/26 -> a ch mng 172.16.0.65/26 -> a ch host u .. 172.16.0.126/26 -> a ch host cui 172.16.0.127/26 -> a ch broadcast -------------------------------------------------- 172.16.0.128/26 -> a ch mng 172.16.0.129/26 -> a ch host u .. 172.16.0.190/26 -> a ch host cui 172.16.0.191/26 -> a ch broadcast --------------------------------------------------

  • TRUNG TM TIN HC VNPRO 149/1D Ung Vn Khim, Phng 25, Qun Bnh Thnh, Tp.HCM Tel: 08 35124257 Fax: 08 35124314 Website: www.vnpro.vn Forum: http://www.vnpro.org Livechat: www.vnpro,vn/support Email: [email protected]

    a ch IP GV: L c Phng.

    12

    172.16.0.192/26 -> a ch mng 172.16.0.193/26 -> a ch host u .. 172.16.0.254/26 -> a ch host cui 172.16.0.255/26 -> a ch broadcast ======================================== 172.16.1.0/26 -> a ch mng 172.16.1.1/26 -> a ch host u .. 172.16.1.62/26 -> a ch host cui 172.16.1.63/26 -> a ch broadcast -------------------------------------------------

    172.16.1.64/26 -> a ch mng 172.16.1.65/26 -> a ch host u .. 172.16.1.126/26 -> a ch host cui 172.16.1.127/26 -> a ch broadcast -------------------------------------------------- 172.16.1.128/26 -> a ch mng 172.16.1.129/26 -> a ch host u .. 172.16.1.190/26 -> a ch host cui 172.16.1.191/26 -> a ch broadcast -------------------------------------------------- 172.16.1.192/26 -> a ch mng 172.16.1.193/26 -> a ch host u .. 172.16.1.254/26 -> a ch host cui 172.16.1.255/26 -> a ch broadcast ======================================== 172.16.2.0/26 -> a ch mng 172.16.2.1/26 -> a ch host u ..

  • TRUNG TM TIN HC VNPRO 149/1D Ung Vn Khim, Phng 25, Qun Bnh Thnh, Tp.HCM Tel: 08 35124257 Fax: 08 35124314 Website: www.vnpro.vn Forum: http://www.vnpro.org Livechat: www.vnpro,vn/support Email: [email protected]

    a ch IP GV: L c Phng.

    13

    172.16.2.62/26 -> a ch host cui 172.16.2.63/26 -> a ch broadcast ------------------------------------------------- 172.16.2.64/26 -> a ch mng 172.16.2.65/26 -> a ch host u .. 172.16.2.126/26 -> a ch host cui 172.16.2.127/26 -> a ch broadcast -------------------------------------------------- 172.16.2.128/26 -> a ch mng 172.16.2.129/26 -> a ch host u .. 172.16.2.190/26 -> a ch host cui 172.16.2.191/26 -> a ch broadcast -------------------------------------------------- 172.16.2.192/26 -> a ch mng 172.16.2.193/26 -> a ch host u .. 172.16.2.254/26 -> a ch host cui 172.16.2.255/26 -> a ch broadcast .. 172.16.255.0/26 -> a ch mng 172.16.255.1/26 -> a ch host u .. 172.16.255.62/26 -> a ch host cui 172.16.255.63/26 -> a ch broadcast ------------------------------------------------- 172.16.255.64/26 -> a ch mng 172.16.255.65/26 -> a ch host u .. 172.16.255.126/26 -> a ch host cui 172.16.255.127/26 -> a ch broadcast

  • TRUNG TM TIN HC VNPRO 149/1D Ung Vn Khim, Phng 25, Qun Bnh Thnh, Tp.HCM Tel: 08 35124257 Fax: 08 35124314 Website: www.vnpro.vn Forum: http://www.vnpro.org Livechat: www.vnpro,vn/support Email: [email protected]

    a ch IP GV: L c Phng.

    14

    -------------------------------------------------- 172.16.255.128/26 -> a ch mng 172.16.255.129/26 -> a ch host u .. 172.16.255.190/26 -> a ch host cui 172.16.255.191/26 -> a ch broadcast -------------------------------------------------- 172.16.255.192/26 -> a ch mng 172.16.255.193/26 -> a ch host u .. 172.16.255.254/26 -> a ch host cui 172.16.255.255/26 -> a ch broadcast Ta thy octet th 3 (l octet b mn nhng khng b chia ct thnh net v host) tng dn t 0 n 255. Trong khi , octet th 4 (l octet b chia ct) thay i theo bc nhy khi a ch l a ch mng (n b mn 2 bit nn c bc nhy l 64). Subnet mask trong v d ny l 255.255.255.192. 4.2. Cho mt a ch host. Xc nh xem host thuc mng no: Ta xem xt cc v d sau: VD1: Cho a ch host 192.168.1.158/28. Hy cho bit, host ny thuc v subnet no? Gii: /28 => c 28 bit mng. Octet b chia ct l octet th 4 => s bit mn ca octet ny l 4 => bc nhy l 16. Ly octet th 4 ca a ch host l 158 chia cho 16 c 9 v cn d. Ta ly 16 nhn vi 9 c 144. Host ny thuc mng 192.168.1.144/28 VD2: Cho a ch host 172.16.159.2/18. cho bit a ch ny thuc subnet no? Gii: /18 => c 18 bit mng. Octet b chia ct l octet th 3 => s bit mn ca octet ny l 2 => bc nhy l 64. Ly octet th 3 l 159 chia cho 64 c 2 v cn d. Ta ly 64 nhn vi 2 c 128. Host ny thuc mng 172.16.128.0/18.

  • TRUNG TM TIN HC VNPRO 149/1D Ung Vn Khim, Phng 25, Qun Bnh Thnh, Tp.HCM Tel: 08 35124257 Fax: 08 35124314 Website: www.vnpro.vn Forum: http://www.vnpro.org Livechat: www.vnpro,vn/support Email: [email protected]

    a ch IP GV: L c Phng.

    15

    4.3. Cho s mng, xc nh s bit mn ph hp chia subnet: VD:

    Ch cho mt mng 192.168.1.0/24. Hy m bo cung cp cc a ch IP cho s mng trn. Ta thy: C tt c 5 mng, mng nhiu host nht l mng c 26 host (cng thm mt a ch cng router). Gi s bit mn l n s bit host l m. Ta c h sau: 2n 5 (s mng chia ra ti thiu phi bng 5).

    2m 2 26 (nu mi mng con p ng c s host ca mng 26 host, n s p ng c yu cu v s host ca tt c cc mng cn li trn s ).

    m + n = 8 n = 3, m = 5 l ph hp. Vy ta c tt c 23 = 8 mng v mi mng ny c

    25 2 = 30 host, p ng c yu cu ca s trn. xc nh c cc mng c th, s dng cc quy tc chia subnet c trnh by mc 4.1 trn. 4.4. Chia subnet VLSM: - VLSM (Variable Length Subnet Mask): l k thut chia nh mt mng thnh cc mng c di khc nhau (s c cc subnet mask khc nhau). - Xem xt v d sau:

  • TRUNG TM TIN HC VNPRO 149/1D Ung Vn Khim, Phng 25, Qun Bnh Thnh, Tp.HCM Tel: 08 35124257 Fax: 08 35124314 Website: www.vnpro.vn Forum: http://www.vnpro.org Livechat: www.vnpro,vn/support Email: [email protected]

    a ch IP GV: L c Phng.

    16

    - Cng dng mng 192.168.1.0/24 t a ch cho tt c cc mng trn . Tuy nhin ta khng th lm nh v d trc, chia mng 192.168.1.0/24 thnh cc mng bng nhau v s khng c cch chia no ph hp cho s trn: nu mn 1 bit th p ng c yu cu v s host cho mng 100 host v mi mng c chia ra c 126 host nhng li khng p ng c yu cu v s lng subnet v ta ch chia c c 2 subnet nu mn 1 bit trong khi trn s c ti 5 mng. Ngc li, p ng nhu cu v s lng mng trn s , ta phi mn ti thiu l 3 bit (23 = 8 subnet) nhng khi mi mng li ch c nhiu nht l 30 host ( 25 2 = 30) khng p ng c yu cu v s lng host trn cc mng ca s trn. - Cch thc tin hnh l: s xt cc mng theo th t s host t cao xung thp. - u tin , xt mng nhiu host nht:100 host, ta phi xem mn bao nhiu bit th cho mng ny. Ta gii h: 2m 2 101 m + n = 8 (mn bit octet th 4).Vi m: s bit host, n: s bit mn Ta c m = 7, n = 1. Vy ta mn 1 bit v dnh mng 192.168.1.0/25 gn cho mng c 100 host. Mi mng /25 c 27 2 = 126 host => p ng cho mng 100 host. Vy di a ch 192.168.1.0/24 cn li cc a ch t 192.168.1.128 -> 192.168.1.255. - Tip ta xt n mng c 50 host, tng t ta xem xem mn bao nhiu bit l ph hp: 2m 2 51 m + n = 8 (mn bit octet th 4). Vi m: s bit host, n: s bit mn Ta c m = 6 v n = 2 l ti u. Vy ta mn 2 bit, mng 192.168.1.0/24 c chia thnh 4 mng 192.168.1.0/26, 192.168.1.64/26, 192.168.1.128/26 v 192.168.1.192./26. Tuy nhin hai di a ch ca hai mng 192.168.1.0/26 v 192.168.1.64/26 c ginh cho mng 100 host. Do ta ch c th ly t

  • TRUNG TM TIN HC VNPRO 149/1D Ung Vn Khim, Phng 25, Qun Bnh Thnh, Tp.HCM Tel: 08 35124257 Fax: 08 35124314 Website: www.vnpro.vn Forum: http://www.vnpro.org Livechat: www.vnpro,vn/support Email: [email protected]

    a ch IP GV: L c Phng.

    17

    mng 192.168.1.128/26 gn cho mng 50 host. y ta ly mng 192.168.1.128/26 gn cho mng 50 host. - Tip ta xt n mng c 20 host, ta xem xem mn bao nhiu bit l ph hp: 2m 2 21 m + n = 8 (mn bit octet th 4). Vi m: s bit host, n: s bit mn Ta c m = 5 v n = 3. Vy ta mn 3 bit, mng 192.168.1.0/24 c chia thnh 8 mng 192.168.1.0/27, 192.168.32.0/27, 192.168.64.0/27 v 192.168.96.0/27, 192.168.128.0/27, 192.168.1.160/27, 192.168.1.192/27, 192.168.1.224/27 . Tuy nhin cc di a ch ca cc mng 192.168.1.0/27 ,, 192.168.1.160/27 c ginh cho mng 100 v mng 50 host. Do ta ch c th ly t mng 192.168.192.0/27 tr i gn cho mng 20 host. y ta ly mng 192.168.1.192/27 gn cho mng 20 host. - Tip ta xt n cc mng c 2 host l cc lin kt im im serial, ta xem th mn bao nhiu bit l ph hp: 2m 2 2 m + n = 8 (mn bit octet th 4). Vi m: s bit host, n: s bit mn Ta c m = 2 v n = 6 l ti u hn c, m bo khng b d a ch.. Vy ta mn 6 bit, mng 192.168.1.0/24 c chia thnh 26 = 64 mng 192.168.1.0/30, 192.168.1.4/30, 192.168.1.8/30,, 192.168.1.248/30, 192.168.1.252/30 . Tuy nhin cc di a ch ca cc mng 192.168.1.0/30 ,, 192.168.1.222/27 c ginh cho mng 100 host, mng 50 host v mng 20 host. Do ta ch c th ly t mng 192.168.224.0/30 gn cho cc mng 2 host. y ta ly mng 192.168.1.224/30 v 192.168.1.228/30 gn cho hai lin kt serial. Vy. ta c kt qu chia VLSM nh sau:

  • TRUNG TM TIN HC VNPRO 149/1D Ung Vn Khim, Phng 25, Qun Bnh Thnh, Tp.HCM Tel: 08 35124257 Fax: 08 35124314 Website: www.vnpro.vn Forum: http://www.vnpro.org Livechat: www.vnpro,vn/support Email: [email protected]

    a ch IP GV: L c Phng.

    18

    - Ch : m bo ti u ha s phn b a ch, ta thng dng VLSM chia nh mng. c bit, cc kt ni serial thng s dng cc mng c prefix l 30 vi subnet mask 255.255.255.252. 4.5. Tm tt a ch (summary): - Tm tt a ch nhm mc ch lm gn bng nh tuyn ca cc router. Cc a ch mng s c tm tt v mt a ch mng ln hn i din bao trm tt c cc mng c tm tt. - Chng ta xem xt v d sau: VD: Hy tm tt cc mng sau y thnh mt a ch mng duy nht: 192.168.0.0/24 192.168.1.0/24 192.168.2.0/24 192.168.3.0/24 Nguyn tc khi tm tt l xem xt cc octet t tri qua phi v bt u phn tch t octet c s khc nhau u tin. Trong trng hp ca v d trn, octet th ba l octet khc nhau u tin. Ta xt chi tit octet ny: 192.168.|000000|00.0 192.168.|000000|01.0

    192.168.|000000|10.0 192.168.|000000|11.0

    Ta thy octet th ba cn c thm 6 bit ging nhau. Vy ta c mng tm tt l 192.168.0.0/22. Ch : subnet mask by gi l 255.255.252.0 vi prefix l 22.

  • TRUNG TM TIN HC VNPRO 149/1D Ung Vn Khim, Phng 25, Qun Bnh Thnh, Tp.HCM Tel: 08 35124257 Fax: 08 35124314 Website: www.vnpro.vn Forum: http://www.vnpro.org Livechat: www.vnpro,vn/support Email: [email protected]

    a ch IP GV: L c Phng.

    19

    4.6. Bi tp: thng tho cc k thut tnh ton IP, cn phi thc hnh nhiu cc k nng nu ra trn. Sau y l mt s bi tp thc hnh: 4.6.1. Cho mng v s bit mn. Gi s c h tr subnet zero. Hy xc nh : - S subnet c th c. - S host/subnet. - Vi mi subnet, hy xc nh: a ch mng, a ch host u, a ch host cui, a ch broadcast (nu s lng mng qu nhiu ch cn ghi ra mt vi mng u v mng cui cng), subnet mask v s prefix.

    a) 192.168.2.0/24 mn 5 bit. b) 192.168.12.0/24 mn 3 bit. c) 172.16.2.0/24 mn 2 bit d) 172.16.0.0/16 mn 3 bit e) 172.16.0.0/16 mn 12 bit. f) 10.0.0.0/8 mn 5 bit. g) 10.0.0.0/8 mn 10 bit. h) 10.0.0.0/8 mn 18 bit.

    4.6.2. Cho mng 172.16.5.0/24. Hy chia nh sao cho ph hp vi s sau:

    4.6.3. Cho cc a ch host sau y. Hy xc nh cc a ch subnet tng ng v cho bit a ch ny c th dng t cho host c khng:

    a) 192.168.1.130/29 b) 172.16.34.57/18 c) 203.162.4.191/28 d) 1.1.1.1/30 e) 10.10.10.89/29 f) 70.9.12.35/30

  • TRUNG TM TIN HC VNPRO 149/1D Ung Vn Khim, Phng 25, Qun Bnh Thnh, Tp.HCM Tel: 08 35124257 Fax: 08 35124314 Website: www.vnpro.vn Forum: http://www.vnpro.org Livechat: www.vnpro,vn/support Email: [email protected]

    a ch IP GV: L c Phng.

    20

    g) 158.16.23.208/29 4.6.4. Hy tm tt cc a ch mng sau y v thnh mt a ch mng i din: a) 192.168.0.0/24 192.168.1.0/24 192.168.2.0/24 192.168.3.0/24 b) 172.16.16.0/24 172.16.20.0.24 172.16.24.0/24 172.16.28.0/24