Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
Hello, all, I've been working on setting up Arch on my laptop recently, and I can get connected to my network using netcfg profiles without too much issue, and net-auto-wireless ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2012
    Posts
    8

    Unable to resolve hostnames.


    Hello, all,
    I've been working on setting up Arch on my laptop recently, and I can get connected to my network using netcfg profiles without too much issue, and net-auto-wireless usually works, however, once connected:
    I can ping just fine, and pacman (and even the rankmirrors script) work without hassel, however, when using curl, wget, or any other tool other than those, hostnames are not resolved. If I do something like
    Code:
    curl [GOOGLE*]
    I get a
    Code:
    curl: (6) Could not resolve host: [GOOGLE*]: No address associated with hostname
    However, if I do
    Code:
    ping [GOOGLE*]
    PING [GOOGLE*] (173.194.73.99) 56(84) bytes of data.
    and then take the ip address ping pings and do
    Code:
    curl 173.194.73.105
    things work just fine. The same holds true for wget and other things that connect to the internet.
    I am unsure of why ping and pacman would work fine, but other programs like curl and wget would fail to resolve hostnames, and any help would be greatly appreciated.
    Thanks.

    *Since I'm a newbie here, I can't post urls; I'm just using [GOOGLE] as a substitute for Google's address.

  2. #2
    Just Joined!
    Join Date
    May 2012
    Location
    Novosibirsk
    Posts
    9
    may be you need to write google.com?
    and why have you used [] simbols?

  3. #3
    Just Joined!
    Join Date
    Apr 2012
    Posts
    8
    Quote Originally Posted by Sheh View Post
    may be you need to write google.com?
    and why have you used [] simbols?
    In my actual input, I did write "www (dot) google (dot) com", however, since I do not have many posts on these fora, I'm not allowed to write urls, so I just wrote [GOOGLE] instead.

  4. #4
    Just Joined!
    Join Date
    May 2012
    Location
    Novosibirsk
    Posts
    9
    Please, show me an output of commands:
    Code:
    hostname
    nslookup ya.ru
    cat /etc/hosts
    cat /etc/resolv.conf
    cat /etc/rc.conf
    cat /etc/nsswitch.conf
    And answer on 2 questions:
    1. Are you using the DHCP server?
    2. Did you configure network settings over GUI?
    Last edited by Sheh; 05-03-2012 at 03:20 PM.

  5. #5
    Just Joined!
    Join Date
    Apr 2012
    Posts
    8
    Quote Originally Posted by Sheh View Post
    Please, show me an output of commands:
    Code:
    hostname
    nslookup ya.ru
    cat /etc/hosts
    cat /etc/resolv.conf
    cat /etc/rc.conf
    cat /etc/nsswitch.conf
    And answer on 2 questions:
    1. Are you using the DHCP server?
    2. Did you configure network settings over GUI?
    The output to those commands:
    Code:
    $ hostname
    -bash: hostname: command not found
    $ nslookup
    -bash: nslookup: command not found
    And the files:
    /etc/hosts:
    Code:
    #
    # /etc/hosts: static lookup table for host names
    #
    
    #<ip-address>	<hostname.domain.org>	<hostname>
    127.0.0.1	localhost.localdomain	localhost caffeine
    ::1		localhost.localdomain	localhost
    
    # End of file
    /etc/resolv.conf:
    Code:
    # Generated by dhcpcd from wlan0
    # /etc/resolv.conf.head can replace this line
    nameserver 192.168.1.254
    # /etc/resolv.conf.tail can replace this line
    /etc/nsswitch.conf:
    Code:
    # Begin /etc/nsswitch.conf
    
    passwd: files
    group: files
    shadow: files
    
    publickey: files
    
    hosts: files dns
    networks: files
    
    protocols: files
    services: files
    ethers: files
    rpc: files
    
    netgroup: files
    
    # End /etc/nsswitch.conf
    And for rc.conf, which is a huge file, I've only pasted that from the networking section and daemons--if other information is needed, please let me know.
    Code:
    #
    # /etc/rc.conf - Main Configuration for Arch Linux
    #
    
    HOSTNAME="caffeine"
    
    interface=
    address=
    netmask=
    broadcast=
    gateway=
    
    NETWORK_PERSIST="no"
    
    NETWORKS=(sylphid)
    WIRELESS_INTERFACE="wlan0"
    
    DAEMONS=(hwclock syslog-ng net-auto-wireless netfs crond)
    And to answer your questions:
    1. I am using DHCP
    2. I didn't use a GUI, and in fact haven't even installed one yet (I've been hoping to get networking and a couple other things set up and working nicely before I decide to get a GUI set up, and I'm proficient enough at the command line that this hasn't been a bother as of yet).

  6. #6
    Just Joined!
    Join Date
    May 2012
    Location
    Novosibirsk
    Posts
    9
    1. For diagnostic problem you should to install nslookup
    Code:
    sudo pacman -S dnsutils
    sudo pacman -S net-tools #or inetutils
    2. Check permissions of config files.
    Code:
    ls -la /etc/hosts
    ls -la /etc/resolv.conf
    ls -la /etc/rc.conf
    3. Try to use google DNS 8.8.8.8 and 8.8.4.4
    4. Try to disable recieving setting by dhcp and configure network settings manually. I'm sure that your problem is in using dhcp server.

  7. #7
    Just Joined!
    Join Date
    Apr 2012
    Posts
    8
    Quote Originally Posted by Sheh View Post
    1. For diagnostic problem you should to install nslookup
    Code:
    sudo pacman -S dnsutils
    sudo pacman -S net-tools #or inetutils
    2. Check permissions of config files.
    Code:
    ls -la /etc/hosts
    ls -la /etc/resolv.conf
    ls -la /etc/rc.conf
    3. Try to use google DNS 8.8.8.8 and 8.8.4.4
    4. Try to disable recieving setting by dhcp and configure network settings manually. I'm sure that your problem is in using dhcp server.
    Do you think you could elaborate a bit about what those three downloads do? I only like to download things if I'm absolutely sure they're necessary, and I like to know exactly which each thing downloaded does, if that wouldn't be too hard for you to explain.

  8. #8
    Linux Guru Jonathan183's Avatar
    Join Date
    Oct 2007
    Posts
    3,043
    suggest you look on the Arch website for the particular package you are interested in example dnsutils here ... select the architecture and you will have links to package file list, upstream url, dependencies etc

  9. #9
    Just Joined!
    Join Date
    Apr 2012
    Posts
    8
    Alright, I apologize for the long delay, but here's some information:
    In /etc/resolv.conf, besides comments to the effect that it was autogenerated by dhcpcd, there is only the line
    Code:
    nameserver 192.168.1.254
    I tested that with host like so:
    Code:
    $ host [GOOGLE] 192.168.1.254
    Using domain server:
    Name: 192.168.1.254
    Address: 192.168.1.254#53
    Aliases: 
    
    [GOOGLE] is an alias for [LGOOGLE].
    [LGOOGLE] has address 173.194.75.147
    [LGOOGLE] has address 173.194.75.99
    [LGOOGLE] has address 173.194.75.103
    [LGOOGLE] has address 173.194.75.104
    [LGOOGLE] has address 173.194.75.105
    [LGOOGLE] has address 173.194.75.106
    I then appended
    Code:
    nameserver 8.8.8.8
    nameserver 8.8.4.4
    to /etc/resolv.conf. Immediately retrying curl and ping yielded no new results, and testing the two ips with host showed that they too were able to resolve correctly a hostname. I rebooted my computer, and dhcpcd's autogeneration of resolv.conf removed them.
    Permissions on hosts, resolv.conf, and rc.conf seemed to be adequate, however, in case I am misinterpretting them, here is the output of ls -la:
    Code:
    -rw-r--r-- 1 root root  204 Apr 16 17:16 /etc/hosts
    -rw-r--r-- 1 root root 3864 Apr 16 17:53 /etc/rc.conf
    -rw-r--r-- 1 root root  150 May 26 20:04 /etc/resolv.conf
    I will test out a connection without dhcp now, and reply or edit with my results later.

    And, as before, using substitutes for urls:
    [GOOGLE] is www (dot) google (dot) com
    [LGOOGLE] is www (dot) l (dot) google (dot) com

  10. #10
    Just Joined!
    Join Date
    Apr 2012
    Posts
    8
    Sorry for the double post, but it appears to be too late to edit. I've some more information that'll probably be useful.

    First, I'm using netcfg to do network things (and net-auto-wireless as well, but that seems to be netcfg-based; correct me if I'm wrong, but all it does is try to load netcfg profiles alphabetically? I feel like that's wrong, though, and only tangental to the problem I have at hand). Anyway, the two profiles I'm using are one for dhcp, which is what I've been using since I got my laptop up and running in the first place, and one for a static ip, which I've set up for debugging purposes at the moment. Here they are:
    dhcp: (the file is called 'sylphid')
    Code:
    CONNECTION='wireless'
    DESCRIPTION='A simple opened wireless connection'
    INTERFACE='wlan0'
    SECURITY='none'
    ESSID='adirindack8'
    IP='dhcp'
    # Uncomment this if your ssid is hidden
    #HIDDEN=yes
    static: (the file is called cirrus)
    Code:
    CONNECTION='wireless'
    INTERFACE='wlan0'
    SECURITY='none'
    ESSID='adirindack8'
    IP='static' # Any other CONNECTION='ethernet' options may be used.
    ADDR='192.168.0.21'
    GATEWAY='192.168.0.1'
    DNS=('192.168.0.1')
    # Uncomment this if your ssid is hidden
    #HIDDEN=yes
    With sylphid, things work as I've described; ping and pacman present no problem, everything else fails to resolve hostnames, but work fine otherwise. With cirrus, however, everything works--but for some reason hostname resolution is extremely slow. I did some pinging to get specific numbers, and here is the data I got:
    sylphid, pinging google's ip:
    Code:
    PING 74.125.131.103 (74.125.131.103) 56(84) bytes of data.
    
    --- 74.125.131.103 ping statistics ---
    999 packets transmitted, 992 received, 0% packet loss, time 999019ms
    rtt min/avg/max/mdev = 36.770/302.643/1377.490/191.808 ms, pipe 2
    sylphid, pinging google's url:
    Code:
    PING [google dot com] (173.194.73.105) 56(84) bytes of data.
    
    --- [google dot com] ping statistics ---
    999 packets transmitted, 995 received, 0% packet loss, time 1022349ms
    rtt min/avg/max/mdev = 35.862/74.497/1535.724/160.421 ms, pipe 2
    cirrus, pinging google's ip:
    Code:
    PING 74.125.131.103 (74.125.131.103) 56(84) bytes of data.
    
    --- 74.125.131.103 ping statistics ---
    999 packets transmitted, 983 received, 1% packet loss, time 999083ms
    rtt min/avg/max/mdev = 36.298/292.905/1496.973/206.075 ms, pipe 2
    cirrus, pinging google's url:
    Code:
    PING [google dot com] (173.194.75.103) 56(84) bytes of data.
    
    --- [google dot com] ping statistics ---
    752 packets transmitted, 731 received, 2% packet loss, time 7534235ms
    rtt min/avg/max/mdev = 37.598/389.110/8687.926/834.500 ms, pipe 9
    So, the first three tests, sylphid ip and url, and cirrus ip, took about 17 minutes to completely--fairly reasonable. But the last one, cirrus url, took over two hours, and that wasn't even all 999 (I had to close things down at that point because it was getting late).
    So does anyone have any ideas as to why it would be so slow, and why host resolution works in static ip, but not dhcp, and how I could fix these?
    And thank you all again for the help so far in getting me here.

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •