Routing ȯ°æ


1. °øÅë Routing ȯ°æ
 Routing°ú Routing Protocol»çÀÌ¿£ Â÷ÀÌÁ¡ÀÌ ÀÖ´Ù. ¸ðµç File SystemÀÌ Data¸¦ Route
 ÇÏÁö¸¸ ¸ðµç ½Ã½ºÅÛÀÌ Routing Protocols¸¦ ¼öÇàÇÏÁö´Â ¾Ê´Â´Ù.
 RoutingÀ̶õ Routing Table¿¡ ³»Æ÷µÈ Á¤º¸¿¡ ±âÃÊÇÏ¿© Datagrams¸¦ Forwording ÇÏ´Â
 °ÍÀÌ´Ù. Routing Protocols´Â Routing Tables¸¦ ¸¸µé¶§ »ç¿ëµÇ¾îÁö´Â Á¤º¸¸¦ ±³È¯ÇÏ
 ´Â Programs¸¦ ¸»ÇÑ´Ù.

 Minimal Routing - ¸ðµç ´Ù¸¥ TCP/IP NetworkÀ¸·Î ºÎÅÍ ¿ÏÀüÈ÷ °í¸³µÈ Network¸¸ÀÌ 
                   Minimal Routing TableÀº Network Interface°¡ ±¸¼ºµÉ¶§"ifconfig"
                   ¿¡ ÀÇÇظ¸µé¾îÁø´Ù.¸¸¾à NetworkÀÌ ´Ù¸¥ TCP/IP Network¿Í Á÷Á¢ 
                   Á÷Á¢ÀûÀÎ Á¢±ÙÀ» ÇÏÁö¾Ê°í SubnettingÀ» »ç¿ëÇÏÁö ¾Ê´Â´Ù¸é ÀÌ
                   Minimal Routing Table¸¸ÀÌ À¯ÀÏÇÏ°Ô ÇÊ¿äÇÏÁö¸¸ ÀÌ°°Àº °í¸³µÈ 
                   NetworkÀº Unixȯ°æ¿¡¼­ »ý°¢º¸´Ù µå¹°´Ù.

 Static Routing  - ´Ù¸¥ TCP/IP Network°ú Á¦ÇѵȼýÀÚÀÇ Gateway¸¦ °¡Áö´Â Network
                   Àº Static Routing À¸·Î ±¸¼ºÇÒ¼ö ÀÖ´Ù. ÀÌStatic Routing Àº 
                   "route" ¸í·É¾î¸¦ »ç¿ëÇÏ¿© ManuallyÇÏ°Ô ±¸¼ºµÈ´Ù. Static  
                   Routing TableÀº Networkº¯°æ¿¡ ´ëÇÏ¿© ÀûÀÀµÇÁö ¾ÊÀ¸¹Ç·Î Route
                   °¡ ¹Ù²îÁö¾Ê´Â °÷¿¡ »ç¿ëµÇ¾î ¾ßÇÑ´Ù.
                   ±×·¯³ª ¿ø°Ý ¸ñÀûÁö°¡ ¿ÀÁ÷ ÇϳªÀÇ Route·Î¸¸ ´êÀ»¼ö ÀÖÀ»¶§
                   Static Route°¡ °¡ÀåÁÁÀº ¼±ÅÃÀÌ´Ù.

 Dynamic Routeing - °°Àº ¸ñÀûÁö¿¡ Çϳª ÀÌ»óÀÇ Route°¡ °¡´ÉÇÒ¶§ Dynamic Routing
                    À» »ç¿ëÇØ¾ß ÇÒ°ÍÀÌ´Ù.
                    Dynamic Routing TableÀº Route Protocol¿¡ ÀÇÇØ ¹Ù²î¾îÁø Á¤º¸
                    ·Î ºÎÅÍ ¸¸µé¾îÁø´Ù. ÀÌ ProtocolµéÀº ¹Ù²î´Â Network»óŸ¦ ¹Ý
                    ¿µÇÏ¿© Route¸¦ µ¿ÀûÀ¸·Î ÀûÀÀ½Ãų¼ö ÀÖ´Â Á¤º¸¸¦ ºÐ¹èÇϱâ À§ÇØ
                    ¼³°èµÇ¾î ÀÖ´Ù. Routeing Protocolº¹ÀâÇÑ Routing »óȲ¿¡ ½Ã½ºÅÛ
                    °ü¸®ÀÚ °¡ ÇÒ¼ö Àִ°ͺ¸´Ù Á¤È®ÇÏ°í ºü¸£°Ô ´Ù·ê¼ö ÀÖÀ¸¸ç 
                    Primary Route °¡ µ¿ÀÛÇÏÁö ¾ÊÀ» °æ¿ìÀÇ Back-up Route·ÎÀÇ ±³Ã¼
                    »Ó¸¸¾Æ´Ï¶ó ¸ñÀûÁö·ÎÀÇ ÃÖ¼±ÀÇ Route¸¦ °áÁ¤ÇÒ¼ö ÀÖµµ·Ï ¼³°èµÇ
                    ¾îÀÖ´Ù. °°Àº ¸ñÀûÁö¿¡ ´ëÇÏ¿© ´ÙÁßÀÇ Path°¡ ÀÖ´Â ¾î¶°ÇÑ Netw-                    work¿¡¼­µµ Routing ProtocolÀÌ »ç¿ëµÇ¾îÁø´Ù.

 Route´Â ifconfig, route ¸í·É¾î¿¡ ÀÇÇÑ ¼öÀÛ¾÷, Routing Protocol¿¡ ÀÇÇÑ µ¿ÀûRou-
 ting ÁßÀÇ ¾î¶² ¹æ¹ýÀ» »ç¿ëÇÏ´õ¶óµµ Route°¡ µé¾î°¡¸é ¸ðµÎ Routing TableÀÌ µÊ.

