greeningc
Posts: 5
Joined: Sat Feb 08, 2014 4:49 pm
Location: UK

"Unknown Hostname" Error with Ethernet DHCP Connection

Sun Feb 09, 2014 9:28 am

Dear All,
I’m hoping you can help my son and I as we are struggling to get the pi to connect to the Internet.
The issue manifests itself by producing an “unknown hostname” error message when trying to access an Internet site (tried various ones that are generally up and running all the time including http://www.bbc.co.uk)
We are using:
• the Debian setup and all the applications that come with it seem to work fine. This was all presupplied on a 16Gb card (so I haven’t loaded any other apps / files via a different PC)
• a BT Home Hub 5 Router

So to explain what I have done to try and resolve this based on other forum postings:
Changed power supply: I understand that low voltage can be the culprit of many issues. I was using a powered USB so I now have a powered USB plus a phone charger rated at 5v (700mA).
Checked voltage: Using the TP1 (red voltage meter probe) and TP2 (black voltage meter probe) and with the following items plugged in we are getting average 4.95v:
• Ethernet cable – connected directly to router.
• Powered USB extension with mouse and keyboard connected.
• Standard (powered) PC monitor.
• Phone charger (as described above)
• 16Gb memory card.
Checked Internet Connection:
• checked connection on other PCs in the house that the connection is up and that is fine.
• restarted the router
• looked at (!) the pi board and assume (lot of dangerous assuming going on here!) that the LNK flashing green light indicates a live connection?
Checked Network Setting: checked contents of

Code: Select all

/etc/network/interfaces 
with

Code: Select all

cat /etc/network/interfaces 
and identified the following line

Code: Select all

iface eth0 inet dhcp 
indicating that I’m using dhcp.
Checked whether pi has a hostname: with

Code: Select all

hostname
command and get “raspberrypi” as response so assume that is OK.
Checked dhclient.conf file content: in

Code: Select all

/etc/dhcp/dhclient.conf 
and added line

Code: Select all

send host-name “raspberrypi”; 
then forced a refresh with

Code: Select all

sudo ifdown eth0
and

Code: Select all

sudo ifup eth0
One thing I’m not sure about in this bit was that there was a line before the line send host-name “raspberrypi”; which says

Code: Select all

send host-name = gethostname();
I’m assuming that this is doing exactly the same thing as send host-name “raspberrypi”; but dynamically but I have not altered that line (figured I’m having enough trouble without completely wrecking the files as well).
Rebooted system: After each of these changes I’ve completely restarted the pi just to be sure it is picking up the new instructions. I’m assuming that the refreshes (described above) do this but just wanted to be sure.

So I think I’ve reached the end of the road in knowing what to try next. Any guidance on where to go from here greatly received.
Best wishes, Chris & Alex.

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

Re: "Unknown Hostname" Error with Ethernet DHCP Connection

Sun Feb 09, 2014 1:53 pm

gethostname() reads /etc/hostname and uses that.

Post the results from the following commands
ifconfig -a
route -n
ping -c3 192.168.1.1
ping -c3 news.bbc.co.uk
ping -c3 212.58.246.82
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.

greeningc
Posts: 5
Joined: Sat Feb 08, 2014 4:49 pm
Location: UK

Re: "Unknown Hostname" Error with Ethernet DHCP Connection

Sun Feb 09, 2014 3:16 pm

DougieLawson wrote:gethostname() reads /etc/hostname and uses that.

Post the results from the following commands
ifconfig -a
route -n
ping -c3 192.168.1.1
ping -c3 news.bbc.co.uk
ping -c3 212.58.246.82
Hi Dougie - many thanks for response. I have the following responses to the commands:

ifconfig -a produces:
eth0 Link encap: Ethernet HWaddr b8:27 eb: 39:c6:3f
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Rx packets:1 errors:302 dropped:151 overruns:0 frame:151
Tx packets:5 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
lo Link encap: Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
Rx packets:0 errors:0 dropped:0 overruns:0 frame:0
Tx packets:5 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
Rx bytes:0 (0.0 B) txbytes:0 (0.0 B)

route -n produces:
Kernal IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface

Ping -c3 192.168.1.1 produces:
Connect: Network is unreachable

Ping -c3 news.bbc.co.uk produces:
ping: unknown host news.bbc.co.uk

ping -c3 212.58.246.82 produces:
Connect: Network is unreachable

Hope that gives something to work with,
Many thanks,Chris.

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

Re: "Unknown Hostname" Error with Ethernet DHCP Connection

Sun Feb 09, 2014 4:25 pm

Have you got a cat5 cable connected from your BT Hub to your RPi? Are the lights showing green on both ends?

Can you post the output from
sudo cat /etc/network/interfaces
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.

greeningc
Posts: 5
Joined: Sat Feb 08, 2014 4:49 pm
Location: UK

Re: "Unknown Hostname" Error with Ethernet DHCP Connection

Sun Feb 09, 2014 4:53 pm

Hi Dougie,

Yes, cat5e going straight from Rpi to BT HomeHub 5 router. The homehub Ethernet light is solid green. The various lights on the RPi are as follows:
100 light is solid yellow
LNK light is flashing green
FDX light is solid green
PWR light is solid red
ACT light is faint red (?)

sudo cat /etc/network/interfaces produces:

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Many thanks, Chris.

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

Re: "Unknown Hostname" Error with Ethernet DHCP Connection

Sun Feb 09, 2014 5:23 pm

I assume your other machines connecting through that same router are working. It may be worth giving it a "Poughkeepsie reset [1]". Or try disabling wireless on your laptop and wiring it directly to your router to see if that works.

It's a bit of a puzzle why your RPi didn't get a DHCP address handed out to it. Before restarting the router you could try
sudo ifdown eth0
sudo ifdown wlan0
sudo ifup eth0
on the RPi.
But I'm assuming you've rebooted the RPi more than once.









[1] http://www.comlay.net/ibmjarg.pdf‎
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.

greeningc
Posts: 5
Joined: Sat Feb 08, 2014 4:49 pm
Location: UK

Re: "Unknown Hostname" Error with Ethernet DHCP Connection

Sun Feb 09, 2014 5:59 pm

Hi Dougie,

Correct. We have 3 other PCs linked to the router in the house and they all work fine as well as a couple of tablets, phones etc. As you mention I've rebooted the system a number of times but no harm in me giving both those suggestions a try and report back what happens. Thanks again for help.

Best wishes, Chris.

ripat
Posts: 191
Joined: Tue Jul 31, 2012 11:51 am
Location: Belgium

Re: "Unknown Hostname" Error with Ethernet DHCP Connection

Sun Feb 09, 2014 6:26 pm

As DougieLawson said, your RPi doesn't get its ip, routing and DNS info from the router for some reason. The cable seems to be connected to the router (see the RUNNING state in your ifconfig).

What happen if you do

Code: Select all

$ sudo dhclient -v eth0
Poor man's temporary solution with iproute2 (not sure it is installed by default though). Assuming your router's address is 192.168.1.1

Code: Select all

$ sudo ip addr add 192.168.1.99/24 brd + dev eth0
$ sudo ip route add default via 192.168.1.1
$ sudo echo "nameserver 8.8.8.8" > /etc/resolv.conf
You should have access to internet.
Using Linux command line usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

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

Re: "Unknown Hostname" Error with Ethernet DHCP Connection

Mon Feb 10, 2014 12:27 am

Hit the router with a big stick. Turn it off / on.
Try a different cat5 cable between pi and router.
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.

greeningc
Posts: 5
Joined: Sat Feb 08, 2014 4:49 pm
Location: UK

Re: "Unknown Hostname" Error with Ethernet DHCP Connection

Mon Feb 10, 2014 11:50 am

Hi Dougie - yep, you absolutely hit the nail on the head. the cat5 cable was the issue. It was a particulalry long cable as it had to run from my sons bedroom to the router and I gave it a thorough examination last night and found a minute break in the covering. Moved the whole setup to where router is (much to wife's annoyance as in our bedroom) and tried a different cable and it started first time.

Thank you for running through all the possible sources of problem - it has been a really frustrating time and I really want my son to get on with the projects we have discussed. So it is really appreciated.

One final question - I'll have to move all this equipment back to my sons room and figure out how to run a new cable to router so maybe wifi dongle is the way to go. My neighbour has just lent me his 802.11n dongle and I have tried to use the wifi setup in Debian. It recognises our home wifi site and offers the correct SSID and then goes on to offer authentication of "WPA-2 Personal", Encryption "TKIP" and then i can enter the PSK which comes with the BT router. No luck. I dont want to use up any more of your time as you have solved the original problem but can you point me to relevant literature that may guide me through looking for a solution please?

Many thanks again, Chris & Alex (smiling).

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

Re: "Unknown Hostname" Error with Ethernet DHCP Connection

Mon Feb 10, 2014 6:55 pm

Get the output from lsusb then search
"vvvv:pppp site:raspberrypi.org" on Google.

vvvv:pppp is the magic number in the output from lsusb.

Code: Select all

Bus 001 Device 004: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. LAN9500 Ethernet 10/100 Adapter / SMSC9512/9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
You can see my 7392:7811 Edimax on the first line.

If you can't find anything start a new thread.
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”