³¾­ôªº Linux »P ADSL ¨p©Ðµæ


Linux ºô¸ô°»¿ù
¥»¤å¤w¤£¦AºûÅ@¡A§ó·s¤å³¹½Ð°Ñ¦Ò ¦¹³B
³Ìªñ§ó·s¤é´Á¡G2003/08/19
¡@
Linux ³Ì±jªº¡A¤]¬O³ÌÅý¤HºÙ¹Dªº¦a¤è¡A´N¬O¥Lªººô¸ô¥\¯à¤F¡A¤£½×¬O Mail server¡BWeb server¡BProxy serverµ¥µ¥¡A³£¦n¦n¥Î³á¡I¦ý¬O¡A§Ú­Ì¤]±`¦bºô¸ô¤W¬Ý¨ì¤@°ï±`¨£ªº°ÝÃD¡A´N¬O¦b°Ý¡y§Úªº Linux ¨S¦³¿ìªk³s¤Wºô¸ô¡A¸Ó¦p¦ó¬O¦n....¡zµ¥µ¥ªº°ÝÃD¡A°Ý¨Ó°Ý¥hªº­«ÂI¤j·§³£¬O¤@¼Ëªºª¬ªp¡I¶Ë¸£µ¬¡I¨º³¾­ô´N§â¤@¨Ç¦b Linux ¤W­±¥i¯à·|µo¥Íªººô¸ô°ÝÃD§â¥L¾ã²z¤@¤U¡A¬Ý¬Ý±z¬O¤£¬O¦³³o¤è­±ªº°ÝÃD¡A°Ñ¦Ò¬Ý¬Ý§a¡I
¡@
ÁA¸Ñµo¥Íºô¸ô°ÝÃDªº¥i¯àª¬ªp¡G
¨BÆJ¤@¡Gºô¸ô¥d¤u§@½T»{¡G­«·sÅX°Êºô¸ô¥d
¨BÆJ¤G¡G°Ï°ìºô¸ôµwÅé³s½u½T»{
¨BÆJ¤T¡G½T»{¸ô¥Ñªí¸ê®Æ¨S¦³°ÝÃD
¨BÆJ¥|¡G½T»{ DNS ªº IP ³]©w
¨BÆJ¤­¡GNAT ¥\¯à( ©Î IP ¤À¨É¾¹ )¬O§_¥¿±`
¨BÆJ¤»¡GADSL ¼Æ¾Ú¾÷©Î router ªº°ÝÃD
¨BÆJ¤C¡G¥D¾÷ªA°È¬O§_Ãö±¼¤F»PªA°ÈÅv­­ªº°ÝÃD

ÁA¸Ñµo¥Íºô¸ô°ÝÃDªº¥i¯àª¬ªp¡G
¨BÆJ¤@¡Gºô¸ô¥d¤u§@½T»{
¨ä¹ê¡Aºô¸ô¤@¥X°ÝÃDªº®É­Ô¡A±zÀ³¸Ó±q¦Û¤v¥i¥HÀˬdªº¦a¤èÀˬd°_¡A¦]¦¹¡A³Ì­«­nªº¦a¤è¡A´N¬O±zªººô¸ô¥d¬O§_¦³¤u§@ªº°ÝÃD°Õ¡IÀˬdºô¸ô¥d¬O§_¥¿±`¤u§@ªº¤èªk¦p¤U¡G
  1. ¨Ï¥Î lsmod ¬Ý¬Ýºô¸ô¥dªº¼Ò²Õ¬O§_¤w³Q¸ü¤J¡G

  2. °£«D±z´¿¸g¦Û¦æ½sĶ¹L®Ö¤ß¡A§_«hºô¸ô¥dªºÅX°Êµ{¦¡À³¸Ó¬O¥H¼Ò²Õªº«¬ºA¦s¦b¤~¹ï¡I¥Ñ©óºô¸ô¥d¬O³Ì°ò¥»ªººô¸ô¤¸¥ó¤§¤@°Õ¡I¨S¦³¥L¡A¦ÛµM¤]´NµLªk³s¤W Internet ¡A©Ò¥HÅo¡A½Ð¥ý½T»{¤@¤U±zªººô¸ô¥d¬O§_¤w¸g³QÅX°Ê§a¡I³o­Ó®É­Ô·íµM´N­n¨Ï¥Î lsmod ¨Ó¬Ý¬Ý°Õ¡I
    [root@test root]# lsmod
    Module                  Size  Used by    Tainted: P
    ipt_MASQUERADE          1216   1 (autoclean)
    iptable_filter          1696   1 (autoclean)
    ip_conntrack_irc        2592   0 (unused)
    ip_conntrack_ftp        3328   0 (unused)
    ip_nat_irc              2400   0 (unused)
    ip_nat_ftp              2976   0 (unused)
    iptable_nat            13588   3 [ipt_MASQUERADE ip_nat_irc ip_nat_ftp]
    ip_tables              11232   5 [ipt_MASQUERADE iptable_filter iptable_nat]
    ip_conntrack           13356   3 [ipt_MASQUERADE ip_conntrack_irc ip_conntrack_ftp ip_nat_irc ip_nat_ftp iptable_nat]
    ppp_async               6240   1 (autoclean)
    8139too                14208   2¡@¡@¡@<==³o­Ó´N¬O§Úªº¿ÀÃÉ¥d¼Ò²Õ°Õ¡I
    usbcore                29632   0 (unused)
    ¨þ¨þ¡I¨S¿ù¡I§Úªººô¸ô¥d¤w¸g±¾¤W¥h°Õ¡I©Ò¥H¨S¦³°ÝÃD¡I¨º»ò¦pªG¨S¦³µo²{©O¡H¶â¡I¨º»ò«Ü¥i¯à¬O¨S¦³®»¨ìµwÅéÅo¡I³o­Ó®É­Ô½Ð¥ý¥H dmesg ½T»{¤@¤U¬O§_¤w¸g®»¨ì¤Fºô¸ô¥dÅo¡I
    [root@test root]# dmesg
    ....²¤....
    PPP generic driver version 2.4.1
    NET4: Linux TCP/IP 1.0 for NET4.0
    IP Protocols: ICMP, UDP, TCP, IGMP
    IP: routing cache hash table of 512 buckets, 4Kbytes
    TCP: Hash tables configured (established 4096 bind 4096)
    Linux IP multicast router 0.06 plus PIM-SM
    NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
    VFS: Mounted root (ext2 filesystem) readonly.
    8139too Fast Ethernet driver 0.9.24  <==½T¹ê¦³®»¨ìÅo¡I
    eth0: RealTek RTL8139 Fast Ethernet at 0x6100, 00:50:fc:22:9c:57, IRQ 10
    eth0:  Identified 8139 chip type 'RTL-8139C'
    eth1: RealTek RTL8139 Fast Ethernet at 0x6300, 00:50:fc:22:9a:cb, IRQ 11
    eth1:  Identified 8139 chip type 'RTL-8139C'
    eth0: Setting half-duplex based on auto-negotiated partner ability 0000.
    eth1: Setting 100mbps full-duplex based on auto-negotiated partner ability 41e1.
    ¶â¡I½T¹ê¬O¦³®»¨ì§Úªººô¸ô¥d°Õ¡I¬O Ethernet ªººô¸ô¥dËç¡I
    ¡@
  3. ¨Ï¥Î ifconfig ¬Ý¬Ý¬O§_¦³ºô¸ô¥dªº¹B§@¥X²{¡G

  4. ¦b½T©wºô¸ô¥d¤w¸g³Q®»¨ì¤§«á¡AµwÅé´N¨S¦³°ÝÃD¤F¡A¦A¨Ó´N¬Oºô¸ô¥dªº³nÅé³]©w°ÝÃD¡C³q±`¨Ï¥Î¤F ifconfig ¤§«á¡A·|¥X²{¥Ø«eºô¸ô¥dªº IP ª¬ºA»¡©ú¡A¦pªG¨S¦³¥ô¦óºô¸ôµwÅé³QÅX°Êªº¸Ü¡A¨º´N¥H ifup eth0 ¨Ó±Ò°Ê¡A¦A¥H ifconfig ¨Ó¬Ý¬Ýºô¸ô³]³Æªº¹B§@¡I¦pªGÁÙ¬O¨S¦³¿ìªk±Ò°Êªº¸Ü¡A´N»Ý­n¨Ó­«·s¦w¸Ëºô¸ô¥dªºÅX°Êµ{¦¡¡I¦p¦ó½T©wºô¸ô¥d¦³µL¥¿±`¤u§@©O¡H²³æªº«Ü¡A´N¬O¨Ï¥Î ifconfig ³o­Ó«ü¥O¨ÓÀˬd¤@¤U§a¡I
    [root@test root]# ifconfig
    eth0      Link encap:Ethernet  HWaddr 00:50:FC:22:9A:CB
              inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:35747 errors:0 dropped:0 overruns:0 frame:0
              TX packets:38701 errors:0 dropped:0 overruns:0 carrier:0
              collisions:567 txqueuelen:100
              Interrupt:11 Base address:0x6300

    eth1      Link encap:Ethernet  HWaddr 00:90:CC:08:49:13
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:79570 errors:0 dropped:0 overruns:0 frame:0
              TX packets:69642 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:100
              Interrupt:10 Base address:0x6100

    lo        Link encap:Local Loopback
              inet addr:127.0.0.1  Mask:255.0.0.0
              UP LOOPBACK RUNNING  MTU:3924  Metric:1
              RX packets:4553 errors:0 dropped:0 overruns:0 frame:0
              TX packets:4553 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0

    ppp0      Link encap:Point-to-Point Protocol
              inet addr:140.116.141.114  P-t-P:140.116.141.253  Mask:255.255.255.255
              UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1
              RX packets:27577 errors:0 dropped:0 overruns:0 frame:0
              TX packets:25980 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:10

    ¦p¤W©Ò¥Ü¡A¬O§Úªººô¸ôªº³]©w¡A§Ú¦@¦³¨â­Óºô¸ô¥d¡A³]³Æ¦WºÙ¤À§O¬° eth0  (¹ï¤º¡A¨p¦³ IP )¤Î eth1 (¹ï¥~)¡A¦Ó¥Ñ©ó§Ú¬O¨Ï¥Î ADSL ¼·±µªº¡A©Ò¥H´N¦³ ppp0 ³o­Óºô¸ô¤¶­±Åo¡I¦Ü©ó²Ä¤T­Ó lo ¬O¥D¾÷¤º³¡ªº»¼°jºô¸ô¡A³o¬O¨C³¡¾÷¾¹³£·|¦³ªº¡C¦p¤W©Ò­z¡A¨º§Úªº¤T­Ó¤¶­±³£¦³¥X¨Ó¡A¨Ã¥B eth0 ªº IP ¬O 192.168.1.2 ³o¤@­Ó¡A¨º´Nªí¥Ü³]³ÆÀ³¸Ó¨S¦³°ÝÃD¤~¹ï¡I¦pªG·Q­n½T©w¤@¤U¨ì©³ºô¸ô¦³¨S¦³³q¡A±z¥i¥H¨Ï¥Î ping ªº¥\¯à¡G
    [root@test root]#  ping -c 5 192.168.1.2
    PING 192.168.1.2 (192.168.1.2) from 192.168.1.2 : 56(84) bytes of data.
    64 bytes from 192.168.1.2: icmp_seq=0 ttl=255 time=0.2 ms
    64 bytes from 192.168.1.2: icmp_seq=1 ttl=255 time=0.2 ms
    64 bytes from 192.168.1.2: icmp_seq=2 ttl=255 time=0.2 ms
    64 bytes from 192.168.1.2: icmp_seq=3 ttl=255 time=0.2 ms
    64 bytes from 192.168.1.2: icmp_seq=4 ttl=255 time=0.1 ms

    --- 192.168.1.2 ping statistics ---
    5 packets transmitted, 5 packets received, 0% packet loss
    round-trip min/avg/max = 0.1/0.1/0.2 ms

    ¦pªG¦³¦^À³ªº¸Ü¡A¦p¤W­±©Ò¥Ü¡A¨º´N¬O¥¿±`°Õ¡I
    ¡@
  5. ¤£¥²¼·±µªº¤wª¾©T©w¦¡ IP ªºÀˬd¤è¦¡¡G

  6. °²¦p¤w¸gª¾¹D±zªº¤½¦@ IP ¡B ³q°T¹h (GateWay)¡A¥B¤£¥²¼·±µªº±¡ªp (Giga ªº ADSL ¤£ºâ³o¤@ºØ¡I)¡A±z¥i¥Hª½±µ­×§ï /etc/sysconfig/network ¥H¤Î /etc/sysconfig/network-scripts/ifcfg-eth0 ³o¨â­ÓÀɮסAµM«á¥H ifup eth0 ±Ò°Êºô¸ô¥d¡A¨Ã¥H ping ±zªººô¸ô¥d IP ¨Ó¬Ý¬Ý¬O§_¦³¥¿±`¤u§@¡C
    [root@test root]# vi /etc/sysconfig/network
    NETWORKING=yes
    FORWARD_IPV4=yes
    HOSTNAME=your.domain.name
    ¨Ò¦p¤W­±ªº½d¨Ò¡A»Ý­nª`·Nªº¦a¤è¬O¦b GATEWAY=¤Î GATEWAYDEV=eth0 ³o­Ó¦a¤è (¥u»Ý­n¦³¤@­Ó§Y¥i) ¡A¨Ò¦p¦¨¤jÀô¤uªº gateway IP ¬O 140.116.44.253 ¡A¨º±z¥u­n±N±zªº gate way ³]©w¦¨¨º­Ó IP ´N¬O¤F(´N¬O GATEWAY=140.116.44.253 )¡I¦Ó±zªº¤½¦@ IP ªº­×§ï¤èªk¬°¡G
    [root@test root]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
    DEVICE=eth0
    BOOTPROTO=none
    BROADCAST=140.116.44.255
    IPADDR=140.116.44.125
    NETMASK=255.255.255.0
    NETWORK=140.116.44.0
    GATEWAY=140.116.44.253
    ONBOOT=yes
    ¦b¤W­±ªº¨Ò¤l¤¤¡A±zªº IP ¬O 140.116.44.125¡A«h±z¥i¥H¼s¼½ªº¦ì§}¦@¦³ 140.116.44.1-255( 140.116.44.255¨º¤@­Ó )¡A¦Ó±zªº¤l¾B¸nºô¸ô¬° 255.255.255.0¡C¦n¤F¡I³£³]©w§¹¦¨¤§«á¡A¨º´Nª½±µ¥H¤U­±ªº¤è¦¡¨Ó±Ò°Ê¡G
    [root@test root]# /etc/rc.d/init.d/network restart
    [root@test root]# ifup eth0
    [root@test root]# ping -c 5 140.116.44.125
    ¬Ý¬Ýºô¸ô¥d¬O§_¥¿±`ªº±Ò°Ê¤F©O¡H
    ¡@
  7. »Ý¼·±µªººô¸ô¥d IP ¡G

  8. ³q±`«Øijª½±µ¦b /etc/sysconfig/network ¤Î /etc/sysconfig/network-scripts/ifcfg-eth0 ¤¤¡Aµ¹¤©¤@­ÓµêÀÀ IP «á¡A¦A ping ±zªººô¸ô¥d IP ¡C³o¬O¥Ñ©ó¼·±µ¦¡ ADSL ¦b¼·±µ¤§«e¬O¨S¦³¤½¦@ IP ªº¡A©Ò¥H§Ú­Ì¥ý¥H¨p¦³ IP ¨Ó´ú¸Õ¬Ý¬Ýºô¸ô¥d¬O§_¥i¥H¥¿±`±Ò°Ê§a¡G
    [root @test /root]# vi /etc/sysconfig/network
    NETWORKING=yes
    FORWARD_IPV4=yes
    HOSTNAME=your.domain.name
    ºô¤Í­Ì³Ì±`µo¥Í°ÝÃDªº¦a¤è¦b©ó¡A±z¬O¥H eth1 ¨Ó§@¬°¼·±µªººô¸ô¥d¡A¦ý¬O«o±N GATEWAYDEV ³]©w¦¨ eth0 ¡A¨º¼Ëªº¸Ü¡A±z¹ï¥~­n¨Dªº«Ê¥]±N³£·|³z¹L eth0 ³o­Ó¨p¦³ IP ªººô¸ô¥d¦V¥~­n¨D¸ê®Æ¡A¥Ñ©ó¨p¦³ IP ¨S¦³¿ìªk³s¤W Internet ¡A©Ò¥H¡A±zªººô¸ô´N§¹¥þ¤W¤£¤F Internet °Õ¡I©Ò¥H³o¸Ìªº³]©w­nª`·N¤@¤UÅo¡I
    [root @test /root]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
    DEVICE=eth0
    BOOTPROTO=none
    BROADCAST=192.168.1.255
    IPADDR=192.168.1.2
    NETMASK=255.255.255.0
    NETWORK=192.168.1.0
    ONBOOT=no
    GATEWAYDEV=ppp0
    ¦b¤W­±ªº¨Ò¤l¤¤¡A±z±Nºô¸ô¥dªº¨p¦³ IP ³]©w¦¨¬° 192.168.1.2 ³o¤@­Ó¡I¦³¤@­Ó²ßºDªº¿ù»~¦b©ó±N BOOTPROTO ( ³q°T¨ó©w ) ³]©w¦¨ DHCP ¡A³o¬O¤£¹ïªº¡A¦]¬°±zªººô¸ô¬O³z¹L¼·±µªº¤è¦¡¡A¦b¼·±µªº¹Lµ{¤¤´N·|¥Ñ rp-pppoe ¼·±µµ{¦¡³s±µ¨ì ISP ¥H PPP ¨ó©w¨Ó³]©w¦n±z¦Û¤vªººô¸ô°Ñ¼Æ¡A©Ò¥H³o¸Ì³]©w DHCP ¬O¨S¦³·N¸qªº¡I³o¸Ì¥u­n³]©w¦¨ none ´N¦æ¤F¡I¤d¸Uª`·N¤F¡IµM«á¦A¥H¤U­±ªº¤è¦¡¨Ó½T»{ºô¸ô¥dªº¹B§@»P§_¡G
    [root@test root]# /etc/rc.d/init.d/network restart
    [root@test root]# ifup eth0
    [root@test root]# ping -c 5 192.168.1.2
    ½Ðª`·NËç¡I³o­Ó³¡¤À¤£»Ý­n­×§ï¤]¨S¦³Ãö«Y¡A¦pªG±zªº³]©w¬O¡y ONBOOT=no ¡z¡A¼K¼K¡I©Ò¥H¶}¾÷ªº®É­Ô¨Ã¤£·|±Ò°Êºô¸ô¥d¡A¨º»ò¹ê»Ú¼·±µªº®É­Ô´N¤£·|¦³¤zÂZÅo¡I¦pªG»Ý­n±Ò°Ê¼·±µ¨t²Î¨Ó½T»{¼·±µ¬O§_¥i¦æ¡A¥i¥H«ö·Ó¤W­±ªº¤è¦¡­×§ï§¹¨â­ÓÀɮסAµM«á±N adsl-setup ³]©w§¹¦¨¡A¤§«á¥H¤U­±ªº¤è¦¡¨Ó±Ò°Ê ADSL ¸Õ¸Õ¬Ý¡G
    [root@test root]# ifdown eth0
    [root@test root]# /etc/rc.d/init.d/network restart
    [root@test root]# adsl-start
    ¨Æ¹ê¤W¡A¦b ADSL ¼·±µ¤§«e¦³¨S¦³±Ò°Ê eth0 ³£¨S¦³Ãö«Y¡A¤£¹L¡A¦³®É­Ô´N¬O¨º»òÄaºÃ¡A±Ò°Ê¤F eth0 ´N¬O¨S¦³¿ìªk¼·±µ¦¨¥\¡A¨º»ò±z´N¥i¥H±N eth0 ¥ýÃö³¬¦A¶i¦æ¼·±µ¸Õ¬Ý¬Ý¡A³q±`´N¥i¥H¦¨¥\¤F¡C±Ò°Ê¤§«á¡A¦A¥H ping ªº¤è¦¡¨Ó½T©w¤@¤Uºô¸ô¡G
    [root@test root]# ping -c 5 your.IP
    [root@test root]# ping -c 5 168.95.1.1
    [root@test root]# ping -c 5 tw.yahoo.com
    ¦pªG½T©w¥i¥H³s¤W Internet ¤§«á¡A´N±N adsl-start ¼g¶i /etc/rc.d/rc.local ¤¤§a¡I
    ¡@
  9. ­«·s¦w¸Ëºô¸ô¥dÅX°Êµ{¦¡¡G

  10. ¦pªG¤W­±ªº¤è¦¡³£¨S¦³¿ìªk¨Ó¥¿±`±Ò°Ê±zªººô¸ô¥d®É¡A¨º´N¥u¦n¦A®»¤@¦¸±zªººô¸ô¥dÅX°Êµ{¦¡¤F¡C­º¥ý¬Ý¬ÝÅX°Êµ{¦¡¹ï¤£¹ï§a¡I °²³]±z¶Rªº¬O¿ÀÃÉ¥d¡A¨º»ò±zªº /etc/modules.conf ¤º®e´N·|¦³ÂI¹³³o¼Ë ( ¦b Red Hat 6.x ¥H«eªºÀɮסAÀɦW¬° /etc/conf.modules ¡I)¡G
    [root@test root]# vi /etc/modules.conf
    alias eth0 rtl8139
    alias eth1 viarhine
    ¦b¤W­±ªº¨Ò¤l¤¤¡A¥Ñ©ó§Ú¦³¨â¶ôºô¸ô¥d¡A²Ä¤@¶ô¬OÄÝ©ó¿ÀÃÉ¥d (´¹¤ù¬° RelTeck8139) ¡A²Ä¤G¶ô¬O VIA ªº´¹¤ù ( ª½±µ¥H viarhine ¨ÓÅX°Ê ) ²Ä¤T¦æ¬O±N viarhine ³o­Ó´¹¤ùÅX°Êªº·N«ä¡C¸U¤@±z´¡¤F¨â±i¬Û¦Pªººô¸ô¥d¡A¨º­n¦p¦ó¨Ó°Ï¤Àºô¸ô¥dªº¥ý«á¦¸§Ç©O¡H¡I¨Ò¦p´¡¤F¨â¶ô rtl8139 ªººô¸ô¥d¡A¨º±z¥i¥H³o¼Ë¼g ( ¼W¥[ io ¤Î irq ªº±±¨î°Ñ¼Æ )¡G
    [root@test root]# vi /etc/modules.conf
    alias eth0 rtl8139
    alias eth1 rtl8139
    options rtl8139 io=0x300,0x320 irq=3,5
    ¤W­±¬O»¡¡A¨â¶ô¥dªºio »P irq ¤À§O¬° 0x300, 3 ¤Î 0x320, 5¡C¦Ü©ó³o¤è­±ªº¬ÛÃö¸ê°T¡A±z¥i¥H¶i¤J windows ¨t²Î¤¤¬Ý¹L ( ©Ò¥H»¡¡A¥i¥H¦w¸Ë¦¨¦h¦¨§@·~¨t²Î°Õ¡I ) ¦A¨Ó­×§ï§a¡I¦n¤F¡A¨º¦pªG­n­«·s¦w¸Ëºô¸ô¥dªºÅX°Êµ{¦¡©O¡H¡I¶â¡I½¦^³s¤W Internet ¨º¤@³¹¸`¹î¬Ý§a¡I³q±`ªººô¸ô¥dÅX°Êµ{¦¡¦w¸Ë¤èªk¨BÆJ¦p¤U¡G
    1. ¤U¸ü±zªººô¸ô¥dÅX°Êµ{¦¡¡F
    2. ½sĶ¨Ã¦w¸Ë¼Ò²Õ¡F
    3. ­×§ï /etc/conf.module ÀɮסF
    4. ­×§ï /etc/sysconfig/network ÀɮסF
    5. ­×§ï /etc/sysconfig/network-scripts/ifcfg-eth0 ÀɮסF
    6. ¥H ifup eth0 ¨Ó±Ò°Ê±zªº ºô¸ô¥d ¸Õ¸Õ¬ÝÅo¡I
    ±z¥u­n±N±zªººô¸ô³]³Æ»P±zªº´¹¤ù¦WºÙ¼g¤W¥¿½Tªº¡A¦A¥[¤W±N¸Ó´¹¤ùªºÅX°Êµ{¦¡½sĶ§¹¦¨¡A¨ÃÂ\¦b /lib/modules/`uname -r`/kernel/drivers/net ¸Ì­±§Y¥i ( ­Y®Ö¤ß¬° 2.2.xx «h»Ý­nÂ\¦b /lib/modules/2.X.X/net¸Ì­±§Y¥iÅo¡I)
    ¡@
    VBird ªº«Øij¡G
    ¨ä¹ê¡A¦b¬[³] Linux ¦øªA¾¹ªº¹Lµ{¤¤¡A¤j·§³Ì³Â·Ðªº¦a¤è´N¬O¦bºô¸ôªº³]©w³o¸Ì¤F¡A¤×¨ä¬O«áÄòªº¤@¨Ç°Ï°ìºô¸ôªº³s½u³]©w ( ¦pªG¯A¤Î NAT ¥D¾÷¨Ó¤À¨Éºô¸ôÀW¼eªº¸Ü¡A±N·|§ó³Â·Ð¡I ) ¡A©Ò¥H³o¸Ì VBird ­nµ¹¤j®a¤@­Ó«Øij¡A´N¬O¹J¨ìºô¸ô¥d³]©wªº²~ÀVªº®É­Ô¡A°®¯Ü¥ý¶R¤@¶ô«Ü«K©y¡A¦ý¬O¤ä´©«×«Ü°ªªº¿ÀÃÉ¥d ( §Ú¥h¤j½æ³õ¬Ý¹L¡A³Ì«K©yªº¥u­n 250 ¤£¨ì´N¦³¤F¡I ) ¡A¥ý±Nºô¸ô¬[³]°_¨Ó¦A»¡¡I§_«h¤@­Ó·s¤âªá¤F«Ü¦hªº®É¶¡¥h·d¤@¶ô²ö¦Wªººô¸ô¥d¡A±`±`·|¿i·l¤@­Ó Linux ·R¦nªÌªº­@¤ß¡I

¨BÆJ¤G¡G°Ï°ìºô¸ôµwÅé³s½u½T»{
    ¦b½T»{§¹¤F³Ì­«­nªººô¸ô¥d³]©w¤§«á¡A¨Ã¥B½T©wºô¸ô¥d¬O¥¿±`ªº¤§«á¡A¦b±µµÛ¤U¨Ó¬O°Ï°ìºô¸ô¤ºªººô¸ô³s±µ±¡ªp¤F¡I°²³]±z¬O«ö·Ó¹Ï¤@©Ò³]©wªº°Ï°ìºô¸ô¬[ºc¡A¨º»ò±zªº°Ï°ìºô¸ô¤ºªº­n¨D¦³¤U­±´XÂI¡G
    1. Ãö©ó IP ªº³]©w¡G°²³]±zªº¨p¦³ IP ¬q¬° 192.168.1.0/24 ¡A¨º±zªº°Ï°ìºô¸ô¤ºªº©Ò¦³¹q¸£ªº IP À³¸Ó¤¶©ó 192.168.1.1 - 192.168.1.254¡A¥B©Ò¦³ªº¹q¸£ªº ¤l¾B¸nºô¸ô ( Netmask ) §¡¬° 255.255.255.0 ¡A¨Ã¥B IP ¦b©Ò¦³ªº¹q¸£³£¤£¥i¥H­«½Æ¡F

    2. ¡@
    3. Ãö©ó Gateway »P DNS ªº³]©w¡G°²³]±zªº Linux ¹ï¤º IP ¬° 192.168.1.2¡A¨º»ò©Ò¦³°Ï°ìºô¸ô¤º¡A¨ä¥Lªº­Ó¤H¹q¸£ªº ³q°T¹h À³¸Ó¬O 192.168.1.2 ³o¤@­Ó¡A¦¹¥~¡A±zªº DNS À³¸Ó³]©w¬° ISP µ¹±zªº DNS IP ©O¡I¨Ò¦p Hinet ªº 168.95.1.1 ¡A¦pªG±z¤£¾å±o±zªº DNS À³¸Ó³]©w¦h¤Ö¡A¨º´N³]©w¬° 168.95.1.1 §Y¥i¡I¡yª`·N¡I¤£­n³]©w¬° 192.168.1.2¡z¡F

    4. ¡@
    5. Ãö©ó Windows ºÝªº³q°T¨ó©w¡G°Ï°ìºô¸ô¤º¨ä¥Lªº windows ¨t²Îªº³q°T¨ó©w¶È»Ý­n TCP/IP §Y¥i¡A¤£¹L¡A±z¤]¥i¥HÃB¥~¦w¸Ë NetBEUI ¡A°£«D±zªººô°ì¤º©|¦³¨ä¥Lªº Windows ¦øªA¾¹ªºªA°È¡A§_«h¤£­n¦w¸ËÃB¥~ªº³q°T¨ó©w¤F¡I¦w¸Ë¹L¦hªº³q°T¨ó©w¥i¯à·|³y¦¨³s½u¹LºCªº±¡ªp¡F

    6. ¡@
    7. Ãö©ó Windows ºÝªº¤u§@¸s²Õ»P¹q¸£¦WºÙ¡G°²¦p±zÁٻݭn¸ê·½¤À¨É¡A¨º»ò±z´N¥²¶·¦b windows ¨t²Î¤¤¶}©ñÀɮפÀ¨É¡A¨Ã¥B«Øij©Ò¦³ªº¹q¸£±N¡y¤u§@¸s²Õ¡z³]©w¬Û¦P¡A¦ý¡y¹q¸£¦WºÙ¡z«h¤£¯à¬Û¦P¡I
    ¤Ï¥¿´N¬O§Ú­Ì¦b ºô¸ô°ò¦ ¸Ì­±½Í¨ìªººô¸ô°Ñ¼Æ³]©w°Õ¡I¨º¨Ç³]©w³£»Ý­n¥¿½TµL»~¤~¦æ¡C¦n¤F¡A¨º­Y­n°Ý±z¡G°Ï°ìºô¸ô¤ºªº¹q¸£¬O§_³s½u¦¨¥\¡H³Ì²³æªº¤è¬O´N¬O¥H ping ¨Ó´ú¸Õ°Õ¡I°²³]§Ú¬O¦b Linux ¥D¾÷ºÝ ( 192.168.1.2 ³o¤@­Ó IP ) ¨º§Ú¥u­n¦b¥D¾÷ºÝ¤U¹F¡G
    [root@test root]# ping -c 5 192.168.1.100
    ¡@
    ´N¥i¥Hª¾¹D 192.168.1.100 ³o³¡¹q¸£¬O§_¥i¥H¸ò§Úªº¥D¾÷¬Û³q¡I¦pªG¤£¯à³s³q©O¡H¡I»¡»¡¥i¯àªº­ì¦]¡G
    1. Windows ºÝªº³]©w¤£¹ï¡G

    2. ¥J²Ó¬Ý¤@¤U­è­è´£¨ìªº´X­Ó°ò¥»­n¨Dªº³]©w¡A¤]´N¬O Netmask, Network, Broadcast, Gateway µ¥µ¥¡A¬O¤£¬O³£¥¿½T©O¡I¦pªG¤£½T©wªº¸Ü¡A½Ð¦A¦^¨ì °Ï°ìºô¸ôªº³s½u¬[ºc ³¹¸`¥h¬Ý¤@¤U Windows ªº³]©w¡C
      ¡@
    3. ³s½u½u§÷¤£¹ï¡G

    4. ­n¾å±o¡A¨â¶ôºô¸ô¥d¤§¶¡¬O¥H¡y¸õ½u¡z¨Óª½±µ³s±µ¡A¦Ü©óºô¸ô¥d»P Hub/Switch ¬O¥H¡y¥­¦æ½u¡z³s±µ¡C¦]¬°ºô¸ô½u¡]RJ-45¡^¤À¦¨¥­¦æ½u»P¸õ½u¡A¨âºØ³W®æ¨Ã¤£¬Û¦P¡C¦Ó¦b Hub ªº§Î¦¡¤è­±¡A¥Ø«e¸û·sªº ADSL ¼Æ¾Ú¾÷¡A³s±µ¨ì Hub ³£¥²¶·­n³s¨ì uplink ³o­Ó¤Õ¤F¡A©Ò¥H¥²¶·¥H¸õ½u³s±µ Hub ¨ì ADSL ¼Æ¾Ú¾÷¤~¦æ¡I¦¹¥~¡A¥Ø«e ADSL ¼Æ¾Ú¾÷¤j³£¦³¤@­Ó¨p¦³ IP ¬° 192.168.1.1¡A¨º±z¥i¥H¦b±zªº¥D¾÷ºÝ¤U¹F ping 192.168.1.1 ¨Ó¬Ý¬Ý¨âªÌ¬O§_¦³³s³q¡I³o®É½Ðª`·N¡A±N±zªººô¸ô¥d³s±µ¨ì ¼Æ¾Ú¾÷ ªº¨º¤@­Ó¡A³]©wªº IP ¦¨¬° 192.168.1.2¡A¨Ã¥B­«·s±Ò°Ê ifup eth0 ¡A¤~¥i¥H¶i¦æ´ú¸Õ¡Iµù¡GÁÙ¦³¤@­Ó²³æªºÀ˵ø¤èªk¡A¨º´N¬O±µ¨ì Hub ¤W­±¤§«á¡A¨Ã¥B¶}±Ò©Ò¦³ªº¸Ë¸m¹q·½¡A«h¥þ³¡ªº¦³±µ¤W¸Ë¸mªº Hub ´¡¤ÕÀ³¸Ó­n¡y«G¿O¡z¤~¬O¹ïªº¡A¦pªG¿O¤£«G¡A¨º´N¡yªÖ©w¡z¦³°ÝÃD¡I·íµM°Õ¡A¥Ø«e·sªº¨ã¦³ Auto MDI/MDIX ¥\¯àªº Switch ¥i¥H¦Û°Ê¤À¿ë¸õ½u»P§_¡A¦Ó¤¤µØ¹q«Hªº¼Æ¾Ú¾÷³W®æ¤]«Ü¦hÅÜ¡ã©Ò¥H¡AÁÙ¬O±o¥J²Óªº°Ñ¦Ò±zªºµwÅ黡©ú®Ñ³á¡I
      ¡@
    5. ºô¸ô¥d©Î Hub Ãa±¼¤F¡G

    6. ¤£­nÃhºÃ¡Iºô¸ô¥d»P Hub ¬O·|Ãa±¼ªº¡I±o¤p¤ß¤@¤U³o¤@­Ó±¡ªp¡C
      ¡@
    7. °T¸¹¤Ó®z¤F¡G

    8. ³o­Ó³Ì±`µo¥Í¦b¹q¸Ü½u±µ«Üªø¡A©ÎªÌ¬Oºô¸ô½u±µ«Üªøªº±¡ªp¡A¥Ñ©ó±zªº½u§÷¥i¯à¤£¬O«Ü¦n¡A©Ò¥H´N·|³y¦¨±zªººô¸ô·|Â_Â_ÄòÄòªº¡I·íµM¡A¤]¦³¥i¯à¬O¤¤µØ¹q«Hªº¾÷©Ð¥»¨­´£¨Ñµ¹±zªº°T¸¹´N¤£°÷±j¡A³o®É¡A±z´N¥²¶·½Ð¤¤µØ¹q«Hªº¤uµ{®v¨ÓÀ°±z³B²z³B²z¤F¡I

¨BÆJ¤T¡G½T»{¸ô¥Ñªí¸ê®Æ¨S¦³°ÝÃD
¦b¤@¯ë¥¿±`ªº±¡ªp¤§¤U¡A·í±z¤U¹F route ³o­Ó«ü¥Oªº®É­Ô¡A±zªº¸ô¥Ñªí ( route table ) À³¸Ó·|«Ü§ÖªºÅã¥Ü¥X¨Ó¡A¦pªG¸U¤@¤£©¯Åã¥Üªº³t«×«D±`¤§ºC¡A¨º»ò³q±`´N¬O±zªººô¸ô³]©w¥i¯à¡y¦³ÂI©Ç©Çªº¡z¡A·íµM°Õ¡A¦pªG¬O±zªº¨t²ÎÁÙ¦³³]©w¤F IP alias ªº¸Ü¡A¨º»ò´N¯uªº·|¦³ÂIºCºCªº¡ã¤£¹L¨S¦³Ãö«Y¡A§Ú­ÌÁÙ¬O¥i¥H¨Ó´ú¸Õ¤@¤U¬O§_¦³°ÝÃD©O¡I¡H
¡@
[root@test root]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
140.116.141.253 *               255.255.255.255 UH    0      0        0 ppp0
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
default         140.116.141.253 0.0.0.0         UG    0      0        0 ppp0
¡@
½Ðª`·N¡A¥Ñ©ó§Ú¦³¨â¶ôºô¸ô¥d( ¤@¶ô¹ï¤º¤@¶ô¹ï¥~¡A§Úªº¨t²Î¬[ºc´N¦p¦P ¹Ï¤@ ©ÒÅã¥Üªº¨º¼Ë¡I )¡A¥[¤W§Ú¬O¥H¼·±µªº¤è¦¡³s¤W Internet ªº¡A©Ò¥H¦ÛµM´N·|¦³ eth0, eth1, ppp0 ¤Î¥»¨Ó´N·|¦³ªº lo ³o¤T­Ó¤¶­±¡A¦Ó¥Ñ©ó eth1 ³o­Ó¤¶­±¬O¨Ìªþ¦b ppp0 ¤W­±ªº( §Úªº ppp0 ªº¼·±µ¤¶­±¥d¨Ï¥Îªº¬O eth1 Ëç¡I)¡A©Ò¥H¦ÛµM¤]´N¨S¦³ eth1 ³o­Ó¤¶­±ªº³]©w¡I¦n¤F¡A¨º»ò§Úªº¸ô¥Ñ¤¶­±¦ÛµM´NÀ³¸Ó·|¦³ eth0, ppp0, lo ³o¤T­Ó°Õ¡I¨º¥Ñ©ó lo ¬O 127.0.0.1 ¡A¥[¤W¥L¬O A Class ªººô¸ô°j°é¡A¦]¦¹´N·|±o¨ì¤W­±ªº¨º¤@¦æ¡I¦P®É¡A§Úªº¹w³]³q°T¹h¦ÛµM¿ï¾Ü¥i¥H³s¤W Internet ªº ppp0 ¨º¶ô¡A©Ò¥H¤]´N¦¨¬° default ¨º¤@¦æÅo¡IµL½×¦p¦ó¡A§Úªº route ¥i¥H³o¼Ë´N³]©w§´·í¨S¦³°ÝÃD¡I
¡@
¦pªGµo¥Í¿ùªº¸Ü¡A³Ì±`µo¥Í¦b³o­Ó¦a¤èªº±¡ªp´N¬O¦³ÂI¹³©³¤Uªº¼Ë¤l¡G
¡@
[root@test root]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
140.116.141.253 *               255.255.255.255 UH    0      0        0 ppp0
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
default         192.168.1.2     0.0.0.0         UG    0      0        0 eth0
¡@
µo²{­þ¸Ì¦³°ÝÃD¤F¶Ü¡H¹ï°Õ¡I¨º­Ó default «ç»ò gateway ¬° 192.168.1.2 ©O¡H¹ï°Õ¡I°ß¤@¦³°ÝÃDªº¦a¤è´N¬O¦b¨º¨à¡I¦]¬°¹w³]ªº GATEWAY Åܦ¨¤F 192.168.1.2 ³o­Ó¨p¦³ IP ¡A¦ÛµMµLªk³s±µ¤W Internet ¡A¨º»ò·í±z¨Ï¥Î¡yping -c 5 202.1.237.21¡z·íµM¤]´N·|Åã¥Ü¥X«Ê¥]»¼°eªº IP ¬° 192.168.1.2 ¡A¨þ¨þ¡I§¹¥þ³s¤£¥X¥h¡I«ç»ò¿ì¡H¡I«Ü²³æ°Õ¡I°£¤F¤â°Ê¥H route ³o­Ó«ü¥O­×§ï¤§¥~¡A¤]¥i¥H­×§ï /etc/sysconfig/network-scripts/ifcfg-eth0 ³o­ÓÀɮסA±N¸ÌÀYªº GATEWAY ©Î GATEWAYDEV ªº³]©w­×¥¿¤@¤U¡A´N¥i¥H°Õ¡I¥[ªo¡I¡I

¨BÆJ¥|¡G½T»{ DNS ªº IP ³]©w
¦pªG³q¹L¤W­±ªº°ÝÃD½T»{¡A³o­Ó®É­Ô±zªººô¸ô±¡ªpÀ³¸Ó¬O¡G
  1. ºô¸ô¥d»P«Ç¤ºªº³s½u§÷®Æ³£¬O¦nªº¡F
  2. ¨Ã¥B°Ï°ìºô¸ô¤ºªº¹q¸£³£¥i¥H¤¬³q¡F
  3. ¦P®É¡Aadsl-start ¤w¸g¥¿½Tªº¤u§@¤F¡F
  4. ping IP ¥i¥H ping ªº¨ì¡A¦ý¬O¥i¯à¨S¦³¿ìªk¥HÂsÄý¾¹ª½±µÂsÄýºô¯¸¡C
¸Ó¦p¦ó¬O¦n¡I¡H¼K¼K¡I³o®É´N»Ý­nª`·N±zªº DNS ³]©w¤F¡I³q±`¡A¦pªG¬O DNS ³]©wªº°ÝÃDªº®É­Ô¡Aµo¥Íªº²{¶H¬O³o¼Ëªº¡G¡]§Ú­Ì¥H¶®ªê¯¸ tw.yahoo.com¡A IP¡G202.1.237.21 ¨Ó»¡©ú¡^
³o®É´N»Ý­n§ïÅܱzªº¥D¾÷ªº DNS ³]©w¤F¡I±z¥i¥H­×§ï /etc/resolv.conf ÀɮסG
¡@
[root@test root]# vi /etc/resolv.conf
nameserver 168.95.1.1
nameserver 139.175.10.20
nameserver 163.28.113.1
¡@
¤W­±¥u¬O¤@­Ó²³æªºªí¥Ü¤èªk¡A±zªº¥D­nªº DNS ¥D¾÷¬° 168.95.1.1 ¡]Hinetªº DNS ¥D¾÷¡^¡A¦Ó³Æ¥Îªº DNS «h¬° 139.175.10.20 ¤Î 163.28.113.1 ³o¨â­Ó¡C¦ó¿×³Æ¥Îªº DNS ¥D¾÷©O¡H³o¬O¥Ñ©ó 168.95.1.1 ¥i¯à·|¦]¬°¬Y¨Ç¥¿±`©Î¤£¥¿±`­ì¦]¦Ó°±¤îªA°Èªº®É­Ô¡A«h±zªº¥D¾÷¥u­n°»´ú¤£¨ì ¥D­n DNS ¥D¾÷¡A±N·|Ä~Äò©¹¤U´M§ä¥t¤@­Ó DNS ¥D¾÷¡Aª½¨ì¨S¦³ DNS ¥D¾÷¬°¤î¡C³q±`§Ú¦Ü¤Ö³£·|³]©w¨â­Ó¥H¤W¡C

¨BÆJ¤­¡GNAT ¥\¯à( ©Î IP ¤À¨É¾¹ )¬O§_¥¿±`
NAT ¥i¥H¥ý²³æªº·Q¦¨¬O¤@­Ó IP ¤À¨É¾¹¡ANAT µLªk¥¿½Tªº¤u§@­ì¦]¦³«Ü¦h¡A¤£¹L¡A¦pªG±z½T©w±zªº°Ï°ìºô¸ô³s½u¤w¸g¥¿±`¡A¦Ó¥B¥D¾÷¥i¥H¥¿½Tªº³s¤W Internet¡A¥t¥~¡A¥Î¤áºÝªº DNS ³]©w¤]¬O¥¿½Tªº¡]³o¤@¨B±`±`¦³¤H·d¿ù¡I¡^¡A¨º»ò¥i¯àµo¥Íªº°ÝÃD¤j·§´N¬O¨S¦³±N IPv4 ¥´¶}§a¡IÁöµM /etc/sysconfig/network ·í¤¤¤w¸g³]©w¤FFORWARD_IPV4=yes ªº¶µ¥Ø¡A¦ý¬O¤´µM¦³¥i¯à¨S¦³¶}±Ò³o¤@­Ó¶µ¥Ø¡A¨º»ò´N¥H¤U­±ªº«ü¥O¨Ó¶}±Ò§a¡I
echo 1 > /proc/sys/net/ipv4/ip_forward
±z¥i¥H±N³o­Ó«ü¥O¼g¤J /etc/rc.d/rc.local ³o­ÓÀɮפ¤¡C¥t¥~¡AÁÙ¦³¤@ÂI¡A´N¬O±zªº GateWay ³]©w¿ù»~¤F¡I³o­Ó¦b¤W­±ªº network ÀÉ®×»¡©ú¤¤¤w¸g´£¨ì¤F¡A±z¥i¥H¦A¸Ô²Óªº¬Ý¤@¬Ý¡I©ÎªÌ¬O¨Ï¥Î route -n ³o­Ó«ü¥O¨Ó¹î¬Ý¤@¤U±zªº route table ¡]¸ô¥Ñªí¡^¨Ò¦p¡G
 
[root@test root]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.2     0.0.0.0         255.255.255.255 UH    0      0        0 eth0
172.16.11.8     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
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         172.16.11.8     0.0.0.0         UG    0      0        0 ppp0
¥J²Ó¬Ý¨ì¤W­±³á¡G ÁA¸Ñ¤F¶Ü¡H¹ï¤º»P¹ï¥~ªº route table ¬O¤£¤@¼Ëªº¡A¦pªG±zªº¹ï¥~ Iface Åã¥Ü eth0 ªº¸Ü¡A¨º´Nªí¥Ü±zªº¸ô¥Ñ³]©w¿ù»~¤F¡I³o®É±z´N¥²¶·­n­×§ï¤@¤U±zªº /etc/sysconfig/network-scripts/ifcfg-eth0 ÀÉ®×Åo¡IµM«á¦A¥H
/etc/rc.d/init.d/network restart
¨Ó­«·s±Ò°Ê¡I
°£¤F³o¨Ç°ÝÃD¤§¥~¡A±zªº ipchains/iptables ¬O§_¥¿½Tªº¤u§@©O¡H³o³£»Ý­nª`·Nªº¡I¦Ó¦b Red Hat 7.X ªºª©¥»¤§«á¡A¥Ñ©ó ipchains »P iptables ¨Ã¦sªºÀô¹Ò¤U¡A·|¦³°ÝÃDµo¥Í¡A¦]¦¹±z¥²¶·¨ú®ø¥ô¦ó¤@­Ó¨¾¤õÀð¾÷¨î¤~¦æ¡I¦pªG¹ï©ó ipchains »P iptables ¤£¬O«Ü¼ô±xªº¸Ü¡A¥i¥H¬Ý¤@¤U³o¤@½g°Q½×¡G
¤p¦{¥ý¥Íªº iptables ¬ÛÃö NAT »P¦w¥þ¨¾Å@»¡©ú¡G
http://linux.vbird.org/linux_server/0150detect_network_1.php
¦n¤F¡I°£¤F³o¨Ç°ÝÃD¤§¥~¡AÁÙ¦³¤@­Ó¤p°ÝÃD¡A´N¬Oµo¥Í¦b Windows ªº¨t²Î¤¤¡A¥i¯à·|¦³ MTU ªº°ÝÃD¦s¦b¡A¤]´N¬O»¡¡A¥i¯à¦³³¡¤Àªººô¯¸±z¨S¦³¿ìªk³s¤W¥h¡A¨º­n¦p¦ó¬O¦n¡H±z¥i¥H½¨ì«e¤@³¹¥h¬Ý¤@¬Ý¦p¦ó­×§ï±zªº MTU §a¡I¦Ü©ó§ó¦hªº NAT ¥\¯à»P¿ù»~½T»{¡A§Ú­Ì·|¦b NAT ¥D¾÷ªº³]©w¤@¸`¦A¸Ô²Óªº»¡©ú³á¡I

¨BÆJ¤»¡GADSL ¼Æ¾Ú¾÷©Î router ªº°ÝÃD
¦b±z½T»{¤F¤W­±ªº´X­Ó°ÝÃDÂI¤§«á¡A¤j·§¤w¸g¥i¥HÅý±zªººô¸ôºZ³q¤F¡I¤£¹L¡A¦pªGÁÙ¬O¨S¦³¿ìªk³s¤W Internet ©O¡H¨º´N«Ü¦³¥i¯à¬O¥~³¡ªº°ÝÃD¤F¡I§Ú­Ì»Ý­nª`·Nªº¤j·§¬O³o¼Ë¡G
  1. ADSL ªº modem ¿O¸¹¬O§_³£¬O¥¿±`ªº¡H¦pªG¤£¥¿±`ªº¸Ü¡A¥ý³B²z modem §a¡I
  2. ³s±µ¨ì¤¤µØ¹q«Hªº gateway ¬O§_¥¿±`¡H³o¥i¥H±q ifconfig ·í¤¤±o¨ìªº¸ê°T¡A¥h ping ¨º­Ó gateway ¸Õ¸Õ¬Ý¡I¦A¤£µMªº¸Ü¡Aª½±µ¥´¹q¸Ü¨ì¤¤µØ¹q«Hªº¾÷©Ð¥h¸ß°Ý¤@¤U¬O§_¦³°ÝÃD¡F
  3. ¬O§_¦³³¡¤Àªº router ¥X²{°ÝÃD¤F¡G
°ò¥»¤W¡A«e¨âÂI³£«Ü¦n¸Ñ¨M¡Aª½±µ¬Ý¤@¤U ADSL ªº¿O¸¹´N¥i¥Hª¾¹D¬O§_¥¿±`¤F¡I²Ä¤TÂI¤~¬O§Ú­Ì³o¸Ì©Ò­n±´°Qªº¡I¸U¤@±z±q¦¨¤j­n³s½u¨ì±z°ª¶¯®a¤¤ªº¥H seednet §@¬° ISP ªº±zªº¥D¾÷®É¡A±z¥i¥H¨Ï¥Î traceroute ³o¼Ë°µ¡G
 