2. Minimal Routing Table
  ----------------------------------------------------------------------------
  | % netstat -rn                                                             |
  | Routing tables                                                            |
  | Destination		Gateway		Flags		Refcnt	    Use       |
  | Interface                                                                 |
  | 127.0.0.1		127.0.0.1	UH		1      	    132   lo0 |
  | 128.66.12.0		128.66.12.2	U		26          49041 le0 |
  ----------------------------------------------------------------------------

 "ifconfig"¿¡ ÀÇÇØ ±¸¼ºµÈ Routing TableÀÇ Ã¹¹ø°ÀÇ Entry´Â lo0°¡ ¹ÙÄ¡µÉ¶§ ¸¸µé¾î
 Áø localhost ´ëÇÑ loopback routeÀÌ´Ù.
 ¶Ç´Ù¸¥ network 128.66.12.0¿¡ ´ëÇÑ route´Â le0 interface¸¦ ÅëÇÑ´Ù. 128.66.12.2
 ´Â ¿ø°Ý gateway ddress°¡ ¾Æ´Ï°í systemÀÇ le0 interface¿¡ ÇÒ´çµÈ ÁÖ¼ÒÀÌ´Ù. 
 µÎ°³ÀÇ entry ¸ðµÎ "U" (UP)¶ó´Â flag¸¦ °¡Áø´Ù. ÀÌ°ÍÀº »ç¿ëÇÒ¼ö ÀÖ´Â Áغñ°¡ µÇ¾î
 Àִٴ°ÍÀÌ´Ù. ¶ÇÇÑ entry ¸ðµÎ flag¿¡ "G"(gateway) flag °¡¾ø´Âµ¥ "G" flag´Â 
 remote gateway ¸¦ »ç¿ëÇϴ°ÍÀ» ÀǹÌÇÑ´Ù. "G" flag°¡ ¾ø´Â°ÍÀº ¿ÜºÎ gateway¸¦ Åë
 ÇÏÁö¾Ê°í local interface ¸¦ ÅëÇÑ Á÷Á¢ÀûÀÎ route¸¦ ÀǹÌÇÑ´Ù.

 loopback route´Â "H" (host)flag setµµ °¡Áö°í ÀÖ´Ù. ÀÌ°ÍÀº ÀÌ route¸¦ ÅëÇؼ­ ¿À
 Á÷ ÇϳªÀÇ host¿¡¸¸ µµ´ÞÇÒ¼ö ÀÖ´Ù´Â °ÍÀ» ÀǹÌÇÑ´Ù. loopback entryÀÇ destination
 field¸¦ º¸¸é network ÁÖ¼Ò °¡ ¾Æ´Ñ °ÍÀ» ¾Ë¼öÀÖ´Ù. loopbackÀÇ networkÁÖ¼Ò´Â 
 127.0.0.0À̸ç, 127.0.0.1Àº °³º°Àû hostÀÎ ¸ðµç host table¿¡´Â Ưº°ÇÑ host route
 °¡ ÀÖ´Ù. ºñ·Ï ¸ðµç host tableÀÌ ÀÌ·¯ÇÑ host-specific route ¸¦ °¡Áø´ÙÇصµ ´ëºÎºÐ
 ÀÇ route´Â networkÀ» routeÇÑ´Ù. ÀÌ°ÍÀº routing tableÀÇ size¸¦ ÁÙÀ̴µ¥ ÇÑ ÀÌÀ¯
 °¡ ÀÖ´Ù.

 À§ÀÇ sample tableÀ» º¸¸é ¿ÀÁ÷ ÇϳªÀÇ network route 128.66.12.0¸¸ÀÌ Á¸Àç ÇϹǷΠ ÇØ´ç ½Ã½ºÅÛÀº 128.66.12.0 network»óÀÇ hostµé ¿¡°Ô¸¸ Åë½ÅÇÒ½º ÀÖ´Ù. ÀÌ·¯ÇÑ Á¦
 ÇÑµÈ routing tableÀº "ping" ¸í·É¾î·Î ½±°Ô °ËÁõÇÒ¼ö ÀÖ´Ù.
 "ping"Àº ICMP¸¦ ÀÌ¿ëÇÏ¿© Echo message¸¦ remote host·Î °­Á¦ÀûÀ¸·Î º¸³»°í local
 host »çÀÌÀÇ Åë½ÅÀÌ ¼º°øÀÓÀ» ³ªÅ¸³½´Ù.

