[Hot News] [SOLVED]: Raspberry Pi eth0 and wlan0 shows unknown host, unable to connect to the network

[Hot News] [SOLVED]: Raspberry Pi eth0 and wlan0 shows unknown host, unable to connect to the network
Di Posting Oleh : Crew Blog
Kategori : FAQ Q&A RASPBERRY PI Solved TECHNOLOGY TUTORIALS WiFi


If you are trying to hook up your Raspberry Pi to your home WiFi network or to your wired connection through ethernet cable, many a times you might encounter some peculiar issues while trying to get your Raspberry Pi connected to the internet or local home network.

You might encounter error that goes along the lines of:

"Unknown host" and "Can't resolve the host".

If this is the same error you also encounter when trying to hook up your Raspberry Pi to the internet, then perform the following steps to overcome this issue:

To connect to the ethernet network, first you ensure you have a file called resolv.conf created under /etc directory of your Raspberry Pi.

If this file currently does not exist, just issue the following command:

sudo sh -c 'echo "nameserver 8.8.8.8" >> /etc/resolv.conf '

After this, connect your ethernet cable and verify that you are now able to connect to the internet or the local area network from your Raspberry Pi and ping any other devices on the network successfully.

Once this is done, you will also be able to connect your Raspberry Pi to your WiFi network by entering these lines into your /etc/network/interfaces file:

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


After this, add the following lines to your wpa_supplicant.conf file:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
        ssid="your_WiFi_SSID_goes_here"
        scan_ssid=1
        psk="your_WiFi_password_goes_here"
}


Now, if you try connecting your Raspberry Pi to the WiFi network, you should be able to connect to it successfully.