Proxy 如何避免.pac文件中myIpAddress()的127.0.0.1
知道如何避免myIpAddress()总是返回127.0.0.1而不是实际的主机IP地址吗 环境是Ubuntu 11.04和Firefox 4.0.1Proxy 如何避免.pac文件中myIpAddress()的127.0.0.1,proxy,ubuntu-11.04,pac,Proxy,Ubuntu 11.04,Pac,知道如何避免myIpAddress()总是返回127.0.0.1而不是实际的主机IP地址吗 环境是Ubuntu 11.04和Firefox 4.0.1 从/etc/hosts文件中删除条目的标准答案没有任何帮助。最终起作用的是使用IP地址正确更新/etc/hosts中的条目 在Ubuntu中,网络管理器配置网络接口后,将执行/etc/network/if up.d目录中的可执行文件 此脚本会相应地更新ip地址: #!/bin/sh set -e if [ "$IFACE" = lo ]; t
从/etc/hosts文件中删除条目的标准答案没有任何帮助。最终起作用的是使用IP地址正确更新/etc/hosts中的条目 在Ubuntu中,网络管理器配置网络接口后,将执行
/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
最终起作用的是使用IP地址正确更新/etc/hosts中的条目 在Ubuntu中,网络管理器配置网络接口后,将执行
/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