1

I have been working on my raspberry pi. I defined 2 different networks. First one is my home network and the second one is my phone(hotspot). When my hotspot is not available, it connects to my home network. However, after connecting to home network i can't ping. It gives "unreachable destination" error. What should I do in order to connect internet after connecting to a different network from another one?

Thank you

$ iwconfig
wlan1     IEEE 802.11bgn  ESSID:"*****"  Nickname:"<WIFI@REALTEK>"
      Mode:Managed  Frequency:2.437 GHz  Access Point: 18:28:61:F9:A2:35   
      Bit Rate:72.2 Mb/s   Sensitivity:0/0  
      Retry:off   RTS thr:off   Fragment thr:off
      Power Management:off
      Link Quality=69/100  Signal level=46/100  Noise level=0/100
      Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
      Tx excessive retries:0  Invalid misc:0   Missed beacon:0

/etc/network/interfaces

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan1
iface wlan1 inet dhcp
pre-up wpa_supplicant -Dwext -i wlan1 -c /etc/wpa_supplicant/wpa_supplicant.conf -B

/etc/wpa_supplicant/wpa_supplicant.conf

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

network={
ssid="****"
scan_ssid=1
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="****"
}

network={
ssid="****"
scan_ssid=1
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="****"
}
1

Most likely the Pi gets a different IP address assigned depending on what access point it uses. This a is a common problem solved by using a dynamic dns server.

The Pi is required to send a message the DNS service with its new IP address, now when you use the dynamic DNS host name it points to the IP address where the Pi is located.

On top of this you will have to ensure that the IP address the Pi has is reachable from the internet, investigate "Port Forwarding" for your router.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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