Setting up a raspberry pi as router

Hello,

I while back I attempted to set up a raspberry pi as a wifi router. I managed but don't really know why, so I broke it trying to understand it and now I need to build it up again (reinstall). Thinking of doing it right this time according to my setup.

After installing latest OpenWrt to a sd card I connect it to my pc with a ethernet cable and my pc get an IP. Not really what I want, but I need some help understanding the "br-lan". It is set up so that it makes a bridge between eth0 and wlan0 as far as I can tell, and handing out IPs on both interfaces. To all wifi clients that might connect and to the single client connecting to the ethernet port. Not what I want.

I only want it to hand out IP to clients connecting to wlan0, and eth0 should be a DHCP client so I can plug it into my home network that already has a DHCP server for update and configure this device.
Should I delete br-lan all together?

In the end there are three interfaces that I need:

  • wlan0 as a AP with DCHP server allowing clients to connect with password and get a IP from the pi
  • eth0 as a DHCP client so I can plug it into my home network for update and config
  • eth1 is the usb 4g modem after drivers are installed. wifi clients should get internet from this interface

What I have tried to do is to connect it to my pc since the OpenWrt will by default act as a dhcp server handing out ips. I then removed br-lan interface and added a new interface called "LAN2" with the eth0 device and DHCP client setting.
I save and loose connection. I then try to plug it to my home network that already has a DHCP. It should work as a DHCP client? But something is wrong and the device does not show. I try to scan my network but no device in the DHCP range.

Create a new wan interface, if there isn't one already, and move the ethernet port to it.

Move the WAN interface to the wan zone, so it becomes red in the interface menu.

Then change the protocol from static to dhcp client.

Make sure the subnet of the wan port differ from lan.

1 Like