User avatar
rPioneer
Posts: 129
Joined: Fri Dec 27, 2013 9:10 pm
Location: Carmarthenshire,Wales

Ethernet doesn't work (after using wifi adapter?)

Mon Nov 24, 2014 9:59 pm

I've used Ethernet before, (though quite a long time ago) to install packages and browse the internet etc, but after using a WiFi adapter for the first time Ethernet stopped working. I was using the adapter with a different router to the home router, somewhere else. When I plugged the Ethernet cable in after using the WiFi adapter, all three Ethernet lights came on (as normal, as far as I can remember) but when I tried to access the internet, Midori said

Code: Select all

Could not resolve hostname
I have fiddled with the /etc/network/interfaces file, with no luck. First I found that "lo" had been set to auto (I presume that is because I used a WiFi adapter) so following a thread on the E14 forum http://www.element14.com/community/thread/22838 I changed interfaces to

Code: Select all

auto eth0
iface eth0 inet dhcp
which didn't appear to do anything.

My interfaces file now reads (after more tinkering and web trawling)

Code: Select all

auto eth0
iface eth0 inet static
        address 192.168.1.34 //34 because i set it to that. No other reason. I tried 68 before, with no luck
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.254
Now my Pi goes very slowly (but doesn't freeze) which I presume is due to the contents of interfaces (though I don't see why) during booting up at two different points:

Code: Select all

configuring network...
and

Code: Select all

starting enhanced syslog: rsyslog
and then also when I type startx, and at any point when a command includes sudo.

I've tried changing the Ethernet cable. No change at all.
Currently,

Code: Select all

ifconfig
gives

Code: Select all

eth0

Link encap:Ethernet   HWaddr b0:27:eb:ef:ao:99
inet addr:192.168.1.34 Bcast: 192.168.1.255 Mask: 255.255.255.0
UP BROADCAST RUNNING MULTICAST  MTU: 1500 Metric: 1
RX packets: 0 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 334 errors: 0 dropped: 0 overruns: 0 carrier: 0
collisions: 0 txqueuelen: 1000
RX bytes: 0 (0.0 B) TX bytes: 10745 (10.3 KiB)
and

Code: Select all

route -n
used to give no info (bare spaces where the IP addresses etc should be) when I had

Code: Select all

auto eth0
iface eth0 inet dhcp
but now gives the static configurations currently in interfaces (as interfaces is shown above)

Any idea what I need to do to stop the pauses and get Ethernet working again?

Cheers.
Toxic yellow HDMIPi, Raspberry Pi B Revision 2 running Raspbian, Raspberry Pi A+ on a robot called Lobsang (anyone read The Long Earth?).
Happy to chat, but don't expect me to be an expert! Eager to learn from peers / gods / gurus / geeks
.

morgad
Posts: 21
Joined: Sun Jan 29, 2012 10:24 pm
Contact: Website

Re: Ethernet doesn't work (after using wifi adapter?)

Mon Nov 24, 2014 10:29 pm

I had to resort to statis networking after an apt-get upgrade
(dhcp and startx currently broken on my machine)

try adding the following to the end of your /etc/interface interface file

dns-nameserver 8.8.8.8
dns-nameserver 8.8.4.4


if your /etc/resolv.conf has
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN


best regards
Dave

User avatar
rPioneer
Posts: 129
Joined: Fri Dec 27, 2013 9:10 pm
Location: Carmarthenshire,Wales

Re: Ethernet doesn't work (after using wifi adapter?)

Mon Nov 24, 2014 10:33 pm

OK, thanks.

So what should my whole interfaces file look like? Do you mean add onto what is existing (all the static configuration)?

And what should your code do? What will it change?
Toxic yellow HDMIPi, Raspberry Pi B Revision 2 running Raspbian, Raspberry Pi A+ on a robot called Lobsang (anyone read The Long Earth?).
Happy to chat, but don't expect me to be an expert! Eager to learn from peers / gods / gurus / geeks
.

User avatar
DougieLawson
Posts: 39124
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Ethernet doesn't work (after using wifi adapter?)

Mon Nov 24, 2014 10:54 pm

Delete the lines "network 192.168.1.0" and "broadcast 192.168.1.255" they aren't needed.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
rPioneer
Posts: 129
Joined: Fri Dec 27, 2013 9:10 pm
Location: Carmarthenshire,Wales

Re: Ethernet doesn't work (after using wifi adapter?)

Mon Nov 24, 2014 11:02 pm

OK, I will try that. I think I already have though... :-D
Toxic yellow HDMIPi, Raspberry Pi B Revision 2 running Raspbian, Raspberry Pi A+ on a robot called Lobsang (anyone read The Long Earth?).
Happy to chat, but don't expect me to be an expert! Eager to learn from peers / gods / gurus / geeks
.

morgad
Posts: 21
Joined: Sun Jan 29, 2012 10:24 pm
Contact: Website

Re: Ethernet doesn't work (after using wifi adapter?)

Tue Nov 25, 2014 7:52 pm

rPioneer wrote:OK, thanks.

So what should my whole interfaces file look like? Do you mean add onto what is existing (all the static configuration)?

And what should your code do? What will it change?
here is my file -
$ cat /etc/network/interfaces

