2011-06-14 1 views

답변

1

마지막으로 효과가 있었던 것은/etc/hosts의 항목을 IP 주소로 올바르게 업데이트하는 것이 었습니다.

우분투에서는 네트워크 관리자가 네트워크 인터페이스를 구성한 후 /etc/network/if-up.d 디렉토리의 실행 파일이 실행 중입니다.

이 스크립트는 이에 따라 IP 주소 갱신을 수행합니다

#!/bin/sh 

set -e 

if [ "$IFACE" = lo ]; then 
    exit 0 
fi 

myHostName=T410 

# Remove current line with hostname at the end of line 
sed -i '/'$myHostName'$/ d' /etc/hosts 

# Add new entry to hosts file 
ipaddr=$(ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}') 
echo "$ipaddr $myHostName" >>/etc/hosts