Turn the raspberry pi into a WIFI router

We will present how to configure the necessary configuration to transform the do OpenWRT + raspberry pi into a WIFI router.

So, following these steps, we can use our raspberry pi as a second router. Additionally, we can use it as a replacement for our wireless router.

This video shows how to separate the interfaces to create the routes between LAN and WAN.

In addition, we demonstrate how to perform the separation and isolation of the raspberry pi interfaces.

We present in detail all the steps to configure the raspberry pi and the OpenWRT. If you have questions, you can send messages on our youtube channel.

To install OpenWRT on raspberry pi, go to the post HERE. ou o VIDEO.

Checking the OpenWRT interfaces

Initially, let us check how the raspberry pi interfaces are mapped inside OpenWRT. To do this, we will access the top tab menu and NETWORK. Next, let us select INTERFACES.

Networks-> Interfaces
Networks-> Interfaces

Inside the interfaces page, we can see a LAN interface available. This interface bridges the interfaces destined for the LAN. Including the WIFI interface.

LAN Network
LAN Network

Enabling the raspberry pi WIFI

In the next step, we will access the NETWORK menu and access WIRELESS. Next, let us click ENABLE on the Wireless interface.

So, let us enable the wireless interface. After enabling the Wifi, it will create a network with the SSID OpenWrt. However, this network is still unencrypted.

Networks->Wireless
Networks->Wireless
Click Enable
Click Enable

So let us enable encryption. To do this, let us click on EDIT. Then, a page with the wireless network settings will open.

Click EDIT
Click EDIT

Further down, we will select the WIRELESS SECURITY option. Soon after, we will choose the type of encryption.

CLICK WIRELESS SECURITY
CLICK WIRELESS SECURITY

In this case, we chose WPA2. After that, we will enter the password that will be used to gain access to the OpenWRT network.

Set the encryption and the password
Set the encryption and the password

After configuring the wireless network, let’s save the configuration and then click SAVE & APPLY. After that, OpenWRT will make the changes and save it in memory.

Click Save & Apply
Click Save & Apply

Connecting the raspberry pi LAN via WIFI interface

Before separating the interfaces, let us connect to the raspberry pi using the WIFI interface. For this, we will connect to the OpenWrt network.

Connect to wireless OpenWrt
Connect to wireless OpenWrt
password
password

Accessing the OpenWRT WEB interface via WIFI

Next, we will remove the ethernet cable connected to our computer, and we will stay connected to the raspberry pi only via wifi. After that, let us access the browser and retype the raspberry pi LAN IP. In this case, the IP is “192.168.1.1“.

Connect to 192.168.1.1 via wifi
Connect to 192.168.1.1 via wifi

Removing the eth0 LAN interface from OpenWRT

Now, let us separate the eth0 interface from the wireless interface. Therefore, let us go to the NETWORK menu and click on INTERFACES.

Network -> Interfaces
Network -> Interfaces

We can see that the wifi symbol now appears in the figure of the LAN interface.

This behavior occurs because OpenWRT makes a bridge between the eth0 interface and the wireless interface.

LAN ( eth0 + wireless)
LAN ( eth0 + wireless)

Now let us click on EDIT. Then, we will select only the Wireless interface in the DEVICES field.

LAN -> EDIT
LAN -> EDIT

In this way, the only interface on the LAN will be the WIFI interface of the raspberry pi.

Select device = wireless network
Select device = wireless network

After that, let us save the configuration by clicking SAVE.

Click Save

Next, let us click on SAVE&APPLY.

Click Save & Apply

Adding the eth0 interface on the OpenWRT WAN

It is time to create the WAN interface for our raspberry pi. Firstly, we must remember that this WAN interface will be the eth0 interface of the raspberry pi.

Therefore, we will connect this eth0 interface to the equipment providing internet access, for example, the gateway. Sometimes, the gateway may be a modem from our ISP or another router.

In this example, we are connecting the raspberry pi eth0 interface to the LAN interface of our router that receives a direct connection to the Internet.

Connecting the raspberry pi to the gateway
Connecting the raspberry pi to the gateway

So let us click ADD NEW INTERFACE.

Adding a new interface
Adding a new interface

Next, we will name the interface “newWAN” and then indicate that the interface will automatically receive IP via DHCP.

So, let us choose “DHCP Client”. After that, let’s select device = eth0; this indicates that the eth0 interface will be associated with the name “newWAN”.

Name = newWAN, protocol = DHCP client, Device = eth0
Name = newWAN, protocol = DHCP client, Device = eth0

After that, we will save the settings. After that, let’s click on SAVE&APPLY.

Click Save & Apply

Configuring OpenWRT routes and NAT

Now, let us configure the necessary routes and zones. Initially, we can verify that the wireless interface is in the LAN zone.

Network -> Firewall
Network -> Firewall
Wireless = LAN
Wireless = LAN

Next, we need to include the “newWAN” interface in the WAN zone. Then, let us click on EDIT in the WAN zone part to do this.

Click  WAN EDIT
Click WAN EDIT

Next, we will include the “newWAN” interface in the “COVERED NETWORKS” field.

set Covered Networks = newWAN
set Covered Networks = newWAN

After that, let’s save the settings and then click on SAVE&APPLY.

click save & apply
click save & apply

Testing OpenWRT + Raspberry Pi internet access

Once we’ve configured everything, we can test access to the internet.

testing Internet connection
testing Internet connection
Article 01 – How to install OpenWrt on Raspberry Pi
Article 02 – Turn the raspberry pi into a WIFI router
Article 03 – Raspberry Pi: installation and configuration
Article 04 – Install VNC on Raspberry pi
Article 05 – How to install Zabbix on Raspberry Pi
RaspBerry Pi Tutorial

Demonstrating the next steps

In future videos and articles, we intend to cover more OpenWrt modules within the raspberry pi.

Comment on our channel if you are interested in more topics about this.

More openwrt modules
More openwrt modules

Juliana Mascarenhas

Data Scientist and Master in Computer Modeling by LNCC.
Computer Engineer

Best IDE for Python?

Finding the perfect IDE is a personal journey that depends on various factors such as…

Read More