´ÙÀ½ ÀÌÀü Â÷·Ê

2. ¸í·É ¹× °á°ú

ù°·Î IP Alias ¸ðµâÀ» ¶ç¿ö¾ß ÇÑ´Ù. (¹Ì¸® ¸ðµâÀ» Ä¿³Î·Î ÄÄÆÄÀÏ ÇßÀ¸¸é, ÀÌ ´Ü°è¸¦ ¶Ù¾î³Ñ¾îµµ µÈ´Ù.)

     /sbin/insmod /lib/modules/`uname -r`/ipv4/ip_alias.o

µÎ¹ø°, ·çÇÁ¹éÀ» ¼³Á¤ÇÑÈÄ eth0°ú ¸ðµç ´Ù¸¥ IP³Ñ¹öµéÀº eth0 ÀÎÅÍÆäÀ̽º¸¦ À§Çؼ­ ÁÖ IP³Ñ¹ö·Î ½ÃÀ۵Ǿî¾ß ÇÑ´Ù.

     /sbin/ifconfig lo 127.0.0.1
     /sbin/ifconfig eth0 up
     /sbin/ifconfig eth0 172.16.3.1
     /sbin/ifconfig eth0:0 172.16.3.10
     /sbin/ifconfig eth0:1 172.16.3.100

172.16.3.1 Àº ÁÖIP³Ñ¹öÀÌ°í .10°ú .100Àº AliasµÈ IP³Ñ¹öÀÌ´Ù. ´Ù¸¥ ¾ÆÀÌÇÇ ³Ñ¹ö¿¡ ´ëÇؼ­ eth0:x¿¡ 0,1,2...nÀ» ´ëÀÔÇÏ´Â °ÍÀÌ ¹æ¹ýÀÌ´Ù. ÁÖ IP ³Ñ¹ö´Â ¾Ë¸®¾Æ½ºµÉ ÇÊ¿ä°¡ ¾ø´Ù.

¼Â°·Î ¶ó¿ìÆ® Á¤º¸¸¦ ¼³Á¤ÇÑ´Ù. ·çÇÁ¹éÀ» ù°·Î ¶ó¿ìÆ®½ÃÅ°°í net À» ±× ´ÙÀ½À¸·Î ±×¸®°í ¸¶Áö¸·À¸·Î ±âº» ¾ÆÀÌÇÇ(¿ø·¡ ¹è´ç¹Þ¾Ò´ø)·Î ½ÃÀ۵Ǵ ¾ÆÀÌÇÇ ³Ñ¹öµéÀ» ¼Â¾÷ÇÑ´Ù.

     /sbin/route add -net 127.0.0.0
     /sbin/route add -net 172.16.3.0 dev eth0
     /sbin/route add -host 172.16.3.1 dev eth0
     /sbin/route add -host 172.16.3.10 dev eth0:0
     /sbin/route add -host 172.16.3.100 dev eth0:1
     /sbin/route add default gw 172.16.3.200

ÀÌ°Ô ´ÙÀÌ´Ù.

À§ÀÇ ¿¹¿¡¼­ µç ¾ÆÀÌÇdzѹö´Â Private IP³Ñ¹ö(RFC 1918)¸¦ ½ÇÁ¦Àû ¿¹°¡ µÇ´Â ¸ñÀûÀ¸·Î »ç¿ëÇß´Ù. ¿©·¯ºÐÀÇÀÇ ½ÇÁ¦ ¾ÆÀÌÇdzѹö¸¦ ÀÌ°ÍÀ̶û ´ëüÇؼ­ ½á¶ó.

3°³ÀÇ ¾ÆÀÌÇÇ ³Ñ¹ö¿¡ ´ëÇؼ­ ¿¹¸¦ µé¾ú´Ù. ÃÖ´ëÄ¡´Â 256À¸·Î /usr/include/linux/net_alias.h¿¡ Á¤ÀǵǾîÀÖ´Ù. »ç½Ç ÇÑÄ«µå¿¡ 256°³ÀÇ IP³Ñ¹ö´Â ¸¹Àº °ÍÀÌ´Ù.

¿©±â¿¡ ³ªÀÇ /sbin/infconfigÀÌ º¸¿©ÁÖ´Â °á°ú°¡ ÀÖ´Ù.

lo       Link encap:Local Loopback
          inet addr:127.0.0.1  Bcast:127.255.255.255  Mask:255.0.0.0
          UP BROADCAST LOOPBACK RUNNING  MTU:3584  Metric:1
          RX packets:5088 errors:0 dropped:0 overruns:0
          TX packets:5088 errors:0 dropped:0 overruns:0

eth0      Link encap:10Mbps Ethernet  HWaddr 00:8E:B8:83:19:20
          inet addr:172.16.3.1  Bcast:172.16.3.255  Mask:255.255.255.0
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:334036 errors:0 dropped:0 overruns:0
          TX packets:11605 errors:0 dropped:0 overruns:0
          Interrut:7 Base address:0x378

eth0:0    Link encap:10Mbps Ethernet  HWaddr 00:8E:B8:83:19:20
          inet addr:172.16.3.10  Bcast:172.16.3.255  Mask:255.255.255.0
          UP BROADCAST RUNNING  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0
          TX packets:0 errors:0 dropped:0 overruns:0

eth0:1    Link encap:10Mbps Ethernet  HWaddr 00:8E:B8:83:19:20
          inet addr:172.16.3.100  Bcast:172.16.3.255  Mask:255.255.255.0
          UP BROADCAST RUNNING  MTU:1500  Metric:1
          RX packets:1 errors:0 dropped:0 overruns:0
          TX packets:0 rrors:0 dropped:0 overruns:0

±×¸®°í /proc/netaliase:

device           family address
eth0:0           2      172.16.3.10
eth0:1           2      172.16.3.100

¶Ç /proc/net/alias_types¿¡¼­ º¸¿©Áö´Â °ÍÀÌ´Ù.

type    name            n_attach
2       ip              2

¹°·Ð, /proc/net¿¡ ÀÖ´Â ÀÌ·±°ÍµéÀº ifconfig ¸í·É¿¡ ÀÇÇؼ­ ¸¸µé¾îÁø °ÍÀÌÁö

³» ¼öÀÛ¾÷ÀÌ ¾Æ´Ï´Ù!!


´ÙÀ½ ÀÌÀü Â÷·Ê