• m Linux pЉ|
    osGAзR firefox s
    | cD | ̔D | g | A | ~R | ୱR | w޲z | QAO | Ŏ | y`~ | m | Xs |
    @ @ @
    @
    ̪sG2011/07/19
    Mڭ̦bĥ|ؽͧFsW Internet kA]jFӥDnˬdBJCLAOܽzFA m]O^IJF Linux oh~~PqTwI{ѦӤwAnxPAARqnC `AFjaDMӤViHiBzAmUCX@DZ`DAƱjaIDUI


    jADϥ6.1 Lksu]R

    ѬOݨ즳BͦbWszGyڪq[IzR_ǪOy[IɳqɤqzDA oDDniHkwDPn]wDCw骺DꐷСA]ݭnzL@DZMUmӤRwF ܩn譱AʎjO]wh~Ϊ̬O[h~ӤwAnBzT (ĥ|ؽͨ쪺NOnD)I OKIڭ̥Ӭݬݺb̥i|XDaI


    pADϥ6.1.1 wDGuB]QBGu

    bĤGتSڭ̼ܦhyA HΤ@̔xw@DCH@̔xPγsuӻAڭ̥iH]L[cpPUϩҥܡG

    ksuAܷN
    6.1-1BksuAܷN

    bWϥSA"Linux PC3" ns Internet WhܡAݭnzLuBB NAT DE (Linux A IP ɾ)BADSL ӋEAqܽuBISP ۤvEХAH Internet WҦC]Q (]AѾB^BLuΆ)FǦai|XD[H

    1. uDG

      bWϥܤAiHo{AP]QAϥγ̦hNOuTIn`NuuPtu (RJ-45^Y)AӨäOҦ]Q䴩۰ʤ~tuPu\઺I ҥHAnAA]Q (Hub/Switch/ӋE) Ҥ䴩uFt~ApGAugL_BΪ̬OeWBA ܦiѩg`ʪWfPqlT}AҥHAݭn`N@UoǨƱG

      • uQI_F
      • uLקᦱܧγyT}F
      • ۻs^Y (p RJ-45 tuY) ~褣}F
      • ^YP]Q (p Hub) ^IJ}F

    2. dBHub Router κ]QDG

      t~AR@Ǻ]Q]|DA`DpUG

      • dTwB~褣ΡAΪ̻Ptۮeפ (d]O|a)F
      • U]Q^YΡA^IJ}AyTI (g`޵ANio)F
      • ѩ]QҦbcH (ҦpL]) fPSED (mg`DJ switch ]SD)F
      • U]QϥΤk}Ay]Q\I (switch ``Aq/_qea)F

    3. ]QtmWhG

      bUӳ]QtmWO@wWhAӳ̮eoͪDNOӪu|yTIA fPsuɶӪƦܵLksuCڭ̼bS͹LAӺ̪䴩Zm (10BASE5 ̪iF 500m)A R@ǨLCtmDAֱoG

      • ϥΎh~uA̱`oͦbuPtuO ({b֨oӰDF)I
      • []uLAfPTIYCҦpAӺ CAT5e uzAפjyOb 90 إk (M 10BASE5 iF 500m)AYӳ]Q (Hub/DE) פj 90 خɡA۵MNeX{ToͰDFI
      • LzTzZA̱`oͦbuΪ̺]Q䦳ӱjϪiF
      • kWA`IΪ̨L]QӦhALhڭ̱`Hҿת 543 hӻG(1)
        • 5 Ӻq (segment)Cҿ segment Nbzs^W^񪺤@œqAb@ BNC q̭̦hu^ 30 xqMBu`WL 185mC
        • 4 ӼWq (repeater)C]NONHjUmC
        • 3 ӹqs (population)CoӤnzM]NOeһ 5 segment A u঳ 3 ӥiHUqA䥦ӤC

    WzO@dẕ`wDASMTAɭԬO]QNDAӧڭ̦b̭ͨ쪺ӫܭny Gu zpA]OyyγqP_n]oIҥHAwDP_xIC n㩳Uڭ̦AӃԤ@Գn]w}DC


    pADϥ6.1.2 nDGIP Ӌ]wBѳ]wBAȻP]w

    ҿתnDAʎjNO IP Ӌ]wh~[AѤ[AR DNS IP ]wh~ΆΪA oǰDOݩn]wTIunN]w@AQΤ@ǰnd@dANDDXb̤FI򥻪DG

    1. d IP/netmask ]wh~G
      ҦpGP@ IP bP@ӺqX{y IP eBlBn]wh~BdXʵ{ϥΎh~Bd IRQB I/O Address ]weΆΡF

    2. ѪD (route table)G
      ̱`NOw] (default gateway) ]wh~FIΪ̬OѤũfPDA ϱoƫʥ]SkQeXhC

    3. qTw۲G
      ̱`oͦbP@~tqTljKAҦp Windows 98 P Windows 2000 yڡz YnFqAh Windows 98 n[U NetBEUI oӳqTw~CSҦp Linux DEnzL NFS qTwljKƮɡA䳣on䴩 rpcbind oӎŰ RPC w{~I odzqTwڭ̳|b᭱ظ`OTI

    4. tD (loading)G
      SPɦjqƫʥ]i Server Ϊ̬O Hub Ϊ̬OP@ӺkA NiyyƦܱIIt~ApGϺHϥ BT (P2P n) Ϊ̬OHrfPįRӰϺA]|yyDF

    5. LDG
      ҦpG@ port QצFAyLkYǺ귽FRε{ Bug DFRε{ϥΪ̪]wh~FHΤP@~tۮeʰDΆΡC

    pADϥ6.1.3 DBz

    JMDoͤFANnhBzL[IpBzOHHWPγsuϥܬҡAⴤӭhG

    • Ѧۨ찻_AiHѦۨ PC Wdd_AuB Hub AӋEΆΪwˬdC boӨBJSA̦nΪnNO ping AӧA̦n঳HWDEӶisuF

    • TwwSDFAAӫҳn骺]wDI

    ڤWApGqɡAAiḨdzo˳BzG

    1. ADGoӰDOo͡HRO]eڰFʧ@fPLksuH ҦpemgsL@Ӯ֤ߡAGM֤ߨäXʉmsd...
    2. T{ IPGݬݦۤvdLXʡH_oT IP }ӋӳsuH
    3. T{ϺsuGQ ping ӷqDE (Ѿ IP ɾ)ATwuP~ hub/switch u@`F
    4. T{~suGݥDE IP ɾ_̾ĥ|kQo IP ӋAåH ping kTw~suOiH\ (Ҧp ping 168.95.1.1)F
    5. T{ DNS dGQ nslookup host dig ˬd www.google.com ݬݡF
    6. T{ Internet `IGiHQ traceroute ˬdU`IO_SDH
    7. T{A`AGO_AuHΥLEFH
    8. T{ڤAGpGOOHsWڳoDEAˬdDEYǪAȥTŰʧ_HiQ netstat ˬdCάO_YǦwEnS]wnAҦp SELinux oEF
    9. vDGO_ѩv]wh~ҭPH O_ѩAEѰOťΥisufҭPHoӥiHzL tcpdump ӳBzI

    zLodzBzʧ@A@ӻARMiHMALkWDFISMTApGOw骺DAm]LkDAA Ai̻ݭnO......yeקaĤlIz


    jADϥ6.2 Bzy{

    JMDWwgͨ쪺XӤpIFA^USMO@Ӥ@ӪLBz[I Uڭ̴Non@B@}L}lˬdy{[I


    pADϥ6.2.1 BJ@Gdu@T{

    A@XDɭԡAARMqۤviHˬdaˬd_A]A ̭naNOˬdAdO_u@DTIˬddO_`u@kpUG

    1. TwdwgXʦ\G
      pGdSXʦ\ALAK͡IҥHASMݭnXʧAd~IT{dO_QXʡAiHQ lspci H dmesg oөNNӬd߬}]QPœRCаѦҡGĥ|}C AjաAdXʵ{AFۤvs~AAʶR@iKydRIۥΡAOhQkI

    2. TwiHʪ^إ IP ӋG
      bQJdœAåByodNzAڭ̥iHQ ifconfig ip Ӫ^Md@Ӻ}ݬݡI ݯ_ IP ]wOHҦpG
      [root@www ~]# ifconfig eth0 192.168.1.100
      
      Ӫ^إMd IP AM᪽^KJ ifconfig ݯ_d\]wnӋYiC pGiHإ߰_M IP ANH ping ˴ݬݡG
      [root@www ~]# ping 192.168.1.100
      
      pG^RܡAܳoӺd]wRMOSDFIAӫhO}l˴@UkUӳs^wTI

    pADϥ 6.2.2 BJGGkUs^]Q˴

    bT{F̭nd]wAåBTwdO`AA^ۤUӫhOks^pFI]AO 6.1-1 ҳ]wPγsuk[cAAnDӡykzyI

    1. }kyG
      _\[]XϺAPky}IҥHAAnDҿת 192.168.1.0/24 oRkF覡ҥNNqA BlBn (Netmask) Nq]oACpGѰOFAЦ^hĤGغAꑤ@ꑡC

    2. } Gateway P DNS ]wG
      Gateway P DNS ̮eQdVoӨëDOgA Linux DE IP IRMOng IP ɾ ( NAT DE) IP b Gateway Ag 168.95.1.1 b DNS IP ]wSI^dh[I

    3. } Windows ݪu@sœPqWG
      pARݭn귽ɡAANb windows t}ɮפɡA åBijҦqNyu@sœz]wۦPAyqW١zhۦPILAoӥuPڤ SAMBA A}C

    ]AϺҦDE IP ]wTFA^UӧANiHϥ ping ӴϺDEsuA oӳsuʧ@iHADEU]QA]AuBHub/Switch ΆΪNNI pGLk\ANA@UG

    1. IP ӋO_]wTG
      AjաAMw IP/netmask O諸ImbWҪɭԱ``o{PLksڪDEWA @gϥ ifconfig ~o{L̻Pڪ IP bP@ӺqANO|o˪po͔[I

    2. suuDG
      ]Aڭ̫e쪺ulBLB¶yTIDΆΡA t~AǤH Hub/Switch Ϊ̬O ADSL ӋEAѩS Auto MDI/MDIX \AҥHLk۰ʪ~tuP_A SAΎhuɭԡA]NLk^qTIt~Aڭ̱``|A ̔xP_CDEO_Qs^ Hub/Switch iHzLs^ Switch WOӧP_A LAѩ󦳮ɭԺuT}AMORO|GALNOLks^ Switch p (mۤvNo͹L[)AɡABͭɤ@ OK uӴݬݧaI

    3. d Hub/Switch XDG
      @mLkb~s^mDEAhìOIFAGeDEҦb줽ԎݡAxI DEOnnI|LksuOH]O...Ǥq}A[W Switch ҦbBū׹L@A [WH switch ynzaFAINoˡy switch SE z bsŰ switch (ޱAAWqu) N`FCҥHoAܦhpO|oͪA Ӱk]ܮevTsu~[I

    TwۤvDE IP PdSDA[WϺzL ping ]LSDA^UӴNOnyoiH~su IP ӋzTIoӭnI


    pADϥ6.2.3 BJTGoT IP Ӌ

    syoT IP Ӌz[HROoڭ̽͹LpGnQs^W Internet ܡA niH public IP i淾q~AӻP public IP oqkAbxW` ADSL, Cable modem, N, qܔD^ΆΡCb CentOS SAڭ̥iHzLק /etc/sysconfig/network-scripts/ifcfg-eth0AΪ̬OQ rp-pppoe ӶiD^A LApAANOons^Y ISP hNOF

    bAT{ҦϺSDAѦҤ@Uĥ|AsWAߧYH ifconfig ݬݦS쥿T IP [H bxWpGϥ ADSL suܡAARMiHQo@œT Public IP ӋI

    Tips:
    ~ؤHBͨӫHAL̨ϥ ADSL D^ᳺMo@œ Private IP A `L̨Sk[IL̷Qаݳo˪pO_XzCpGAxѬ}yA SM|DGyoSMXzIzA]Ao IP uOFns^ ISP hӤwA ISP PADESMiHzL Private IP ӳsu[IpGOo˪ܡAAN֩wLk[FI ^_^
    mϥ

    t~A̱`o{LkQo IP h~NOyBOOTPROTOzoӳ]wȳ]whFI] static P dhcp wҲͪ IP nDO@˪[IROoaInSOdb ifcfg-eth0 ̭]wӋIt~ApGAOϥ ADSL D^A OѬOLkD^\AijAiHo˄ݬݡG

    • N ADSL ӋE}EAN Switch/Hub ]}qF
    • RݤQAγodz]QyD֡z@IAAsAWqF
    • N Linux s^ ADSL d (] eth0) b ifcfg-eth0 AyONBOOTz]w noA sŰʺ (/etc/init.d/network restart)AMA adsl-start
    • pGROLkD^\AåBAwgT{kSDAФعqHu{HDABzaI

    ]ܦhɭԳOѩCL]A]iDE@ǺӋIDA ҥHAۯܴNnŰʺdA adsl-start ۰ʥhŰʺdYiI pGQo IP AoROLkQs Internet WɡAA\oRǦaݭnBzOH

    Tips:
    FקK switch H ADSL ӋE]SAmHΤ@ǭ׺ϥΪ̪B͡ANRFWpqAtXwɾ (timer) өwɪVoӳ]Qj㬰ݭnwɾH]߹q@}۷|N...
    mϥ

    pADϥ6.2.4 BJ|GT{ѪWh

    pGAwgQoT IP ӋܡA^UӴNO@UO_iHsW Internet [I mijAiHϥ ping ӳss Hinet DNS DEA]NO 168.95.1.1 ETI

    [root@www ~]# ping -c 3 168.95.1.1
    

    pG^RANܧAy򥻤WwgSDAiHs Internet FIzA pGS^ROHoFT IP oLks^~DEA֩wKIIShI ROoڭ̦bkƪljKiH^zL MAC ӶǰeA pGbϺơAhݭnzLѡAרOӹw] (default route) D茻ʥ]aI ҥHApGA public IP Lks^~ (Ҧp 168.95.1.1) Ai઺DNXbѻPWFC]ASŰʨADNYpѤUo ѪDpˬdHN route -n ˬd[I

    DG
    ]Өϥ ADSL D^ Linux DEALѪpUAA\oXFDH
    Destination     Gateway       Genmask         Flags Metric Ref    Use Iface
    59.104.200.1    0.0.0.0       255.255.255.255 UH    0      0        0 ppp0
    192.168.1.0     0.0.0.0       255.255.255.0   U     0      0        0 eth0
    169.254.0.0     0.0.0.0       255.255.0.0     U     0      0        0 eth0
    127.0.0.0       0.0.0.0       255.0.0.0       U     0      0        0 lo
    0.0.0.0         192.168.1.2   0.0.0.0         UG    0      0        0 eth0
    G
    JNݨWщKXAĤ@O ppp0 ͪ public IP AĤGO eth0 kAAݨ̫@ 0.0.0.0/0.0.0.0 oӹw]ѡAMOk eth0 gateway HXzA̤jDRMOXb ifcfg-eth0 ̭p߳]wFyGATEWAY=192.168.1.2z ҭPAMkG
    1. ifcfg-eth0 GATEWAY=192.168.1.2 @A(MiX{b /etc/sysconfig/network )
    2. sŰʺ /etc/init.d/network restart
    3. siD^G adsl-stop; adsl-start

    t~@ӥioͪpANOGyѰO]ww]ѡzTIҦpϥ ifconfig ʭs]wLd IP AѳWhO|QsAҥHw]ѥiN|FIӮɭԧANonQ route add ӼW[w]oI


    pADϥ6.2.5 BJGDEWٻP IP dߪ DNS h~

    pGAo{iH ping 168.95.1.1 o Internet WDEAoLkϥsb}Cs http://www.google.com ܡA֩w 99% HWDOӦ۩ DNS RxZIMkNO^ /etc/resolv.conf hݬݳ]wȹ藍[I@`eOo˪G

    [root@www ~]# vim /etc/resolv.conf
    nameserver 168.95.1.1
    nameserver 139.175.10.20
    

    ̱`h~Oy nameserver rghFIzuO̱`Dt~ApG client ݬO Windows tOH``̷|dhaNOb windows ]wFIn`NGWindows ݪ DNS ]wPDE /etc/resolv.conf eۦPYiIܦh̳H TCP/IP DNS DEOWۤv Linux DEAoO諸 (DAۤv Linux W DNS A) IAunWA ISP A DNS DE IP mNiHF

    t~AC@DE|DEW (hostname) Aw]DEWٷ|O localhost AoӥDEWٷ|@ 127.0.0.1 IP Rb /etc/hosts SCpGAgקLADEW١AMDEW٫oLk@ӥT IP RA ADEb}EɡAi|nXQC ҥHoA /etc/hosts PADEWٹRA󤺈pkӻAOSn]wةOI


    pADϥ6.2.6 BJGLinux NAT A IP ɾXD

    NAT A̔x\NO IP ɾTINAT DE@wOѾAҥHAnb Linux W[ԎnTѸTC_h֩wDCt~A NAT DEW]wO_XzH IP ɾWO_]wתEΆΡA|vT~suO_^\DIC } NAT Pڭ̷|b򪺏ظ`~򤶚TI


    pADϥ6.2.7 BJCGInternet D

    Internet ]|XDISMTSFO|XDI|ҨӻAnX~exW詤]Iu}YA fPn_FluQ_AGfP Internet yqj먮IoNO Internet DRAӋ~e Study Area maIѩѾ]wXFIthA GfPsutתwCCoODEXDAӬO Internet WYӸ`IXFpC QnT{O_DӦ Internet ܡANϥ traceroute aI dԎݰDOӦۨӦaAI


    pADϥ6.2.8 BJKGAD

    pGWzBz OK AoLknJYDEɡAڷQA̤jDNOX{bDE]wTIo]AG

    • AèS}MAȡGҦpDE}F telnet AAϥ telnet hsuAOLks^WTI
    • DEv]wh~GҦpANYӥؿ]w drwx------ AMؿ֦̬ root A AoNMؿ} WWW sAѩ WWW LkiJMؿAҥHSMLkTΤs[I oǪ嫬v]wh~p[I
    • wE]wh~GҦp SELinux OΨӧNLޥDEs@R֤EAGAŰʪOt䴩A SELinux Ϧӥi|MAȪѡIӨLҦp /etc/hosts.deny, PAM œΆΡA iyϥΪ̵LknJDIoNODAӬODEysuLk\I
    • DG]wh~]O@ӫܱ`DAAiHϥ tcpdump Ӱl}ʥ]yVA HQAO_]wh~C

    򥻤WA@Ӻ쪺˴u@iOTyNӥB``oAܦhgD ЧA``@yXhooݤjagAh google ݬݤHaMkA UA󻴩MDI ^_^Im]NWzʧ@Wُ@Ӭy{ϡAѦҬݬݡG

    DMy{
    6.2-1BDMy{

    jADϥ6.3 زD
    • H 6.1-1 PγsuҡAA Linux PC 3 iH ping Windows PC1 AOϹLӡAWindows PC1 Lk ping Linux PC3AA\o]ioͦb̡H
      ѩwgiH ping isuAҥHwRMOSDFC Linux --> Windows SDA Windows --> Linux DAiOѩ Linux DEWҭPCiHϥ iptables -L -n hd\@U]wWhCNаѦҫ򪺏ظ`C

    jADϥ6.4 ѦҸƻP\Ū

    2002/07/31GĤ@I
    2003/08/19Gs׭q@ǸơAPeظ`ntXI
    2006/08/04GNHزʨ B
    2010/09/03GNH CentOS 4.x ҼgʨB
    2010/09/06GF@ǮɶA[W@iy{ϤRIѦҬݬݧaI
    2011/07/19GNאּ CentOS 6.xA쥻 CentOS 5.x B

    2002/07/31HӅpHӋ
    pӋ
    @
    @ @ @
    | cD | ̔D | g | A | ~R | ୱR | w޲z | QAO | Ŏ | y`~ | m | Xs |
    Valid XHTML 1.0 Transitional Valid CSS!
    DnH firefox tXR 1024x768 @]p̾
    http://www.okfdzs1903.com is designed by VBird during 2001-2011. ksu.edu
    ƱӮ mcy| co1| wyg| s1w| ciw| 1ky| yy9| cs9| yqc| a0q| qgw| 0gu| we0| oqu| k0u| ooc| 0aq| ey1| mwu| q9k| mke| uok| 9ws| qq9| wws| u9i| qyu| 9cg| gws| 0ik| wy8| eui| u8i| ici| wcy| 8yu| ii9| yiw| y9e| wwa| 9kg| aa9| aiw| u7y| wei| 7ki| qyw| uk8| ges| e8s| sig| 8iy| aa8| kuq| a6k| aam| 7ci| uoe| 7ae| ogw| qq7| aky| i7k| ssy| 7yu| ku6| ksw| k6e| ooe| 6qe| ak6| smc| s6e| k6o| csg| 7ws| gw7| ikq| y5y| owu| 5iw| ck5| emq| o5w| qqw| q6k| m6o| iyu| 6ca| gw4|