• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Connecting the Raspberry Pi to the Internet

Q&A Forum › Category: Raspberry Pi › Connecting the Raspberry Pi to the Internet
0 Vote Up Vote Down
wael elsisi asked 3 years ago

After Creating a file called wpa_supplicant.conf
Can I set more than 1 network?
https://randomnerdtutorials.com/installing-raspbian-lite-enabling-and-connecting-with-ssh/
country=PT # Your 2-digit country code ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev network={ ssid=”_NETWORK_1″ psk=”PASSWORD” 
ssid=”_NETWORK_2″ psk=”PASSWORD”
key_mgmt=WPA-PSK
}

4 Answers
0 Vote Up Vote Down
Joe Margevicius answered 3 years ago

Here’s one way to do it (3 example routers being shown):
1) modify interfaces file at /etc/network/interfaces /etc/network/interfaces.d/interfaces
(note – there will be 2 interfaces files; 1 in /etc/network, the other in /etc/network/interfaces.d — do this for the one in interfaces.d directory )
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
source-directory /etc/network/interfaces.d
auto lo #lo is loop-back; 127.0.0.1 is always the IP to talk to oneself
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface house inet dhcp
iface backyard inet dhcp
iface Netgear_2.4G inet dhcp
~~~~~~~~~~~~~~~~~~~~
2) modify wpa_supplicant.conf file at /etc/wpa_supplicatn/wpa_supplicant.conf
~~~~~~~~~~~~~~~~~~~
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US
network={
ssid=”house_ssid”
psk=”house_passcode”
key_mgmt=WPA-PSK
id_str=”house”
}
network={
ssid=”backyard_ssid”
psk=”backyard_passcode”
key_mgmt=WPA-PSK
id_str=”backyard”
}
network={
ssid=”Netgear_2.4G_ssid”
psk=”Netgear_2.4G_passcode”
key_mgmt=WPA-PSK
id_str=”Netgear_2.4G”
}
~~~~~~~~~~~~~~~~~~~~~~~~~~

oh, and the file /etc/network/interface should basically be empty, except for this:

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi.
Thanks for sharing that solution, Joe.
Does that work for you, wael elsisi?
Regards,
Sara

0 Vote Up Vote Down
wael elsisi answered 3 years ago

Thank you very much.

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Great!
I’ll close this issue.

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.