我想将所有网络文件重置为默认值。这些文件包括 /etc/hosts、/etc/network/interfaces、/etc/resolv.conf 等。如何在不重新安装的情况下做到这一点?
/etc/hosts
127.0.0.1 localhost
::1 localhost
/etc/resolv.conf
nameserver 192.168.1.1
/etc/网络/接口
##Local Loopback
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.24
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
答案1
/etc/hosts
应该保持原样。- 删除
/etc/resolv.conf
,使其成为符号链接/run/resolvconf/resolv.conf
并运行resolvconf -u
。 eth0
删除来自的条目/etc/network/interfaces
。
看起来您不需要担心任何 iptables 规则。