B / Y / U / S
HOME À¥ È£½ºÆà µµ¸ÞÀÎ ¸Å´º¾ó °í°´Áö¿ø ¼³Á¤Á¤º¸ °èÁ¤½Åû 2024-12-24 Tuesday 
À¥ È£½ºÆÃ
# °øÁö »çÇ×
# ÀÚÁÖ ¹¯´Â Áú¹®
# Áú¹®°ú ´äº¯
# °¡ÀÔ ¹®ÀÇ
Ä¿¹Â´ÏƼ
# ÀÚÀ¯°Ô½ÃÆÇ
# ¸®´ª½ºÆÁ
# ¾ÆÀÌÅ¥ Å×½ºÆ®
# ³»È¨ ¼Ò°³
# °Ö·¯¸®
# ÀÚ·á½Ç

  ¸®´ª½ºÆÁ  Go Unix Power Tools Online Book Go Bash Guide
Read No. 82 article 2002-01-27 02:02:36
NickName   Ç®ºñ´©
Subject   IP º¯°æ½Ã ¸ÞÀÏ·Î Àü¼Û ½ºÅ©¸³Æ®
±Û¾´ÀÌ: ¹Ú°æÈ£

Çã´þÇÑ ÆÁÀÔ´Ï´Ù... 
Á¦°¡ µÑ³ÝÀ» ¾²´Âµ¥¿©... 
À¯µ¿¾ÆÇÇ¶ó¼­ ÄÓ¶§¸¶´Ù ip°¡ ¹Ù²ò´Ï´Ù. °¡²ûÀº ±×´ë·ÎÀ̱¸¿©... 
±×·¡¼­ Áý¹Û¿¡¼­µµ ÄÄ¿¡ Á¢±ÙÇÒ ¼ö ÀÖµµ·Ï ½ºÅ©¸³Æ®¸¦ ¸¸µé¾îºÃ½À´Ï´Ù... 
/etc/rc.d/rc.local¿¡ ¾Æ·¡¿Í °°ÀÌ µî·ÏÇØ µÎ¸é µÇ°ÚÁÒ... 

/etc/startup/ip_send > /dev/null & 

À¯µ¿ip¸¦ µµ¸ÞÀÎÀ¸·Î ¹Ù²ãÁÖ´Â ¼­ºñ½ºµµ ÀÖ´øµ¥... ±×°É º°·Î ÁÁ¾ÆÇÏÁö ¾Ê´Â 
ºÐµéÀº ½áº¸¼¼¿ä.. ip¸¸À¸·Î ã¾Æ°¡´Ï±î ÈÎ »¡¸® ¶ßÁÒ... 

´Ù¸¥°Ç °Çµé ÇÊ¿ä ¾ø°í /etc/startup µð·ºÀ» ¸¸µé°í °Å±â´Ù ip_send, mail_list 
ÆÄÀϸ¸ ¸¸µé¾îÁÖ¸é µË´Ï´Ù. Æ÷Æ®¸¦ ¹Ù²Ù¾î¼­ ¿î¿µÇϽøé port ÆÄÀÏÀ» ¸¸µé°í °Å±â´Ù 
¿øÇÏ´Â ³»¿ëÀ» Àû¾îÁÖ¸é µË´Ï´Ù. 

¿ì¸®ÁýÀÌ µÑ³Ý¿¡¼­ ip¸¦ ÇÊÅ͸µÇؼ­ www°ú ftp°¡ ¾ÈµÇ´õ±º¿ä... 80¹ø°ú 21¹øÀ¸·Î´Â... 
±×·¡¼­ ¹Ù²ã¼­ µ¹¸®°í ÀÖ½À´Ï´Ù. ±×°Íµµ ¸ð¸£°í ±âº»Æ÷Æ®¿¡¼­ ¾ÈµÈ´Ù°í ¸îÀÏÀ» 
³­¸®¸¦ Ãƴµ¥... 