[root@test root]# traceroute tsai.adsldns.org
traceroute to tsai.adsldns.org (211.74.251.208), 30 hops max, 38 byte packets
 1  140.116.44.253 (140.116.44.253)  7.373 ms  8.732 ms  9.560 ms
 2  203.72.191.42 (203.72.191.42)  0.932 ms  1.050 ms  0.716 ms
 3  203.72.191.218 (203.72.191.218)  0.906 ms  1.209 ms  0.867 ms
 4  R56-161.seed.net.tw (139.175.56.161)  2.229 ms  1.877 ms  2.154 ms
 5  R58-38.seed.net.tw (139.175.58.38)  3.283 ms  3.639 ms  5.303 ms
 6  br011008.seed.net.tw (139.175.11.8)  4.344 ms  3.941 ms  3.602 ms
 7  swks251-208.adsl.seed.net.tw (211.74.251.208)  50.058 ms  52.567 ms  53.109 ms
¦b³o¼Ëªº¹Lµ{¤¤¡A±z´N¥i¥Hª¾¹D¡A±z¦V±z®a¤¤­n¨Dªº¸ê®Æ«Ê¥]¬O«ç¼Ë¶Ç°eªº¡I¦Ó¤@­Ó¤@­Óªº¥hÁA¸Ñ¨ì©³±zªººô¸ô¶Ç¿é³t«×¬O¦b­þ¤@­ÓÀô¸`³Q¾×¤F¤U¨Ó¦Ó¦³©µ¿ðªº°ÝÃD¡I¤S¨Ò¦p§Ú±q®a¸Ì³s½u¨ì¶®ªêªººô¯¸®É¡A¸ê®Æ«Ê¥]®É¦p¦ó¶Ç°eªº©O¡H¨Ò¦p¤U­±ªº»¡©ú¡G
 
[root@test root]# /usr/sbin/traceroute tw.yahoo.com
traceroute to tw.yahoo.com (202.1.237.21), 30 hops max, 38 byte packets
 1  172.16.11.8 (172.16.11.8)  46.181 ms  45.028 ms  39.722 ms
 2  139.175.15.1 (139.175.15.1)  37.972 ms  36.554 ms  40.228 ms
 3  R58-194.seed.net.tw (139.175.58.194)  45.332 ms  46.370 ms  46.140 ms
 4  R58-90.seed.net.tw (139.175.58.90)  46.814 ms  55.286 ms  46.401 ms
 5  211.22.41.174 (211.22.41.174)  46.326 ms  57.491 ms  45.398 ms
 6  211.22.35.230 (211.22.35.230)  46.813 ms  57.740 ms  46.117 ms
 7  211.22.35.169 (211.22.35.169)  46.319 ms  51.316 ms  52.549 ms
 8  203.69.65.65 (203.69.65.65)  46.342 ms  46.185 ms  58.698 ms
 9  * * *
³Ì«á­±¥X²{¤F * ªº²Å¸¹¡A³oªí¥Ü±q 203.69.65.65 ³o¤@­Ó router ¨ì¤U¤@­Ó router ªº¹Lµ{¤¤¥i¯à¦³ÂI¤p°ÝÃD¡A©Ò¥H³y¦¨¤F±zªººô¸ô¦³ÂI¤£¬O«Ü¥¿±`ªº±¡ªpµo¥Í¡I³o®É±z´N¥²¶·­n¥hÁA¸Ñ¤U­ì¦]¤F¡C¹³¦­¥ý·s¦Ëªº¤@±ø¥úÆl³Q«õÂ_ªº®É­Ô¡A¥Ñ©ó¨º±ø¥úÆl¬O¥D­nªººô¸ô·F¹D¤§¤@¡A©Ò¥H³Q«õÂ_¤F¡A±N¨Ï±o¸ê®Æ«Ê¥]¥²¶·¸g¹LªF³¡ªº¥H¤Î³Æ¥÷ªººô¸ô¬y¶q¸û¤pªº³Æ´©ºô¸ô¨t²Î¨Ó³B²z¡A©Ò¥H¤]´N³y¦¨¤j¶ë¨®ªº°ÝÃD¤F¡I¥t¥~¡A¥»¯¸«e¤@°}¤l¥Ñ©ó±Ð¨|³¡ªº UPS ¦b¶i¦æºûÅ@ªº¤uµ{¡Aµ²ªG¤]¬O¾É­P¦¨¤j³¡¤Àªººô¸ô¬y¶q¨üªý¡A³y¦¨§Ú­Ìªººô¤ÍµLªk³s½u¶i¨Óªºµ²ªG¡A±z¥i¥H¨ì³¾­ôªº¨p©Ðµæ­º­¶(http://linux.vbird.org)¬Ý¤@¤U¦b 2001/12/6-10 ¤é¤§¶¡ªº¤½§i¡A³o¼ËªºÀËÅç¤]¥i¥HÅý§Ú­ÌÁA¸Ñ¨ìºô¸ô¬y¶qªº²~ÀV³á¡I

¨BÆJ¤C¡G¥D¾÷ªA°È¬O§_Ãö±¼¤F»PªA°ÈÅv­­ªº°ÝÃD
¥t¥~¤@­Ó±`¨£ªº°ÝÃD¬O¡AµLªkµn¤J¥D¾÷°õ¦æ¡y¬Y¨Ç¡z¥\¯à¡A¤]´N¬O»¡¡A±z¥i¥H ping ªº¨ìºô¸ô¤Wªº¬Y³¡¥D¾÷¡A¦ý¬O´N¬OµLªk°õ¦æ³o­Ó¥D¾÷ªº¬Y¨Ç¯S©wªº¥\¯à¡A¨Ò¦p FTP, WWW, mail µ¥µ¥¡C¥H³¾­ôªº¬Y­Ó¥D¾÷¬°¨Ò¡A§Úªº¥D¾÷¶È´£¨Ñ mail ¤Î www ªºªA°È¡A¦]¦¹±z¨Ï¥Î telnet ¤Î ftp ³£¬O¨S¦³¥Îªº¡I©Ò¥HÅo¡A¥²¶·¥ý¥hÁA¸Ñ¨ì¸Ó¥D¾÷´£¨ÑªºªA°È¤~¦æ¡I
¨º¦pªG¬O±zªº¥D¾÷©O¡H³Ì±`¨£¨ìªº´N¬O·sª©ªº Linux ¤¤¡Aftp »P telnet ¤w¸g¹w³]¤£¶}©ñ¤F¡I¨º±z·íµMµLªk¥H ftp ¤Î telnet ³s±µ¨ì±zªº¥D¾÷¸Ì­±¡I³o®É¡A´N¥²¶·­n¨ì /etc/xinetd.d ¥h­×§ï´X­ÓªA°Èªº³]©w¡A¥H telnet ¬°¨Ò¡A±z¥i¥H¦b /etc/xinetd.d/telnet ¤¤¬Ý¨ì¦p¤Uªº©N©N¡G
 
[root@test root]# vi /etc/xinetd.d/telnet
service telnet
{
        disable = yes
        flags           = REUSE
        socket_type     = stream
        wait            = no
        user            = root
        server          = /usr/sbin/in.telnetd
        log_on_failure  += USERID
}
¬Ý¬Ý¤W­±¡A½Ð±N disable = yes §ï¦¨ disable = no ´N¥i¥H¶}±Ò°Õ¡IµM«á¦A¥H /etc/rc.d/init.d/xinetd restart ¨Ó±Ò°Ê±zªº telnet ªA°È¡I¤£¹L¡A°ò¥»¤W¤]¦³¥i¯à¬O firewall ¾×¦í¤F±zªºªA°È³q¹D¡A³o®É¡A´N»Ý­n¥ý¶}±Ò¨¾¤õÀð¤F¡I
ÁÙ¦³¤@­Ó­nÀˬdªº¬O¦U­ÓÀɮשΪ̬Oµ{§ÇªºÅv­­¤F¡I¨Ò¦p±zªº /etc/hosts.allow ¤¤¬O§_¦³¶}±Ò¡H±zªº mail server ¬O§_¦³³]©w relay ¡H±zªº httpd.conf ¤¤¬O§_¦³¶}©ñ PHP ©ÎªÌ¬O MySQL ªºªA°È¡A©ÎªÌ¬O¨ä¥L¬ÛÃöªº CGI µ{¦¡°õ¦æªº¥i¦æ©Ê¡H±zªº FTP ¬O§_¦³¶}©ñ°Î¦Wµn¤J¡Hµ¥µ¥µ¥¡A³£¬O»Ý­n¯S§OªºÀˬdªº¡A¤£¹L¡A³o³£ÄÝ©ó¤@¯ë©Êªº FAQ ¤F¡A³o¸Ì´N¤£¦h°µ»¡©ú¡C
Linux ºô¸ô°»¿ù

2002/07/31¡G²Ä¤@¦¸§¹¦¨¤é´Á¡I
2003/08/19¡G­«·s­×­q¤@¨Ç¸ê®Æ¡A»P«e­±ªº³¹¸`¤ñ¸û¦n°t¦X¡I


Designed by VBird during 2001-2004.  Aerosol Lab.