0

I just started using raspberry pi.I am trying to sharing wifi internet connection with Raspberry Pi 2 - MODB through LAN (Headless mode)

What I have done so far?

  1. Flashed SD card with 2015-05-05-raspbian-wheezy image

  2. Enable “Allow other network users to connect through this computer‘s Internet connection” option for Wireless Network Connection Properties.

  3. Append ip=Fixed IP:: Lan IP in cmdline.txt file

  4. Open SSH with Fixed IP on PUTTY.

Issue:

Now through SSH, I am able to ping 8.8.8.8 IP which means I got internet access to my raspberry module. But not able to ping DNS - http://google.com, getting error unknown host. And also not able to perform and updates, getting error Failed to fetch http://___

Getting confused whether raspberry board got internet access or not. And if yes, then why not able to access DNS and updates.

Outputs:

  1. Command prompt

C:\Users\Harish>ipconfig

Windows IP Configuration

Wireless LAN adapter Wireless Network Connection:

Connection-specific DNS Suffix  . :

   Link-local IPv6 Address . . . . . : fe80::51c4:e1df:75:72f8%14


   IPv4 Address. . . . . . . . . . . : 192.168.0.111

   Subnet Mask . . . . . . . . . . . : 255.255.255.0

   Default Gateway . . . . . . . . . : 192.168.0.1
Ethernet adapter Local Area Connection:

   Connection-specific DNS Suffix  . :

   Link-local IPv6 Address . . . . . : fe80::1939:628b:ec79:f8a9%13

   IPv4 Address. . . . . . . . . . . : 192.168.137.1

   Subnet Mask . . . . . . . . . . . : 255.255.255.0

   Default Gateway . . . . . . . . . :

C:\Users\Harish>arp -a

Interface: 192.168.137.1 --- 0xd

  Internet Address      Physical Address      Type

  192.168.137.4         b8-27-eb-1f-05-15     dynamic

  192.168.137.255       ff-ff-ff-ff-ff-ff     static

  224.0.0.2             01-00-5e-00-00-02     static

  224.0.0.22            01-00-5e-00-00-16     static

  224.0.0.252           01-00-5e-00-00-fc     static

  239.255.255.250       01-00-5e-7f-ff-fa     static

  255.255.255.255       ff-ff-ff-ff-ff-ff     static

Interface: 192.168.0.111 --- 0xe

  Internet Address      Physical Address      Type

  192.168.0.1           14-cc-20-f5-cb-ba     dynamic

  192.168.0.103         08-ed-b9-d1-c3-f5     dynamic

  192.168.0.107         48-d2-24-c4-0f-f0     dynamic

  192.168.0.110         8c-a9-82-5d-8b-ac     dynamic

  192.168.0.255         ff-ff-ff-ff-ff-ff     static

  224.0.0.2             01-00-5e-00-00-02     static

  224.0.0.22            01-00-5e-00-00-16     static

  224.0.0.252           01-00-5e-00-00-fc     static

  239.255.255.250       01-00-5e-7f-ff-fa     static

  255.255.255.255       ff-ff-ff-ff-ff-ff     static

Also able to ping LAN and FIXED ip through command prompt.

2. SSH output

pi@raspberrypi ~ $ sudo cat /etc/network/interfaces

auto io

inface lo inet loopback


auto eth0

allow-hotplug etho

inface eth0 inet manual


auto wlan)

allow-hotplug wloan0

inface wlan0 inet manual

wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf


auto wlan1

allow-hotplug wlan1

inface wlan1 inet manual

wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

pi@raspberrypi ~ $ ifconfig

eth0 Link encap:Ethernet HWaddr b8:27:eb:a8:cf:a4

inet addr:192.168.137.4 Bcast:192.168.137.255 Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:795 errors:0 dropped:0 overruns:0 frame:0

TX packets:814 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:61996 (60.5 KiB) TX bytes:114753 (112.0 KiB)


lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

UP LOOPBACK RUNNING MTU:65536 Metric:1

RX packets:308 errors:0 dropped:0 overruns:0 frame:0

TX packets:308 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:24856 (24.2 KiB) TX bytes:24856 (24.2 KiB)

root@raspberrypi:/home/pi# route –n

Kernel IP routing table

Destination         Gateway            Genmask         Flags  Metric Ref    Use 
Iface

0.0.0.0             192.168.137.1   0.0.0.0              UG    0      0        0 eth0

192.168.137.0       0.0.0.0               255.255.255.0   U      0      0        0 eth0

I also tried after modifying interface file, but still not able to ping DNS.

pi@raspberrypi ~ $ sudo cat /etc/network/interfaces

auto io

inface lo inet loopback


auto eth0

allow-hotplug etho

inface eth0 inet dhcp

address 192.168.137.4

netmask 255.255.255.0

network 192.168.137.0

broadcast 192.168.137.255

gateway 192.168.137.1


auto wlan)

allow-hotplug wloan0

inface wlan0 inet manual

wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf


auto wlan1

allow-hotplug wlan1

inface wlan1 inet manual

wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
  • 2
    It is unclear from your question what the physical connections are. You also need to tell us what Raspbian you are using - unfortunately the latest changed how internet works. /etc/network/interfaces has lots of obvious typos. – Milliways Sep 5 '15 at 22:58
  • give us output of cat /etc/resolv.conf – jet Sep 6 '15 at 0:21
  • My issue is resolved. Thanks to point out resolv.conf file. I searched few things, appended resolv.conf file with “dns-nameserver 192.168.137.1 nameserver 8.8.8.8” and it worked but not sure how. Can you tell how it worked? What’s the effect of adding gateway IP to resolv.conf file? – Hari Sep 6 '15 at 7:23
  • nameserver 8.8.8.8 line should be sufficient. This file configures the DNS server(s) for the system hence failing to resolve domain names when was not configured. – jet Sep 6 '15 at 14:27
  • When using DHCP to assign IP-number you also get your DNS-servers. If you use Fixed IP you need to set everything yourself. – Thorbjørn Ravn Andersen Nov 28 '16 at 17:47
2

Add this line to /etc/network/interfaces under wlan interface sections.( in your raspberry pi)

nameserver 8.8.8.8

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.