dhcp - Can only ping on LAN, not internet

07
2014-07
  • Andrew Capodieci

    I have 2 computers running Ubuntu 12.04 connected to a router on the 192.168.3 subnet. This router is connected to another router via the first router's modem port, so the 192.168.3 router has access to the 192.168.2 subnet. The .2 router is connected to the internet. I will call the 2 computers A and B. Computer A can ping itself, computer B, the .3 and .2 routers, and www.google.com. Computer B can ping itself, computer A, the .3 and .2 routers, but CAN NOT ping www.google.com. I essentially have no internet on computer B.

    ~$ ping www.google.com
    ping: unknown host www.google.com
    

    Output from ifconfig: Computer A

    eth0      Link encap:Ethernet  HWaddr 00:05:b7:dd:87:63  
          inet addr:192.168.3.135  Bcast:192.168.3.255  Mask:255.255.255.0
          inet6 addr: fe80::205:b7ff:fedd:8763/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3940 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2216 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3365434 (3.3 MB)  TX bytes:262362 (262.3 KB)
          Interrupt:20 Memory:f7c00000-f7c20000 
    
    eth1      Link encap:Ethernet  HWaddr 00:05:b7:dd:87:64  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:17 Memory:f7940000-f7960000 
    
    lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:426 errors:0 dropped:0 overruns:0 frame:0
          TX packets:426 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:35063 (35.0 KB)  TX bytes:35063 (35.0 KB)
    

    Output from ifconfig: Computer B

    eth0      Link encap:Ethernet  HWaddr 00:05:b7:dd:87:43  
          inet addr:192.168.3.136  Bcast:192.168.3.255  Mask:255.255.255.0
          inet6 addr: fe80::205:b7ff:fedd:8743/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:737 errors:0 dropped:0 overruns:0 frame:0
          TX packets:551 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:73299 (73.2 KB)  TX bytes:97661 (97.6 KB)
          Interrupt:20 Memory:f7e00000-f7e20000 
    
    eth1      Link encap:Ethernet  HWaddr 00:05:b7:dd:87:44  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:17 Memory:f7d40000-f7d60000 
    
    lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:336 errors:0 dropped:0 overruns:0 frame:0
          TX packets:336 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:20796 (20.7 KB)  TX bytes:20796 (20.7 KB)
    

    Output from route: Computer A

    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    default         192.168.3.1     0.0.0.0         UG    0      0        0 eth0
    link-local      *               255.255.0.0     U     1000   0        0 eth0
    192.168.3.0     *               255.255.255.0   U     1      0        0 eth0
    

    Output from route: Computer B

    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    default         192.168.3.1     0.0.0.0         UG    0      0        0 eth0
    link-local      *               255.255.0.0     U     1000   0        0 eth0
    192.168.3.0     *               255.255.255.0   U     1      0        0 eth0
    

    The only difference I can find is in the resolv.conf file

    Resolv.conf for Computer A

    # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
    #     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
    nameserver 127.0.0.1
    search ampedwireless
    

    ampedwireless is the domain name for the DHCP server on the .2 router.

    Resolv.conf for Computer B

    # Generated by NetworkManager
    nameserver 127.0.0.1
    

    I believe computer B's resolv.conf used to b an exact copy of computer A's EXCEPT for the last line (search ampedwireless), but I tried to apply someone's recommended fix as follows:

    sudo apt-get remove --purge resolvconf
    sudo /etc/init.d/networking restart
    

    and this fix I believe removed the comment, but not my problem. When I try to manually add "search ampedwireless" to computer B's resolv.conf, it gets overwritten.

    I've tried to search google, but unfortunately everything I've seen has a slightly different problem and the fix doesn't help. I think trying to follow that one page's advice has actually set me backwards by removing resolvconf, which I can no longer install because I don't have internet access. Please let me know if any additional information will help. Thanks in advance.

    Edit to add info requested by Mark: nm-tool on Computer A

    ~$ nm-tool
    
    ** (process:3218): WARNING **: Could not initialize NMClient /org/freedesktop/NetworkManager: Rejected send message, 2 matched rules; type="method_call", sender=":1.45" (uid=1000 pid=3218 comm="nm-tool ") interface="org.freedesktop.DBus.Properties" member="GetAll" error name="(unset)" requested_reply="0" destination="org.freedesktop.NetworkManager" (uid=0 pid=912 comm="NetworkManager ")
    
    NetworkManager Tool
    
    State: unknown
    
    
    ** (process:3218): WARNING **: error: could not connect to NetworkManager
    

    nm-tool on Computer B (they look the same to me):

    ~$ nm-tool
    
    ** (process:1965): WARNING **: Could not initialize NMClient /org/freedesktop/NetworkManager: Rejected send message, 2 matched rules; type="method_call", sender=":1.40" (uid=1000 pid=1965 comm="nm-tool ") interface="org.freedesktop.DBus.Properties" member="GetAll" error name="(unset)" requested_reply="0" destination="org.freedesktop.NetworkManager" (uid=0 pid=909 comm="NetworkManager ")
    
    NetworkManager Tool
    
    State: unknown
    
    
    ** (process:1965): WARNING **: error: could not connect to NetworkManager
    

    dig on Computer A:

    ~$ dig @8.8.8.8 google.com
    
    ; <<>> DiG 9.8.1-P1 <<>> @8.8.8.8 google.com
    ; (1 server found)
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 46307
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 11, AUTHORITY: 0, ADDITIONAL: 0
    
    ;; QUESTION SECTION:
    ;google.com.            IN  A
    
    ;; ANSWER SECTION:
    google.com.     299 IN  A   173.194.46.66
    google.com.     299 IN  A   173.194.46.69
    google.com.     299 IN  A   173.194.46.70
    google.com.     299 IN  A   173.194.46.68
    google.com.     299 IN  A   173.194.46.64
    google.com.     299 IN  A   173.194.46.65
    google.com.     299 IN  A   173.194.46.78
    google.com.     299 IN  A   173.194.46.73
    google.com.     299 IN  A   173.194.46.72
    google.com.     299 IN  A   173.194.46.71
    google.com.     299 IN  A   173.194.46.67
    
    ;; Query time: 40 msec
    ;; SERVER: 8.8.8.8#53(8.8.8.8)
    ;; WHEN: Thu May 22 12:00:58 2014
    ;; MSG SIZE  rcvd: 204
    

    dig on Computer B:

    ~$ dig @8.8.8.8 google.com
    
    ; <<>> DiG 9.8.1-P1 <<>> @8.8.8.8 google.com
    ; (1 server found)
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16939
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 11, AUTHORITY: 0, ADDITIONAL: 0
    
    ;; QUESTION SECTION:
    ;google.com.            IN  A
    
    ;; ANSWER SECTION:
    google.com.     41  IN  A   74.125.225.110
    google.com.     41  IN  A   74.125.225.102
    google.com.     41  IN  A   74.125.225.96
    google.com.     41  IN  A   74.125.225.99
    google.com.     41  IN  A   74.125.225.104
    google.com.     41  IN  A   74.125.225.98
    google.com.     41  IN  A   74.125.225.101
    google.com.     41  IN  A   74.125.225.105
    google.com.     41  IN  A   74.125.225.100
    google.com.     41  IN  A   74.125.225.103
    google.com.     41  IN  A   74.125.225.97
    
    ;; Query time: 39 msec
    ;; SERVER: 8.8.8.8#53(8.8.8.8)
    ;; WHEN: Thu May 22 12:00:37 2014
    ;; MSG SIZE  rcvd: 204
    
  • Answers
  • Mark

    What's the output for DNS servers when you run nm-tool from a terminal? That'll display the DNS servers that NetworkManager has configured for the computer. It appears computer A might be configured with your ISP's DNS servers whereas computer B has no DNS servers configured. You might try setting the DNS servers on computer B to something like Google's DNS (8.8.8.8, 8.8.4.4). It's most likely that dnsmasq (a DNS resolver) is running locally to handle your system's DNS, but computer B has no DNS configured. Does running dig @8.8.8.8 google.com work?

    To be honest, I only ever use NetworkManager for my laptops, and just configure network interfaces the "Debian way", with /etc/network/interfaces and editing resolv.conf.

  • Andrew Capodieci

    Well it turned out to be a very simple fix. I had been ssh'ing into these machines, so I decided to walk over to the actual machine. It turns out for some reason it decided to connect using an old network connection that had been configured with a static IP and no DNS. It has been choosing to use the default wire connection 1 for at least 6 months. I'm not sure what caused a change in behavior, but the fix was as simple as switching the network connection to the default Wired connection 1 and deleting the connection that had been configured with a static IP and no DNS.


  • Related Question

    networking - no internet connection on terminal
  • Max Williams

    I'm not sure what it's called but you know right before you login Ubuntu, you can hit CTRL+ALT+F1 and you get a terminal? That's what I'm referring to. The problem is that I'm not sure how to enable the internet connection there.

    Reason why I need internet connection is because today I can't log in and I'm getting some "low graphics mode" problem and just can't login my desktop no matter what. Unfortunately, I was dumb enough to follow an instruction that removed xorg-server and now when I type

    sudo apt-get install xorg-server
    

    I just get because I don't have internet on that terminal. Is there any way to fix this?

    EDIT: I connect through WiFi

    this is the result of sudo ifconfig:

    eth0  Link encap:Ethernet HWaddr 00:26:9e:94:ab:3a
          UP BROADCAST MULTICAST MTU:1500 Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
          Interrupt:27 Base address:0x2000
    
    lo    Link encap:Local Loopback
          inet addr:127.0.0.1 Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING MTU:16436 Metric:1    
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000  
          RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
    
    wlan0 Link encap:Ethernet HWaddr c4:17:fe:3e:be:ca
          UP BROADCAST MULTICAST MTU:1500 Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
    

    Sorry it took so long, I typed it by hand.


  • Related Answers
  • rumtscho

    This is the answer how to connect to the Internet using WIFi from a terminal.

    First, edit (or create) the file /etc/wpa_supplicant/wpa_supplicant.conf. Use this content;

     
    eapol_version=1
    ap_scan=1
    network={
            ssid="networkname"
            psk="networkpassword"
    }
    

    then use sudo wpa_supplicant -i wlan0 -D wext -c /etc/wpa_supplicant/wpa_supplicant.conf -d Now run iwconfig, if there isn't "unassociated" behind wlan0, you've got Internet.

    Depending on the configuration of your router, you may need to put some more info into the config file. The man page for wpa_supplicant.conf will tell you which options are possible, you're only interested in the ones in the Network subsection. It could then look like that:

    network={
            ssid="networkname"
            scan_ssid=1
            proto=RSN
            key_mgmt=WPA-PSK
            pairwise=CCMP
            group=TKIP
            psk="networkpassword"
    }
    

    The network name and network password are the ones you always use. If you didn't change the factory settings, they're written somewhere on your router. For the rest of the options, you can either deduce which values to use from the wpa_supplicant.conf man page and the router's current settings and its user manual, or just try out some of the possible combinations, I think they're listed in the man.

    I am afraid that the whole process is very skittish and if it doesn't work outright, you could spend a lot of time trying things out before you get a result (if you get it at all). The line I gave you for running wpa_supplicant starts a debug mode, so you can at least tell where something goes wrong, but it won't spell out the reason for you :(

  • rumtscho

    Yes there are ways to connect from command line, but before we list them, you should tell us how you connect to the Internet, because they are different for every channel.

    But before you go through all the motions, you could add the Ubuntu CD to your sources by editing the file

    /etc/apt/sources.list

    and if needed, make it the preferred source in the apt config file or just comment out the Internet repositories in the sources list. Then pop the CD and run apt-get install again. As I believe that there wasn't a new kernel upgrade since 10.4 came out, your chances are reasonably good that installing from the CD should still function. Then, if you get the low graphics mode again, replace your xorg.conf with a version known to work (you can get some examples on the internet, or if you have the nvidia-current drivers, you can run nvidia-xconfig while X doesn't run to reset the graphics configuration). After that, everything should be alright.