3. Building a Static Routing Table
 ¿ÜºÎ gateway¸¦ ÅëÇØ remote host·Î µµ´ÞÇÏ·Á¸é routing table¿¡ route°¡ ¹Ýµå½Ã ´õ
 ÇØÁ®¾ç ÇÑ´Ù. "route" ¸í·É¾î´Â routing table¿¡ entry¸¦ ¼öµ¿À¸·Î ´õÇϰųª »èÁ¦ÇÒ
 ¼ö ÀÖ´Ù.

  ---------------------------------------------
 | #route add 26.0.0.0 128.66.12.1.1          |
 | add net 26.0.0.0 : gateway almond          |
 ---------------------------------------------

 cf) #route add destination gateway metric

 destination address´Â IP address, /etc/networks fileÀÇ network name ¶ÇÇÑ     
 /etc/hosts fileÀÇ host name, ±×¸®°í "default" ·Î ¸í½ÃµÈ´Ù.
 ´ëºÎºÐÀÇ route°¡ startup ÀÌÀü¿¡ Ãß°¡µÇ¹Ç·Î IP address°¡ nameº¸´Ù ¸¹ÀÌ »ç¿ëÇÑ´Ù.
 name service°¡ ¾ø´Ù´Â °¡Á¤ÇÏ¿¡ routing configuration¿¡ ÇÊ¿äÇÑ fileÀº ´õÀÌ»ó¾ø´Ù
 Ç×»ó 4byte numeric IP address¸¦ »ç¿ëÇϸç 4byteº¸´Ù ÀÛÀ¸¸é "route"°¡ address¸¦ 
 È®Àå½ÃŲ´Ù. ÀÌ°á°ú ¿ì¸®ÀÇ Àǵµ¿Í Ʋ¸±¼ö ÀÖ´Ù.
 "26"À̶ó°í ÁÖ¾îÁú°æ¿ì ¾î¶² "route"ÀÇ ±¸ÇöÀº 26.0.0.0 À̶ó È®ÀåÇÏ¸ç ¾î¶²°ÍÀº
 0.0.0.26 À̶ó ÇÒ¼ö ÀÖ´Ù. "default"°¡ destination address¿¡ ¾²À̸é route´Â  
 default route¸¦ ¸¸µë. default route¿¡ ¿¬°üµÈ network address´Â 0.0.0.0 À̸ç 
 default route´Â destinationÀ¸·Î ¸í½ÃµÈ route°¡ ¾øÀ»°æ¿ì¿¡ Ç×»ó »ç¿ëµÈ´Ù.
 ±×¸®°í ÀÌ°ÍÀÌ ¿ì¸®¿¡°Ô ÇÊ¿äÇÑ À¯ÀÏÀÇ route¸¦ °¡Áú¼ö ÀÖ´Ù.
 ¸¸¾à networkÀÌ ÇϳªÀÇ gateway ¸¸À» °¡Áø´Ù¸é default route¸¦ »ç¿ëÇÏ¿© ÇØ´ç 
 gateway ¸¦ ÅëÇÏ¿© remote networkÀ» ÇâÇÑ ¸ðµç trafficÀ» Á÷Á¢ÀûÀ¸·Î routeÇÑ´Ù.

 route ¸í·É¾îÀÇ ´ÙÀ½ field´Â gateway addressÀÌ´Ù.  ÀÌ°ÍÀº ¸ñÀûÁö address·Î º¸³»
 ´Â dataµéÀÌ °æÀ¯ÇÒ external gatewayÀÇ addressÀÌ´Ù.
 ÀÌ°ÍÀº ¹Ýµå½Ã Á÷Á¢ÀûÀ¸·Î network¿¡ ¿¬°áµÈ gatewayÀÇ addressÀ̾î¾ß ÇÑ´Ù.

 routeÀÇ ¸¶Áö¸· argument´Â routing metricÀÌ´Ù. ÀÌ°ÍÀº route¸¦ deleteÇÒ¶§´Â »ç¿ë
 µÇÁö¾ÊÀ¸¸ç addedµÉ¶§´Â Ç×»ó ÇÊ¿äÇÏ´Ù. ¸¸¾à route°¡ local interface¸¦ ÅëÇÏ¿© G
 flag°¡ setting µÇ¾îÀÖÁö ¾ÊÀ¸¸é metric ÀÌ 0 ÀÌ µÇ¸ç metric value°¡ 0 º¸´Ù Å©°í
 G flag°¡ setting µÇ¾î route°¡ ¼³Ä¡µÇ¾î ÀÖÀ¸¸é ÇØ´ç gateway address´Â external
 gateway ·Î ¿©°ÜÁø´Ù. static routing¿¡¼­ metricÀÇ ¾²ÀÓÀº ´Ù¸¥¿ëµµ´Â ¾øÀ¸¸ç ´Ù¾ç
 ÇÑ metric value ÀÇ »ç¿ëÀº dynamic routing¿¡¼­¸¸ ÇÊ¿äÇÏ´Ù.