User avatar
privatejava
Posts: 7
Joined: Mon Jul 28, 2014 7:32 pm
Location: Kathmandu
Contact: Website Yahoo Messenger

Internet is not working in RPI

Mon Jul 28, 2014 7:35 pm

Hi,
Today I have successfully configured for making wifi hotspot using the internet from Ethernet by the help of some sites. But I am amazed that I am now not able to use internet in my Raspberry pi however the internet is working totally great for users from hotspot wifi's user.

Please help.

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: Internet is not working in RPI

Mon Jul 28, 2014 7:49 pm

Please post the output from following commands:

ifconfig -a
ip route
cat /etc/network/interfaces
cat /etc/hostapd/hostapd.conf
cat /etc/resolv.conf
ping -c3 8.8.8.8
ping -c3 google.com
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
privatejava
Posts: 7
Joined: Mon Jul 28, 2014 7:32 pm
Location: Kathmandu
Contact: Website Yahoo Messenger

Re: Internet is not working in RPI

Mon Jul 28, 2014 8:18 pm

Code: Select all

pi@raspberrypi ~ $ ifconfig -a
eth0      Link encap:Ethernet  HWaddr b8:27:eb:75:d5:b2
          inet addr:44.236.212.202  Bcast:49.236.212.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2070 errors:0 dropped:0 overruns:0 frame:0
          TX packets:684 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:415744 (406.0 KiB)  TX bytes:105925 (103.4 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:108 errors:0 dropped:0 overruns:0 frame:0
          TX packets:108 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:8680 (8.4 KiB)  TX bytes:8680 (8.4 KiB)

mon.wlan0 Link encap:UNSPEC  HWaddr F8-1A-67-0B-E2-97-00-00-00-00-00-00-00-00-00-00
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5652 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1900818 (1.8 MiB)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr f8:1a:67:0b:e2:97
          inet addr:192.168.42.1  Bcast:192.168.42.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2226 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3007 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:295232 (288.3 KiB)  TX bytes:730913 (713.7 KiB)

Code: Select all

pi@raspberrypi ~ $ ip route
default via 49.236.212.1 dev eth0
49.236.212.0/24 dev eth0  proto kernel  scope link  src 44.236.212.202
192.168.42.0/24 dev wlan0  proto kernel  scope link  src 192.168.42.1

Code: Select all

pi@raspberrypi ~ $ cat /etc/network/interfaces
auto lo

iface lo inet loopback
iface eth0 inet static
address 44.236.212.202
netmask 255.255.255.0
gateway 44.236.212.1
dns-nameservers 201.94.65.2 201.94.65.3

allow-hotplug wlan0

iface wlan0 inet static
address 192.168.42.1
netmask 255.255.255.0
gateway 192.168.1.1

pre-up iptables-restore < /etc/iptables.ipv4.nat

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

Code: Select all

pi@raspberrypi ~ $ cat /etc/hostapd/hostapd.conf
interface=wlan0
driver=nl80211
#driver=rtl871xdrv
ssid=RPI
hw_mode=g
channel=11
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=samsung
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
#wpa_ptk_rekey=600

Code: Select all

pi@raspberrypi ~ $ cat /etc/resolv.conf
#nameserver 192.168.0.1
#nameserver 192.168..1

Code: Select all

pi@raspberrypi ~ $ ping -c3 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=58 time=78.5 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=58 time=78.3 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=58 time=78.3 ms

--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 78.335/78.421/78.537/0.085 ms

Code: Select all

pi@raspberrypi ~ $ ping -c3 google.com
ping: unknown host google.com
Last edited by privatejava on Mon Jul 28, 2014 8:22 pm, edited 1 time in total.

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: Internet is not working in RPI

Mon Jul 28, 2014 8:20 pm

So there's the problem. You don't have a resolver defined in /etc/resolv.conf.

Change it to

Code: Select all

nameserver 201.94.65.2 
nameserver 201.94.65.3
nameserver 8.8.8.8
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
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: Internet is not working in RPI

Mon Jul 28, 2014 8:25 pm

privatejava wrote:

Code: Select all

pi@raspberrypi ~ $ cat /etc/resolv.conf
#nameserver 192.168.0.1
#nameserver 192.168..1

Code: Select all

pi@raspberrypi ~ $ ping -c3 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=58 time=78.5 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=58 time=78.3 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=58 time=78.3 ms

--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 78.335/78.421/78.537/0.085 ms

Code: Select all

pi@raspberrypi ~ $ ping -c3 google.com
ping: unknown host google.com
Well, there's your problem! You've got nothing configured in /etc/resolv.conf, so your Pi can only access hosts by IP address and can't access them by name using DNS. Try copying your name-server settings from /etc/network/interfaces into /etc/resolv.conf i.e.

Code: Select all

nameserver 201.94.65.2
nameserver 201.94.65.3
EDIT: LOL, beaten by Dougie! :D

User avatar
privatejava
Posts: 7
Joined: Mon Jul 28, 2014 7:32 pm
Location: Kathmandu
Contact: Website Yahoo Messenger

Re: Internet is not working in RPI

Mon Jul 28, 2014 8:28 pm

Wow it worked !! Last time i added but again commented them out due to some reason. Thanks for saving my time and I am so amazed with the fastest reply ever. This was my first forum post in raspberry pi ...!! Thanks again

Is there something like rating that i can give you guys?

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: Internet is not working in RPI

Mon Jul 28, 2014 8:31 pm

privatejava wrote:Is there something like rating that i can give you guys?
I'll just take the kudos of beating Andrew. :mrgreen: :mrgreen: :mrgreen:
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 “General discussion”