This repository contains a step-by-step guide on how to setup a Raspberry Pi 3 with 2 WiFi cards. One card connects to the desired WiFi, the other hosts a WiFI network for clients to join.
Once OpenWRT is flashed on the SD card and the RPI is started, it require direct connection to your computer through the LAN cable. This is because OWRT is setup to create a network on the ethernet port with IP 192.168.1.1 : this IP and network are likely used by your existing router, so you won't be able to connect to it if you plug the ethernet cable into the PI and the existing router.
To fix this, you have 2 options:
- Connect the RPI to your laptop via ethernet
- Connect a screen to the RPI and change some configs
We'll go for the second one.
Log into the console by connecting keyboard and a screen to the Pi, then modify the lan config into /etc/config/network as follows:
config interface 'loopback'
option device 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fd9b:9d35:ae65::/48'
option packet_steering '1'
config device
option name 'br-lan'
option type 'bridge'
list ports 'eth0'
config interface 'lan'
option device 'br-lan'
option proto 'dhcp'
Then make sure SSH is enabled, by checking /etc/config/dropbear config:
config dropbear main
option enable '1'
option PasswordAuth 'on'
option RootPasswordAuth 'on'
option Port '22'
# option BannerFile '/etc/banner'
Once you reboot, the PI should be able to join your existing network. You should be able to SSH into it with root@<ip_addr>
This setup comes from ChatGPT and the following question I asked
I have a raspberry pi with OpenWRT installed. The RPI has 2 wifi cards: the built-in one (radio0) and an external one (radio1). It is also connected to my home router through the LAN port, with IP 192.168.1.193 .
I can currently access the web interface through it's LAN IP 192.168.1.3 .
I want to setup OpenWRT such that:
- There is a wifi network provided by radio1 that has a gateway set on 10.71.71.1 and all other clients can connect to it and get a DHCP address in the range 10.71.71.50 - 10.71.71.100 . The wifi should be called 'Travel' .
- I want to be able to access the web interface to change the configuration from the network just created. So going to 10.71.71.1 should open the web interface of openwrt.
Chat GPT answer
To set up your Raspberry Pi with OpenWRT to create a Wi-Fi network using radio1 with the specified configurations, follow these steps:
- Open your web browser and go to
http://192.168.1.193to access the OpenWRT web interface.
-
Navigate to Network > Wireless.
-
Find the
radio1interface (the external Wi-Fi card) and click on Edit. -
Set the following parameters:
- ESSID:
Travel - Mode: Access Point
- Network: Create a new network (e.g.,
Travel).
- ESSID:
-
Save & Apply the changes.
-
Navigate to Network > Interfaces.
-
Click on Add new interface.
-
Set the following parameters:
- Name:
Travel - Protocol: Static address
- Interface: Select the new network you created for
radio1.
- Name:
-
Click Submit.
-
Set the following parameters:
- IPv4 address:
10.71.71.1 - IPv4 netmask:
255.255.255.0 - IPv4 gateway: Leave this blank (as this will be the gateway).
- DNS server: You can set this to your home router's IP (e.g.,
192.168.1.1) or any public DNS server (e.g.,8.8.8.8).
- IPv4 address:
-
Save & Apply the changes.
-
Navigate to Network > DHCP and DNS.
-
Scroll down to the DHCP Server section and find the
Travelinterface. -
Enable the DHCP server and set the following parameters:
- Start:
50 - Limit:
51(this will give you a range of 50 addresses, from 10.71.71.50 to 10.71.71.100) - Lease time: Set as desired (e.g.,
12 hours).
- Start:
-
Save & Apply the changes.
-
Navigate to Network > Firewall.
-
Click on Add to create a new zone for the
Travelnetwork. -
Set the following parameters:
- Name:
Travel - Input: Accept
- Output: Accept
- Forward: Reject
- Covered networks: Select the
Travelinterface.
- Name:
-
Save & Apply the changes.
-
In the same Firewall settings, go to the Traffic Rules section.
-
Click on Add to create a new rule.
-
Set the following parameters:
- Name: Allow access to web interface
- Source zone:
Travel - Destination zone:
Device - Destination port:
80(for HTTP) and443(for HTTPS, if enabled). - Action: Accept
-
Save & Apply the changes.
- Reboot your Raspberry Pi to ensure all settings are applied correctly.
- Connect a device to the
TravelWi-Fi network. - Check if you can access the OpenWRT web interface by navigating to
http://10.71.71.1.
- If you cannot access the web interface, double-check the firewall rules and ensure that the DHCP server is functioning correctly.
- Ensure that the Wi-Fi network is broadcasting and that devices can connect to it.
By following these steps, you should have a functioning Wi-Fi network on your Raspberry Pi with OpenWRT, allowing you to access the web interface from the new network.
Then I asked
Now, I want radio0 to connect to a wifi network and forward internet connection to the clients connected the Travel network thorugh radio1
Chat GPT answer
To configure your Raspberry Pi with OpenWRT so that radio0 connects to an existing Wi-Fi network and forwards the internet connection to clients connected to the Travel network via radio1, follow these steps:
-
Navigate to Network > Wireless.
-
Find the
radio0interface (the built-in Wi-Fi card) and click on Edit. -
Set the following parameters:
- Mode: Client
- ESSID: Enter the SSID of the Wi-Fi network you want to connect to.
- Network: Create a new network (e.g.,
WAN).
-
Save & Apply the changes.
-
Navigate to Network > Interfaces.
-
Click on Add new interface.
-
Set the following parameters:
- Name:
WAN - Protocol: DHCP client (if the existing Wi-Fi network provides DHCP).
- Interface: Select the new network you created for
radio0.
- Name:
-
Save & Apply the changes.
-
Navigate to Network > Firewall.
-
You should see the existing zones for
TravelandWAN. If not, create a new zone for theWANinterface:- Click on Add.
- Set the following parameters:
- Name:
WAN - Input: Reject
- Output: Accept
- Forward: Reject
- Covered networks: Select the
WANinterface.
- Name:
-
Save & Apply the changes.
-
In the Firewall settings, go to the Traffic Rules section.
-
Click on Add to create a new rule.
-
Set the following parameters:
- Name: Allow forwarding from Travel to WAN
- Source zone:
Travel - Destination zone:
WAN - Action: Accept
-
Save & Apply the changes.
-
Still in the Firewall settings, go to the General Settings tab.
-
Find the
WANzone and check the box for Masquerading. This will enable NAT for theWANzone, allowing clients on theTravelnetwork to access the internet. -
Save & Apply the changes.
- Reboot your Raspberry Pi to ensure all settings are applied correctly.
- Connect a device to the
TravelWi-Fi network. - Check if you can access the internet from the device connected to the
Travelnetwork.
- If you encounter any issues, check the status of the
WANinterface to ensure it is connected to the existing Wi-Fi network. - You can also check the logs in the OpenWRT web interface under Status > System Log for any errors or connection issues.
- Make sure that the existing Wi-Fi network allows clients to connect and provides internet access.
If you have any questions or need further assistance, feel free to ask!
Once this is done, make sure to unplug the ethernet cable (you won't be able to go to the internet otherwise). Then reboot
- AdGuard setup https://openwrt.org/docs/guide-user/services/dns/adguard-home
- Wifi cards used + driver install
- Resizing of disk (if necessary) openwrt/openwrt#7729
- Investigate Travelmate? https://forum.openwrt.org/t/travelmate-support-thread/5155