I am using a private hotspot to connect a Raspberry Py to internet. I've setup the password and the ssid in the /etc/network/interfaces
file. With this configuration I'm able to connect to the wifi but I can't connect to internet.
pi@tenzo /etc $ ping google.com
PING google.com (173.194.40.2) 56(84) bytes of data.
From tenzo.local (192.168.1.115) icmp_seq=1 Destination Host Unreachable
I've asked around and they said it's a gateway issue. Running traceroute
from a laptop connected to the same network I get:
userk@dopamine:~$ traceroute google.com
traceroute to google.com (216.58.212.110), 30 hops max, 60 byte packets
1 192.168.43.1 (192.168.43.1) 2.423 ms 5.088 ms 5.084 ms
2 * * *
3 10.4.129.165 (10.4.129.165) 120.018 ms 120.027 ms 120.020 ms
4 10.4.129.196 (10.4.129.196) 129.488 ms 129.490 ms 129.471 ms
5 10.4.129.196 (10.4.129.196) 138.994 ms 141.969 ms 144.439 ms
Do you have any advice?
EDIT 1 I've added to the interfaces
the gateway, address and netmask. SEE EDIT 2
Now, when I ping google.com I get the same error as before...
This is the output of route -n
pi@tenzo ~ $ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
0.0.0.0 192.168.43.1 0.0.0.0 UG 303 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.43.0 0.0.0.0 255.255.255.0 U 303 0 0 wlan0
EDIT 2 This is my interfaces file:
auto lo
iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.115
netmask 255.255.255.0
gateway 192.168.1.1
auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.43.235
netmask 255.255.255.0
gateway 192.168.43.1
wpa-ssid "UserKOnTheNet"
wpa-psk "xxxxx"
This is the output of traceroute
pi@tenzo ~ $ traceroute google.com
traceroute to google.com (173.194.40.7), 30 hops max, 60 byte packets
1 tenzo.local (192.168.1.115) 2995.172 ms !H 2995.058 ms !H 2995.016 ms !H
A gateway would need to be configured in your interfaces
file; e.g., something like
iface wlan0 inet static
address 192.168.x.y
gateway 192.168.x.z
netmask 255.255.255.0
would work (where x is your network number, y the address for your host, and z the address for your gateway). Obviously you need to retain your encryption settings, too.
If you're using dhcp on that interface, then something is wrong with your dhcp server.
EDIT: you should also make sure no other network interface has a gateway
setting, or if it does, that the gateway setting on that interface is correct. A "gateway" or "default gateway" is a machine which offers a connection to the Internet. It is a valid configuration to have a network interface without a gateway
line if no such host exists on that network connection.
In your case, assuming there is no internet router on the network that eth0
is linked to, you should ensure that the iface eth0
stanza looks like this:
iface eth0 inet static
address 192.168.1.115
netmask 255.255.255.0
i.e., what you already have, but without the gateway 192.168.1.1
line. (the indentation at the start of the line is optional, but does make the file easier to read).
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다