¿©±â´Â /etc/startup/ À̶ó´Â µð·ºÀ» ¸¸µé°í °Å±â¿¡ ÀúÀåµÇ¾î ÀÖ´Â ¸ð¾çÀÔ´Ï´Ù. 
±×¸®°í mail_list¶ó´Â ÆÄÀÏÀ» ¸¸µé°í °Å±â¿¡´Ù º¸³¾ »ç¶÷ÀÇ ¸ÞÀÏÁÖ¼Ò¸¦ ÀûÀ¸¸é µË´Ï´Ù. 


# /etc/startup/ip_send 
#!/bin/sh 

# ºÎÆ®½Ã¿¡ Áö³­¹øÀÇ ip¿Í »õ·Î ¾òÀº ip°¡ ´Ù¸¦ °æ¿ì /etc/startup/ip ÆÄÀÏÀ» °»½ÅÇÏ°í 
# »õ·Î¿î ip¸¦ mail_list¿¡ µî·ÏµÈ »ç¿ëÀÚ¿¡°Ô º¸³½´Ù. 

IP_ADDR=`/sbin/ifconfig eth0 | grep inet | cut -c21-35 | grep '^[1-9]'` 
# »õ·Î ¾òÀº ip¸¦ ±¸ÇÑ´Ù. 
if [ -f /etc/startup/ip ]; then # ÆÄÀÏÀÌ ÀÖÀ» °æ¿ì... 
OLD_IP_ADDR=`cat /etc/startup/ip` 
else 
OLD_IP_ADDR='192.168.0.1' # ÆÄÀÏÀÌ ¾øÀ¸¸é ±âº» ip¸¦ 
fi # ¼ÂÆÃÇÑ´Ù... 

#echo "New ip_address is $IP_ADDR" 
#echo "Old ip_address is $OLD_IP_ADDR" 

if [ $OLD_IP_ADDR != $IP_ADDR ]; then 
echo $IP_ADDR > /etc/startup/ip # »õ·Î¿î ip¸¦ ÆÄÀÏ¿¡ ¾´´Ù.... 
echo "Ip address is changed." > /etc/startup/ip_msg # ¸ÞÀÏ¿¡ ÀûÀ» ¸»µé.. 
echo "The new ip address is" >> /etc/startup/ip_msg 
echo >> /etc/startup/ip_msg 
echo "$IP_ADDR" >> /etc/startup/ip_msg 
echo >> /etc/startup/ip_msg 
echo >> /etc/startup/ip_msg 
if [ -f /etc/startup/port ]; then 
cat /etc/startup/port >> /etc/startup/ip_msg # Æ÷Æ®¹øÈ£°¡ ´Ù¸£¹Ç·Î °°ÀÌ º¸³½´Ù... 
fi 
if [ -f /etc/startup/mail_list ]; then 
MAIL_LIST=$(grep '^[^#]' /etc/startup/mail_list | cut -d: -f1|sort|uniq) 
# ÁÖ¼®¹®ÀÚ '#'·Î ½ÃÀÛÇÏ´Â ³ðÀ» Á¦¿ÜÇÑ ¸ðµç ÀÌ¿¡°Ô ¸ÞÀÏÀ»... 
for i in $MAIL_LIST;do 
# echo $i 
cat /etc/startup/ip_msg | /bin/mail -s ip_address $i 
done 
else 
echo "Please make your mail_list file..." 
fi 
fi 





# /etc/startup/mail_list 
# ÁÖ¼®Àº ¹Ýµå½Ã '#'°¡ ÇàÀÇ Ã¹ Ä÷³¿¡ ÀÖ¾î¾ß ÇÕ´Ï´Ù. 
default_user at localhost.localdomain
Regist Addr [ 192.168.0.2 ] ¸ñ·Ïº¸±â À­±Û ¾Æ·§±Û
Á¤±ÔÇ¥Çö½Ä [ »ó¼¼ °Ë»ö ]
Page Loading [ 0.03 Sec ] SQL Time [ 0 Sec ]

Copyleft 1999-2024 by JSBoard Open Project
Theme Designed by IDOO And follow GPL2

°³ÀÎÁ¤º¸ Ãë±Þ¹æħ ÀÌ¿ë ¾à°ü »çÀÌÆ® ¸Ê ¾îµå¹Î °ü¸®