I have a wired ADSL connection with a modem-cum-router. I generally connect to the internet using PPPoE i.e. the router itself establishes the connection with my ISP as soon as I switch it on. And the router being connected to my PC using ethernet cable provides the internet to it without any further configuration in Ubuntu.
However, yesterday I was facing some issues with the router so I switched it to the DSL (Bridging) mode. This setup requires me to use sudo pppoeconf
to let Ubuntu know my ISP username and password so that it can make the connection with ISP. The internet was fine during the session after making the changes.
But, after a reboot, Ubuntu can't access the internet anymore. So, I once again switched my router to PPPoE mode and the internet works fine on my dual-boot Windows 7 but not on Ubuntu. Even after making this change (i.e. reverting to the situation which was working all along) I am not able to access the internet using Ubuntu. However, I can see that I have been allotted the IPv4 address by my ISP.
Following are some of the troubleshooting steps (while in PPPoE mode), that I took:
$ ifconfig
eth0 Link encap:Ethernet HWaddr 94:de:80:34:47:7b
inet6 addr: fe80::96de:80ff:fe34:477b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1 errors:0 dropped:0 overruns:0 frame:0
TX packets:33 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:78 (78.0 B) TX bytes:4642 (4.6 KB)
Interrupt:18
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:107 errors:0 dropped:0 overruns:0 frame:0
TX packets:107 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:7923 (7.9 KB) TX bytes:7923 (7.9 KB)
$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
$ ping -c 1 www.google.com
ping: unknown host www.google.com
Then, I tried to once again run sudo pppoeconf
, which gave me the following output (I have tried this in both PPPoE as well as Bridging modes):
Seeing that the output of route
was nothing, I ran:
$ sudo route add -net 192.168.1.0 netmask 255.255.255.0 dev eth0
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
But this didn't help much.
$ ping -c 1 www.google.com
ping: unknown host www.google.com
$ ping -c 1 8.8.8.8
connect: Network is unreachable
$ dig @8.8.8.8
; <<>> DiG 9.9.5-3-Ubuntu <<>> @8.8.8.8
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached
The nameservers seem to be fine to me:
$ cat /etc/resolv.conf
# 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 8.8.8.8
nameserver 8.8.4.4
$ cat /etc/resolvconf/resolv.conf.d/head
# 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 8.8.8.8
nameserver 8.8.4.4
I tried to access my modem configuration page on 192.168.1.1
, but I wasn't able to connect to it. I had to change the modem's gateway using the following to be able to access it (earlier when everything was working fine, I didn't need to make any change to be able to access this page):
sudo ifconfig eth0 192.168.1.10 netmask 255.255.255.0 up
Running the diagnostic tests on my modem on both Ubuntu and Windows gives this output:
Everything is working as it should on my Windows 7 dual-boot system, but not on Ubuntu GNOME 14.04 anymore.
I have tried running Ubuntu using Live USB, and internet works fine on it as well.
Why am I not able to access the internet even though IPv4 address has been allotted by ISP? What do I need to do to be able to access the internet on Ubuntu?
My /etc/networking/interfaces
:
#############################################################################
#############################################################################
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto dsl-provider
iface dsl-provider inet ppp
pre-up /sbin/ifconfig eth0 up # line maintained by pppoeconf
provider dsl-provider
auto eth0
iface eth0 inet manual
Following is the dmesg
output while unplugging and re-plugging the ethernet cable:
$ dmesg | tail -2
[ 187.051150] alx 0000:02:00.0 eth0: Link Down
[ 214.085755] alx 0000:02:00.0 eth0: NIC Up: 100 Mbps Full
I have edited my /etc/network/interfaces
as follows:
$ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
#auto dsl-provider
#iface dsl-provider inet ppp
#pre-up /sbin/ifconfig eth0 up # line maintained by pppoeconf
#provider dsl-provider
#auto eth0
#iface eth0 inet manual
auto eth0
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0
gateway 192.168.1.1
If I run sudo dhclient -d -v -nw eth0
on every reboot, it works sometimes and doesn't at other times. It's very random. Following is the ouput when it works:
$ sudo dhclient -d -v -nw eth0
Internet Systems Consortium DHCP Client 4.2.4
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/eth0/94:de:80:34:47:7b
Sending on LPF/eth0/94:de:80:34:47:7b
Sending on Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3 (xid=0x51e3cec7)
DHCPREQUEST of 192.168.1.8 on eth0 to 255.255.255.255 port 67 (xid=0x51e3cec7)
DHCPOFFER of 192.168.1.8 from 192.168.1.1
DHCPACK of 192.168.1.8 from 192.168.1.1
bound to 192.168.1.8 -- renewal in 18451 seconds.
^C
Following is when it doesn't work:
$ sudo dhclient -d -v -nw eth0
Internet Systems Consortium DHCP Client 4.2.4
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/eth0/94:de:80:34:47:7b
Sending on LPF/eth0/94:de:80:34:47:7b
Sending on Socket/fallback
DHCPREQUEST of 192.168.1.8 on eth0 to 255.255.255.255 port 67 (xid=0x67dfb451)
DHCPACK of 192.168.1.8 from 192.168.1.1
bound to 192.168.1.8 -- renewal in 20076 seconds.
^C
$ sudo cat /var/log/daemon.log | grep Network
cat: /var/log/daemon.log: No such file or directory
I cannot even access 192.168.1.1
when this command doesn't work.
Best Answer
The most likely problem is that your router isn't serving the DHCP leases, or that Network Manager isn't taking them. Using
sudo dhclient -d -v -nw eth0
should allow you to know who's the culprit. If it works, then Network Manager configuration is messed up and you need to repair it. If it doesn't then you need to review your router configuration, in which case the router manual is necessary.One way to fix network manager, just open the configuration interface in "Network Settings", select the desired network (lets say Wired), look for the cog button, and fix the configuration selecting "automatic".
There's also a select option, where you can select "Reset" (do NOT use "Forget) and it will restore the defaults.
Of course, network manager won't configure your devices if you have them configured in your
/etc/networking/interfaces
. Just delete/comment out those lines, then try again.These options assumes you are using a GNOME-like environment, other environment can have similar options.