iptable mangle Å×À̺í°ú forward fwmark ¸¦ ÀÌ¿ëÇؼ Dynamic ÇÑ Æ÷Æ®¸¦ ÀÌ¿ëÇÏ¿© ´ÙÁßÆ÷Æ®¿¡ ´ëÇؼ ¹ë·±½ÌÀ» ÇѴٰųª 80¹ø°ú 443°ú °°ÀÌ ÀüÀÚ»ó°Å·¡¿¡ ÀÎÁõ°ü·ÃÇؼ Ç×»ó ±×·ìÁö¾î¼ ¿î¿µÇÏ¿©¾ßÇÒ¶§ »ç¿ëÇÏ´Â ¹æ½Ä¿¡ ´ëÇؼ ¼³¸íÇÏ°íÀÚ ÇÑ´Ù.
forward fwmakr (¹æȺ® Ç¥½Ã±â´É??)
¹æȺ® Ç¥½Ã ±â´ÉÀº ¿¬°üµÈ ÇÁ·ÎÅäÄÝÀÇ ÇÁ·ÎÅäÄÝÀ̳ª ±×·ì¿¡ »ç¿ëµÇ´Â °¡Àå ½±°í È¿°úÀûÀÎ ±×·ì Æ÷Æ® ¹æ¹ýÀÔ´Ï´Ù. ¿¹¸¦ µé¾î, LVS°¡ ÀüÀÚ »ó°Å·¡ »çÀÌÆ®¸¦ ½ÇÇàÇϵµ·Ï µÇ¾î ÀÖÀ» °æ¿ì, ¹æȺ® Ç¥½Ã ±â´ÉÀº Æ÷Æ® 80¿¡¼ÀÇ HTTP ¿¬°á°ú Æ÷Æ® 443¿¡¼ÀÇ HTTPS ¿¬°áÀ» ÀÏ°ýÀûÀ¸·Î ¹¾î ó¸®Çϴµ¥ »ç¿ëµÉ ¼ö ÀÖ½À´Ï´Ù. °¢°¢ÀÇ ÇÁ·ÎÅäÄÝ¿¡ ´ëÇØ °¡»ó ¼¹ö¿¡ µ¿ÀÏÇÑ ¹æȺ® Ç¥½Ã ±â´ÉÀ» ÁöÁ¤Çϸé Æ÷Æ®°¡ ¿¬°áµÈ ÈÄ LVS ¶ó¿ìÅÍ°¡ µ¿ÀÏÇÑ ½ÇÁ¦ ¼¹ö¿¡ ¸ðµç ¿äûÀ» º¸³»±â ¶§¹®¿¡ Æ®·£Àè¼Ç¿¡ ´ëÇÑ »óÅ Á¤º¸¸¦ º¸È£ÇÒ ¼ö ÀÖ½À´Ï´Ù.
ÀÌ¿Í °°Àº È¿°úÀûÀÌ°í »ç¿ë °£ÆíÇÔ ¶§¹®¿¡ LVS °ü¸®ÀÚ´Â ±×·ì ¿¬°áÀ» ÇÒ ¶§ ¸¶´Ù Áö¼Ó¼º ±â´Éº¸´Ù ¹æȺ® Ç¥½Ã ±â´ÉÀ» »ç¿ëÇØ¾ß ÇÕ´Ï´Ù. ÇÏÁö¸¸, Ŭ¶óÀ̾ðÆ®°¡ ÀÏÁ¤ ±â°£ µ¿¾È µ¿ÀÏÇÑ °¡»ó ¼¹ö·Î ´Ù½Ã ¿¬°áÇÏ°Ô Çϱâ À§ÇØ °¡»ó ¼¹ö¿¡ ¹æȺ® ±â´É°ú ÇÔ²² Áö¼Ó¼º ±â´ÉÀ» Ãß°¡½Ãų ¼ö ÀÖ½À´Ï´Ù.
ƯÁ¤Æ÷Æ®¸¦ ¸®¾ó¼¹ö Æ÷Æ®¿¡ 1:1 ¸ÅÇÎÁö¾î¼ ¿î¿µÇÏ°Ô µÉ°æ¿ì ´ÜÁ¡
1. Active ÀûÀÎ Æ÷Æ®¿¡ ´ëÇؼ ÀÏÀÏÈ÷ ¼ºñ½º¸¦ µî·ÏÀ» ÇØÁà¾ßÇÑ´Ù.
2. 80Æ÷Æ®¿Í 443 Æ÷Æ®ÇÏ°í ±×·ìÈµÇ¾î¼ ¿î¿µµÇ¾î¾ß Çϴ°æ¿ì
Every 2.0s: ipvsadm -ln Tue Feb 1 11:11:36 2011
IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConn TCP 192.234.6.2:80 sh -> 192.234.6.8:80 Masq 1 0 0 -> 192.234.6.7:80 Masq 1 0 0 TCP 192.234.6.2:443 sh -> 192.234.6.7:443 Masq 1 0 0 -> 192.234.6.8:443 Masq 1 0 0
|
¡Ø ¸®¾ó¼¹ö¸¦ º¸¸é VIP¿¡ ¹°·ÁÀÖ´Â ¼ø¼°¡ ´Ù¸£´Ù.
ldirectord ¸ð´ÏÅ͸µ¿¡ µû¶ó¼ ¼ºñ½º·Î »õ·Î ¿Ã¶ó¿À°í »èÁ¦µÊ¿¡ µû¶ó¼ ¸®¾ó¼¹ö ¼ø¼°¡ ¹Ù²î°Ô µÇ´Âµ¥ ¼¼¼ÇÀ» DBÈÇÏÁö ¾ÊÀ»°æ¿ì¿¡´Â ÀÎÁõ¼¹ö(443Æ÷Æ®)¿Í ¼ºñ½º(80Æ÷Æ®)°¡ SH ½ºÄÉÁÙ¸µ¿¡ ÀÇÇØ °¢±â ´Ù¸¥ ¼¹ö·Î Á¢¼ÓÇعö¸®¸é ÀÎÁõÀº 7¹ø¼¹ö¿¡¼ ÇÏ°í ½ÇÁ¦ ¼ºñ½ºÇÏ´Â Æ®·¡ÇÈÀº 8¹ø ¼¹ö¸¦ Á¢¼ÓÇÏ´Â ¹®Á¦·Î ÀÎÇØ ÀÎÁõÀÌ ¹Ù·Î Ç®¸®°Ô µÇ¹ö¸®´Â Çö»óÀÌ ¹ß»ýµÈ´Ù.
ÀÌ·²°æ¿ì ¸®¾ó¼¹ö¸¦ ±×·ìÈÇؼ »ç¿ëÇØ¾ß ÇÑ´Ù.
# VIP ·Î µé¾î¿À´Â 80,443 Æ÷Æ®¿¡ ´ëÇؼ MARK 1
[root@localhost ~]# iptables -t mangle -A PREROUTING -i br0 -p tcp -d 192.234.6.2 -m multiport --dport 80,443 -j MARK --set-mark 1
# MARK1 À¸·Î º¸³»Áö´Â Æ®·¡ÇÈÀº ¸®¾ó¼¹ö·Î ºÐ»ê
[root@localhost ~]# ipvsadm -A -f 1 -s sh [root@localhost ~]# ipvsadm -a -f 1 -r 192.234.6.7 [root@localhost ~]# ipvsadm -a -f 1 -r 192.234.6.8
IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConn FWM 1 sh -> 192.234.6.7:0 Masq 1 2 0 -> 192.234.6.8:0 Masq 1 0 0 |
¿©±â¿¡ ldirectord ¸¦ ÀÌ¿ëÇؼ ¸®¾ó¼¹ö ¸ð´ÏÅ͸µ ºÎºÐÀ» Ãß°¡Çϸé...
[root@localhost ~]# cat > ldirectord.cf
checktimeout=3 checkinterval=3 autoreload=yes logfile="/var/log/ldirectord.log" quiescent=no
virtual=1 scheduler=sh checktype=connect protocol=fwm checkport=80 real=192.234.6.7 masq real=192.234.6.8 masq |