Code: Select all

auto lo
iface lo inet loopback

#auto eth0
#iface eth0 inet dhcp

auto eth0
iface eth0 inet static
address 192.168.1.27
gateway 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
dns-nameserver 8.8.8.8
dns-nameserver 8.8.4.4
Notice that I did not delete the existing (non-working) eth0 lines, I just commented them out.
If I ever get dhcp woriking again I can then switch back to the old lines

This should hopefully fix the "Could not resolve hostname" problem

There are various posts on the forum suggesting that you set dns nameservers in the /etc/resolv.conf file.
However this file gets overwritten occasionally, wheich is why there is a warning at the top of it to not hand-edit that file.

If you set them in /etc/network/interfaces they do not get overwritten

hope this helps :)

Dave

User avatar
DougieLawson
Posts: 39124
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Ethernet doesn't work (after using wifi adapter?)

Tue Nov 25, 2014 8:00 pm

Get rid of the

Code: Select all

network 192.168.1.0
broadcast 192.168.1.255
lines, they aren't needed.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
rPioneer
Posts: 129
Joined: Fri Dec 27, 2013 9:10 pm
Location: Carmarthenshire,Wales

Re: Ethernet doesn't work (after using wifi adapter?)

Tue Nov 25, 2014 9:21 pm

By the way, the LINK led blinks occasionally.

I tried

Code: Select all

sudo apt-get update
with my /etc/network/interfaces file like

Code: Select all

auto eth0
iface eth0 inet dhcp
and it failed to load any links (like mirrordirector.raspbian.org etc) immediately.

But when interfaces looks like this (as it does currently, as you can see Dougie Lawson, I've removed the two lines)

Code: Select all

auto eth0

iface eth0 inet static
address 192.168.1.67
netmask 255.255.255.0
gateway 192.168.1.254
instead I get long pauses, and instead of failing at 0% loading, I believe one link loaded 7%.

It kept saying this:

Code: Select all

Err: <the link that failed, like mirrordirector.raspbian etc>
Something wicked happened resolving <the link that failed> (-5 No address associated with hostname)

Also, the cpu usage does not go up at all after typing 'sudo (command)' when the pi slows down loads. I don't know what it's doing, waiting for something? :?

Does that help?

Also do you know what has happened? It would help me if I knew what has gone wrong. (If you know :))
Toxic yellow HDMIPi, Raspberry Pi B Revision 2 running Raspbian, Raspberry Pi A+ on a robot called Lobsang (anyone read The Long Earth?).
Happy to chat, but don't expect me to be an expert! Eager to learn from peers / gods / gurus / geeks
.

User avatar
rPioneer
Posts: 129
Joined: Fri Dec 27, 2013 9:10 pm
Location: Carmarthenshire,Wales

Re: Ethernet doesn't work (after using wifi adapter?)

Tue Nov 25, 2014 9:55 pm

Code: Select all

ping www.google.com
and

Code: Select all

ping -c3 www.google.com
both return

Code: Select all

ping: unknown host www.google.com
(and I don't know what the -c3 does, I'm just using stuff I'm finding online)
Toxic yellow HDMIPi, Raspberry Pi B Revision 2 running Raspbian, Raspberry Pi A+ on a robot called Lobsang (anyone read The Long Earth?).
Happy to chat, but don't expect me to be an expert! Eager to learn from peers / gods / gurus / geeks
.

User avatar
DougieLawson
Posts: 39124
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Ethernet doesn't work (after using wifi adapter?)

Tue Nov 25, 2014 10:02 pm

Your interfaces file needs to have

Code: Select all

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
without the loopback interface all sorts of strange things won't work.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
rPioneer
Posts: 129
Joined: Fri Dec 27, 2013 9:10 pm
Location: Carmarthenshire,Wales

Re: Ethernet doesn't work (after using wifi adapter?)

Tue Nov 25, 2014 10:11 pm

oh really? great i'll put that in tomorrow. just packed up :roll:
Toxic yellow HDMIPi, Raspberry Pi B Revision 2 running Raspbian, Raspberry Pi A+ on a robot called Lobsang (anyone read The Long Earth?).
Happy to chat, but don't expect me to be an expert! Eager to learn from peers / gods / gurus / geeks
.

User avatar
rPioneer
Posts: 129
Joined: Fri Dec 27, 2013 9:10 pm
Location: Carmarthenshire,Wales

Re: Ethernet doesn't work (after using wifi adapter?)

Tue Nov 25, 2014 10:20 pm

is that as well as the eth0 static stuff, or should I change the dhcp bit of your code to the static stuff?
Toxic yellow HDMIPi, Raspberry Pi B Revision 2 running Raspbian, Raspberry Pi A+ on a robot called Lobsang (anyone read The Long Earth?).
Happy to chat, but don't expect me to be an expert! Eager to learn from peers / gods / gurus / geeks
.

User avatar
DougieLawson
Posts: 39124
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Ethernet doesn't work (after using wifi adapter?)

Tue Nov 25, 2014 10:33 pm

For static you need

Code: Select all

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.1.67
# either
netmask 255.255.255.0
# or using CIDR notation 
#netmask 24
gateway 192.168.1.254
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Return to “Troubleshooting”