Purpose: Create a router with OpenWrt on Rapsberry Pi.
Principle: The On-board Wifi (wlan0) will connect to any available public Wifi while the additional Wifi (wlan1) will be used to generate the access point to which any user will connect.
Hardware needed: Rapsberry Pi3B+ (or Pi4) and its power supply
SD Card (16GB will work) with USB SD Card adapter
Ethernet Cable
Wifi USB Dongle
Download the package by going to:
https://firmware-selector.openwrt.org
Use Pi Imager or Balena to flash the SD Card
Insert the SD Card in the Raspberry. Connect an ethernet cable between the Raspberry Pi and the computer which you are working on to configure the Raspberry Pi (Beelink in my case).
The default IP Address of the OpenWrt Raspberry Pi after flashing and Power On will be 192.168.1.1.
Use ssh to connect to the raspberry:
ssh root@192.168.1.1

Create a password for root using the command passwd
Move to /etc/config and create a backup of the files firewall, network and wireless by running the following commands:
cp firewall firewall.bak
cp network network.bak
cp wireless wireless.bak
Modify the network file to change the IP address (192.168.1.1 is too common for home network). I chose to set 10.53.53.1
Start modifying some system configuration files as follows:
Note: these modification must be done using ‘vi’ as file editor as ‘nano’ is not installed in OpenWrt package.
To do it a file, use ‘Insert’ to modify. To save the file type ‘ESC’ ‘:’ wq ENTER.
Modification of ‘network’ file: edit the ‘option ipaddr’ with the chosen value and add the last line as below:
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 'fdf0:cb88:93c4::/48'
config device
option name 'br-lan'
option type 'bridge'
list ports 'eth0'
config interface 'lan'
option device 'br-lan'
option proto 'static'
option ipaddr '10.53.53.1'
option netmask '255.255.255.0'
option ip6assign '60'
option force_link '1'
Then add the following block:
config interface 'wwan'
option proto 'dhcp'
option peerdns '0'
option dns '1.1.1.1 8.8.8.8'
And finally define the interface for the vpn:
config interface 'vpnclient'
option ifname 'tun0'
option proto 'none'
Modify the ‘firewall’ file:

In the block ‘config zone’, replace the ‘option input’ REJECT by ACCEPT.
Save the file (ESC, :, wq, ENTER)
Then, reboot the Raspberry pi.
You can then connect to the Raspberry OpenWrt by using the command
ssh root@10.53.53.1
Now, we modify the ‘wireless’ file
vi /etc/config/wireless

modify ‘option channel’ to ‘7’
modify ‘option band’ to ’11g’
modify ‘option htmode’ to ‘HT20’
modify ‘option disabled’ to ‘0’
add a line option short_gi_40 ‘0’
Save the file (ESC, :, wq ENTER)
Apply the modification by running the command:
uci commit wireless
Then start the Wifi
wifi
At this point, you should be able to see a Wifi network named OpenWrt!
System is effectively broadcasting the network OpenWrt!!
Now, let’s connect to the system using the GUI. In a browser, insert the url: 10.53.53.1, then ENTER:

Key-in the password that was defined at an early stage for user ‘root’. Then ENTER

In the Menu ‘Network’, select ‘Wireless’, then press ‘Scan’ button to view all available Wireless networks around.
Select the network which is relevant (your home network – or the hotel network,…)

Tick the box ‘Replace Wireless Configuration’, enter the paraphrase for the selected network, press ‘Submit’:

Press ‘Save’:

And finally press ‘Save and Apply’.
Then Go to menu ‘Status’ Overview, and scroll down to Network section:

You can see all the details related to the network connection, as well as the Wireless network details.
Check that you have access to Internet by pinging google.com of 8.8.8.8

Update the OpenWrt system by running the command:
opkg update
In case the update fails, just reboot the system and try again.
Install additional packages needed for complete operation of the system. These packages include the driver relevant to the USB Wireless Adapter used for wlan1. (Note: the driver is kmod-mt7601u)
The command to run is the following:
opkg install kmod-mt7601u kmod-rt2800-lib kmod-rt2800-usb kmod-rt2x00-lib kmod-rt2x00-usb kmod-usb-core kmod-usb-uhci kmod-usb-ohci kmod-usb2 usbutils openvpn-openssl luci-app-openvpn nano