已解决!求助/etc/init.d/networking restart究竟做了什么系统重启后resolv.conf被改
发表于 : 2010-01-02 13:41
参照网上其他的处理方法,全部失效!系统顽强修改我的resolv.conf,重启后只有一行了,nameserver 127.0.0.1
要上网只能手动加上nameserver 202.96.128.68才行。我的/etc/network/infaces:
auto lo
iface lo inet loopback
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.0.8
netmask 255.255.255.0
gateway 192.168.0.1
auto tap0
iface tap0 inet manual
up ifconfig $IFACE 0.0.0.0 up
down ifconfig $IFACE down
tunctl_user nhluqun
auto br0
#iface br0 inet dhcp
iface br0 inet static
address 192.168.0.9
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
bridge_ports all tap0
#bridge_ports eth0 tap0
通过家用路由器上网,因为装了virturlbox所以弄了个桥接。
网上关于被改写后的方法:
解法一:修改 /sbin/dhclient-script,注释掉对 resolv.conf 进行操作的地方.
Linux :
把 make_resolv_conf 这个函数的调用都给注释掉!
FreeBSD:
把 > resolv.conf 所在的行都给注释掉!
解法二:强制修改 resolv.conf 的文件flag,设定为不可被更改.
Linux:
chattr +i /etc/resolv.conf
FreeBSD:
chflags schg /etc/resolv.conf
解法三:变更DHCP Client的配置文件,在特定的环节追加我们的设定.
Linux (Ubuntu Dist.):
在 /etc/dhcp3/dhclient.conf 中增加如下设定:prepend domain-name-servers <ip1>, <ip2>;
FreeBSD:
在 /etc/dhclient.conf 中增加如下设定:prepend domain-name-servers <ip1>, <ip2>;
方法一、三在我的ubuntu9.10中失效,方法二:chattr +i /etc/resolv.conf出错:chattr: 操作不支持 while reading flags on /etc/resolv.conf换一种方法,sudo chmod a-w /etc/resolv.conf后,/etc/init.d/networking restart终于不改resolv.conf了,但重启系统仍然顽强的改掉我的resolv.conf,
还试过在/etc/rc.local中echo "nameserver 202.96.128.68">>/etc/resolv.conf同样没效果。现在没办法了,虽然是小问题,但也很烦人的。对shell脚本调试等不熟。看哪位高手看看有没有方法解决这个问题。装过dnsmasq本地dns缓存,现在apt-get remove了,问题还是存在。
要上网只能手动加上nameserver 202.96.128.68才行。我的/etc/network/infaces:
auto lo
iface lo inet loopback
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.0.8
netmask 255.255.255.0
gateway 192.168.0.1
auto tap0
iface tap0 inet manual
up ifconfig $IFACE 0.0.0.0 up
down ifconfig $IFACE down
tunctl_user nhluqun
auto br0
#iface br0 inet dhcp
iface br0 inet static
address 192.168.0.9
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
bridge_ports all tap0
#bridge_ports eth0 tap0
通过家用路由器上网,因为装了virturlbox所以弄了个桥接。
网上关于被改写后的方法:
解法一:修改 /sbin/dhclient-script,注释掉对 resolv.conf 进行操作的地方.
Linux :
把 make_resolv_conf 这个函数的调用都给注释掉!
FreeBSD:
把 > resolv.conf 所在的行都给注释掉!
解法二:强制修改 resolv.conf 的文件flag,设定为不可被更改.
Linux:
chattr +i /etc/resolv.conf
FreeBSD:
chflags schg /etc/resolv.conf
解法三:变更DHCP Client的配置文件,在特定的环节追加我们的设定.
Linux (Ubuntu Dist.):
在 /etc/dhcp3/dhclient.conf 中增加如下设定:prepend domain-name-servers <ip1>, <ip2>;
FreeBSD:
在 /etc/dhclient.conf 中增加如下设定:prepend domain-name-servers <ip1>, <ip2>;
方法一、三在我的ubuntu9.10中失效,方法二:chattr +i /etc/resolv.conf出错:chattr: 操作不支持 while reading flags on /etc/resolv.conf换一种方法,sudo chmod a-w /etc/resolv.conf后,/etc/init.d/networking restart终于不改resolv.conf了,但重启系统仍然顽强的改掉我的resolv.conf,
还试过在/etc/rc.local中echo "nameserver 202.96.128.68">>/etc/resolv.conf同样没效果。现在没办法了,虽然是小问题,但也很烦人的。对shell脚本调试等不熟。看哪位高手看看有没有方法解决这个问题。装过dnsmasq本地dns缓存,现在apt-get remove了,问题还是存在。