
私のPCにDebian Wheezy 64ビットがインストールされています。問題は、場合によってはpingだけが可能localhost
で、127.0.0.1
外部の世界にアクセスできないことです。それ以外の場合は、他のどこでもpingを実行できますlocalhost
。
これは/etc/hosts
==========================================
127.0.0.1 localhost
127.0.0.1 my-pc
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
==========================================
これは/etc/network/interfaces
==========================================
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 192.168.5.65
netmask 255.255.255.0
network 192.168.5.0
broadcast 192.168.5.255
gateway 192.168.5.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 192.168.5.1 8.8.8.8 4.4.4.4
#iface eth0 inet static
# address 192.168.5.65
# netmask 255.255.255.0
# gateway 192.168.5.1
#auto eth0
#allow-hotplug eth0
#iface eth0 inet dhcp
==========================================
これは/run/network/ifstate
==========================================
lo=lo
eth0=eth0
==========================================
再起動後ping localhost
は失敗してping [rest of the world]
動作します。ただし、ネットワークサービスを再起動した後にのみ適用されますping localhost
。
答え1
解決策
/etc/nsswitch.conf ファイルが存在し、次の行を含める必要があります。
hosts: dns files
私の知る限り解決されました。理由はわかりませんが、中が空です!