Skip to content

Instantly share code, notes, and snippets.

@johnp789
Created October 12, 2013 01:39
Show Gist options
  • Save johnp789/6944629 to your computer and use it in GitHub Desktop.
Save johnp789/6944629 to your computer and use it in GitHub Desktop.
Arch Linux network problem: can ping by IP, but not by hostname
[root@storm ~]# ping www.google.com # This is the problem
ping: unknown host www.google.com
[root@storm ~]# ping -c3 8.8.8.8 # I can ping by IP, though
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=43 time=32.5 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=43 time=34.9 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=43 time=33.9 ms
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 32.534/33.824/34.985/1.027 ms
[root@storm ~]# ping -c3 8.8.4.4
PING 8.8.4.4 (8.8.4.4) 56(84) bytes of data.
64 bytes from 8.8.4.4: icmp_seq=1 ttl=43 time=26.4 ms
64 bytes from 8.8.4.4: icmp_seq=2 ttl=43 time=25.2 ms
64 bytes from 8.8.4.4: icmp_seq=3 ttl=43 time=25.8 ms
--- 8.8.4.4 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 25.228/25.864/26.487/0.530 ms
[root@storm ~]# cat /etc/resolv.conf # using Google's DNS servers
# Generated by dhcpcd from enp7s0
# /etc/resolv.conf.head can replace this line
domain localdomain
nameserver 8.8.8.8
nameserver 8.8.4.4
# /etc/resolv.conf.tail can replace this line
[root@storm ~]# cat /etc/nsswitch.conf
# Begin /etc/nsswitch.conf
passwd: files
group: files
shadow: files
publickey: files
hosts: files dns myhostname
networks: files
protocols: files
services: files
ethers: files
rpc: files
netgroup: files
# End /etc/nsswitch.conf
[root@storm ~]# systemctl status netcfg.service
netcfg.service - Netcfg multi-profile daemon
Loaded: loaded (/usr/lib/systemd/system/netcfg.service; disabled)
Active: active (exited) since Sat 2013-10-12 01:12:08 UTC; 3min 47s ago
Process: 978 ExecStop=/usr/bin/netcfg-daemon stop (code=exited, status=0/SUCCESS)
Process: 1019 ExecStart=/usr/bin/netcfg-daemon start (code=exited, status=0/SUCCESS)
Main PID: 1019 (code=exited, status=0/SUCCESS)
Oct 12 01:12:02 storm.localdomain dhcpcd[1101]: version 6.0.5 starting
Oct 12 01:12:02 storm.localdomain dhcpcd[1101]: enp7s0: soliciting an IPv6 router
Oct 12 01:12:02 storm.localdomain dhcpcd[1101]: enp7s0: ipv6rs_sendprobe: sendmsg: Cannot assign requested address
Oct 12 01:12:02 storm.localdomain dhcpcd[1101]: enp7s0: soliciting a DHCP lease
Oct 12 01:12:02 storm.localdomain dhcpcd[1101]: enp7s0: offered 192.168.1.101 from 192.168.1.1
Oct 12 01:12:08 storm.localdomain dhcpcd[1101]: enp7s0: leased 192.168.1.101 for 172800 seconds
Oct 12 01:12:08 storm.localdomain dhcpcd[1101]: enp7s0: adding host route to 192.168.1.101 via 127.0.0.1
Oct 12 01:12:08 storm.localdomain dhcpcd[1101]: enp7s0: adding route to 192.168.1.0/24
Oct 12 01:12:08 storm.localdomain dhcpcd[1101]: enp7s0: adding default route via 192.168.1.1
Oct 12 01:12:08 storm.localdomain netcfg-daemon[1019]: :: ethernet-dhcp up [done]
Oct 12 01:12:08 storm.localdomain systemd[1]: Started Netcfg multi-profile daemon.
[root@storm ~]# lspci | grep r8168
[root@storm ~]# lspci | grep Ethernet
07:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168 PCI Express Gigabit Ethernet controller (rev 06)
[root@storm ~]# lsmod | grep 8169
r8169 58391 0
mii 4027 1 r8169
Script started on Sat Oct 12 01:26:04 2013
[root@storm ~]# cat /etc/hosts
#
# /etc/hosts: static lookup table for host names
#
#<ip-address> <hostname.domain.org> <hostname>
127.0.0.1 localhost.localdomain localhost
::1 localhost.localdomain localhost
192.168.1.1 vree.localdomain vree
# End of file
[root@storm ~]# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.259 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.261 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.204 ms
^C
--- 192.168.1.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.204/0.241/0.261/0.029 ms
[root@storm ~]# ping vree
ping: unknown host vree
[root@storm ~]# ping vree.localdomain
ping: unknown host vree.localdomain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment