如何避免在.pac文件的myIpAddress()上使用127.0.0.1

|| 任何想法如何避免myIpAddress()总是返回127.0.0.1,而不是实际的主机IP地址? 环境是带有Firefox 4.0.1的Ubuntu 11.04。 维基百科上从/ etc / hosts文件中删除条目的标准答案没有帮助。     
已邀请:
        最终有效的方法是使用IP地址正确更新/ etc / hosts中的条目。 在Ubuntu中,网络管理器配置网络接口后,将执行“ 0”目录中的可执行文件。 此脚本会相应地更新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
    

要回复问题请先登录注册