¸®´ª½º ¿¡¼­ IP Aliasing ¼¼ÆÃÇϱâ mini HOWTO Harish Pillay, 0.?, 1997³â 1¿ù 13ÀÏ À̱ÛÀº ¸®´ª½º¹Ú½º¿¡¼­ IP aliasingÀ» ¾î¶»°Ô ¼³Á¤ÇÏ°í ½ÇÇàÇÒ °ÍÀÎÁö¿¡ ´ëÇÑ °ÍÀÌ´Ù. Âü°í·Î, Alias µÈ IP·Î E-mailÀ» ¹ÞÀ» ¼ö ÀÖµµ·Ï ¼³Á¤À» ¾î¶»°Ô ÇÒ °ÍÀÎÁö¿¡ ´ëÇÑ ¹æ¹ýÀÌ µé¾îÀÖ´Ù. Primary site: ______________________________________________________________________ ¸ñÂ÷ 1. ³ªÀÇ È¯°æ 2. ¸í·É ¹× °á°ú 3. Áú¹®°ú ´äº¯ 3.1 ºÎÆýÿ¡ ¾î¶»°Ô ȯ°æ¼³Á¤À» Áöų ¼ö Àִ°¡? 3.2 IP aliasedµÈ ¼­¹öÀÇ e-mail ¼Â¾÷ 4. ´ç½ÅÀº ¸ðµç°É ³¡³Â´Ù. ______________________________________________________________________ 1. ³ªÀÇ È¯°æ · ¸®´ª½º Ä¿³Î 2.0.27 (from ftp.funet.fi:/pub/Linux/kernel/src/v2.0) · IP Alias´Â ·ÎµåÇÒ¼ö ÀÖ´Â ¸ðµâ·Î ÄÄÆÄÀϵǾú´Ù. ´ç½ÅÀÌ IP Masq¸¦ ¸ðµâ·Î ÄÄÆÄÀÏ ÇÏ°í ½Í´Ù¸é, Ä¿³Î ÄÄÆÄÀϽà "make config"·Î ¼³Á¤ÇÒ ¼ö ÀÖ´Ù. Modules HOWTO¸¦ Àо°Å³ª, /usr/src/linux/Documentation/modules.txt¿¡¼­ È®ÀÎÇÒ ¼ö ÀÖ´Ù. · ³ª´Â µÎ°³ÀÇ IP¸¦ ´õ ¾µ °ÍÀÌ°í ÀÌ µÎ°³´Â ÀÌ¹Ì ³ª¿¡°Ô ºÎ¿©µÈ °ÍÀÌ´Ù. · D-Link DE620 Æ÷Ĺ ¾Æ´äŸ(¾î¶² ¸®´ª½º ¾Æ´äŸ¸¦ ¾²´øÁö Áß¿äÇÏÁö ¾Ê´Ù.) 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 ¸í·É¿¡ ÀÇÇؼ­ ¸¸µé¾îÁø °ÍÀÌÁö ³» ¼öÀÛ¾÷ÀÌ ¾Æ´Ï´Ù!! 3. Áú¹®°ú ´äº¯ 3.1. ºÎÆýÿ¡ ¾î¶»°Ô ȯ°æ¼³Á¤À» Áöų ¼ö Àִ°¡? ´ç½ÅÀÌ BSD½ºÅ¸ÀÏÀ̳ª SysV½ºÅ¸ÀÏ(¿¹:·¹µåÇÞ)ÀÇ initÀ» ¾²´ø ´ç½ÅÀº /etc/rc.d/rc.local¿¡ ±×°ÍÀ» Æ÷ÇÔÇÒ ¼ö ÀÖ´Ù. ¾Æ·¡¿¡´Â ³»°¡ ¾²´Â SysV init ÀÌ´Ù.(·¹µåÇÞ 3.0.3 or 4.0) ³ªÀÇ /etc/rc.d/rc.local (edited to show the relevant portions) #setting up IP alias interfaces echo "Setting 172.16.3.1, 172.16.3.10, 172.16.3.100 IP Aliases ..." /sbin/ifconfig lo 127.0.0.1 /sbin/ifconfig eth0 up /sbin/ifconfig eth0 172.16.3.1 /sbin/fconfig eth0:0 172.16.3.10 /sbin/ifconigfeth0:1 172.16.3.100 #setting up the routes echo "Setting IP routes ..." /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 eth0 /sbin/route add -host 172.16.3.10 eth0:0 /sbin/route add -host 172.16.3.100 eth0:1 /sbin/route add default gw 172.16.3.200 3.2. IP aliasedµÈ ¼­¹öÀÇ e-mail ¼Â¾÷ Áú¹®: ¾î¶»°Ô °¢¾ç°¢»öÀ¸·Î aliasµÈ ¾ÆÀÌÇÇ ³Ñ¹ö¿¡¼­ IP aliasedµÈ ¼­¹ö¸¦ e-mailÀ» ¹Þ°Ô ¼Â¾÷ÇÒ¼ö ÀÖ½À´Ï±î?(sendmailÀ» ¾²´Â ¼­¹ö¿¡¼­) /etc/mynames.cwÀÇ ¿¹¿¡¼­ º¸¿©Áö´Â°Í°ú °°Àº ÆÄÀÏÀ» ¸¸µé¶ó(±×°ÍÀÌ Á¸ÀçÇÏÁö ¾Ê´Â´Ù¸é) ±×°ÍÀº ÀÌ°Í°ú °°Àº À̸§ÀÌ ¾Æ´Ï°Å³ª /etcµð·ºÅ丮¿¡ ¾øÀ»¼öµµ ÀÖ´Ù. (¿ªÀÚÁÖ: ·¹µåÇò¿¡¼­´Â sendmail.cf ¿¡¼­ cw ¸¦ »ç¿ëÇÑ´Ù°í Á¤ÀÇµÇ ÀÖ´Ù./etc/sendmail.cw ¸¦ »ç¿ëÇÑ´Ù.) ÀÌ ÆÄÀÏ¿¡¼­ aliasµÈ ¾ÆÀÌÇdzѹöÀÇ µµ¸ÞÀÎ ³×ÀÓÀ» Àû´Â´Ù. ¸¸¾à ¾Ë¸®¾Æ½ºµÈ ¾ÆÀÌÇÇ°¡ µµ¸ÞÀγ×ÀÓÀ» ¾È°¡Áö°í ÀÖÀ»°æ¿ì¿¡´Â ¾ÆÀÌÇdzѹö ÀÚü¸¸À» ½áÁÙ¼öµµ ÀÖ´Ù. ______________________________________________________________________ /etc/mynames.cw: ---------------- # /etc/mynames.cw - ´ç½ÅÀÇ ¼­¹ö¿¡´ëÇÑ ¸ðµç ¾Ë¸®¾Æ½º À̸§À» ¿©±â´Ù Àû´Â´Ù. # Àº ÁÖ¼®ÀÌ´Ù. domain.one.net domain.two.com domain.three.org 4.5.6.7 ______________________________________________________________________ ´ç½ÅÀÇ sendmial.cf È­ÀÏ¿¡¼­ ÆÄÀÏ Å¬·¡½º ¸ÅÅ©·Î Fw¸¦ Á¤ÀÇÇÏ´Â ºÎºÐ¿¡¼­ ´ÙÀ½À» Ãß°¡ÇÑ´Ù. ______________________________________________________________________ ################## # local info # ################## . . # ¿ì¸®°¡ ÀÌ-¸ÞÀÏÀ» ¹Þ±âÀ§ÇÑ È£½ºÆ® À̸§À» °¡Áö°íÀÖ´Â ÆÄÀÏ Fw/etc/mynames.cw . . . ______________________________________________________________________ ÀÌ°ÍÀº ²À ÇغÁ¾ß ÇÑ´Ù. »õ·Î¿î ¼³Á¤À» Å×½ºÆ®Çϱâ À§Çؼ­ Å×½ºÆ®¸ðµå·Î ¼¾µå¸ÞÀÏÀ» ½ÇÇàÀ» ÇÑ´Ù. (¿ªÀÚÁÖ: ¸» ±×µ¥·Î ²À Çغ¸±â ¹Ù¶õ´Ù. sendmail Àº ¸ÞÀÏÀ» ¹Þ°í º¸³»±â À§ÇÑ ¾ÆÁÖ Áß¿äÇÑ µ¥¸óÀÌ´Ù. ¾à°£ÀÇ ½Ç¼ö·Î ¸ÞÀÏÀ» ¸ø ¹Þ°Ô µÈ´Ù¸é?) ganymede$ /usr/lib/sendmail -bt ADDRESS TEST MODE (ruleset 3 NOT automatically invoked) Enter < ruleset> < address> > 0 me@4.5.6.7 rewrite: ruleset 0 input: me @ 4 . 5 . 6 . 7 rewrite: ruleset 98 input: me @ 4 . 5 . 6 . 7 rewrite: ruleset 98 returns: me @ 4 . 5 . 6 . 7 rewrite: ruleset 97 input: me @ 4 . 5 . 6 . 7 rewrite: ruleset 3 input: me @ 4 . 5 . 6 . 7 rewrite: ruleset 96 input: me < @ 4 . 5 . 6 . 7 > rewrite: ruleset 96 returns: me < @ 4 . 5 . 6 . 7 . > rewrite: ruleset 3 returns: me < @ 4 . 5 . 6 . 7 . > rewrite: ruleset 0 input: me < @ 4 . 5 . 6 . 7 . > rewrite: ruleset 98 input: me < @ 4 . 5 . 6 . 7 . > rewrite: ruleset 98 returns: me < @ 4 . 5 . 6 . 7 . > rewrite: ruleset 0 returns: $# local $: me rewrite: ruleset 97 returns: $# local $: me rewrite: ruleset 0 returns: $# local $: me > 0 me@4.5.6.8 rewrite: ruleset 0 input: me @ 4 . 5 . 6 . 8 rewrite: ruleset 98 input: me @ 4 . 5 . 6 . 8 rewrite: ruleset 98 returns: me @ 4 . 5 . 6 . 8 rewrite: ruleset 97 input: me @ 4 . 5 . 6 . 8 rewrite: ruleset 3 input: me @ 4 . 5 . 6 . 8 rewrite: ruleset 96 input: me < @ 4 . 5 . 6 . 8 > rewrite: ruleset 96 returns: me < @ 4 . 5 . 6 . 8 > rewrite: ruleset 3 returns: me < @ 4 . 5 . 6 . 8 > rewrite: ruleset 0 input: me < @ 4 . 5 . 6 . 8 > rewrite: ruleset 98 input: me < @ 4 . 5 . 6 . 8 > rewrite: ruleset 98 returns: me < @ 4 . 5 . 6 . 8 > rewrite: ruleset 95 input: < > me < @ 4 . 5 . 6 . 8 > rewrite: ruleset 95 returns: me < @ 4 . 5 . 6 . 8 > rewrite: ruleset 0 returns: $# smtp $@ 4 . 5 . 6 . 8 $: me < @ 4 . 5 . 6 . 8 > rewrite: ruleset 97 returns: $# smtp $@ 4 . 5 . 6 . 8 $: me < @ 4 . 5 . 6 . 8 > rewrite: ruleset 0 returns: $# smtp $@ 4 . 5 . 6 . 8 $: me < @ 4 . 5 . 6 . 8 > > ³»°¡ me@4.5.6.7À» Å×½ºÆ®ÇßÀ»¶§¸¦ ÁÖÀÇÇؼ­º¸ÀÚ. ±×°ÍÀº me@4.5.6.8ÀÌ smtp mailer¿¡ ÀÇÇؼ­ ÅëÁ¦°¡ ³¡³ª´Â µ¿¾È ·ÎÄ® ¸Ó½®¿¡ ¸ÞÀÏÀ» º¸³Â´Ù. 4. ´ç½ÅÀº ¸ðµç°É ³¡³Â´Ù. ¾Õ¼­ ¸»Çß´ø °ÍÀÌ À¯¿ëÇßÀ¸¸é ÁÁ°Ú´Ù. ÀÌ ¸®´ª½º¿Í ¾ÆÀÌÇÇ ¾Ë¸®¾Æ½Ì¿¡ ´ëÇÑ Àϵ鿡 °ü¿©Çß´ø ¸ðµç À̵鿡°Ô °¨»çµå¸°´Ù. ¸¸¾à ´ç½ÅÀÌ ÀÌ ¹®¼­°¡ À¯¿ëÇϰųª Áú¹®, Á¦¾ÈÀ» ÇÒ°ÍÀÌ Àְųª °³¼±À» ÇؾßÇÒ Á¡À» ¹ß°ßÇÏ¸é ·Î E-mail À» º¸³»´Þ¶ó.