Can't set an uplink when setting up a Raspberry Pi as a router

I've been on this for days. I looked this up everywhere I could, and I find pieces of answers, but not all seem to say the same thing, and I'm not sure all of them are relevant. (For example, do I need a VLAN?)

Here's the situation: I'm trying to turn a Raspberry Pi 4B into a router. I'll have the uplink on port eth1, which is a USB-to-Ethernet connector. Currently, it's my regular network on 192.168.1.0/24. I'm also connecting through Wi-Fi. Eventually, I'll have my old router in bridge mode connected to the Pi for the LAN. Currently, the LAN is on 192.168.2.0/24.

From the Pi, I can access my regular network. I can ping my other machines, 8.8.8.8, and other addresses. I can also access the LAN. I can ping my computer connected via Wi-Fi on 192.168.2.77 and the computer can access the Pi on 192.168.2.140. These are all static addresses. DHCP does not seem to work yet.

BUT, from my local computer, I cannot access anything beyond the 192.168.2.0/24 network. I cannot access 192.168.1.1 (the current router), or 8.8.8.8. Eth1 needs to work as an uplink.

Bridging eth0 and eth1 produced no effect I could notice. I read something about creating a VLAN, but that seems to be for routers that have several Ethernet ports.

Also (but less important currently):

  • How should I make OpenWrt set the correct nameservers? Currently, it's always set to 127.0.0.1, until I change it in /etc/resolv.conf. The correct nameservers are set in the Interface device configuration, but OpenWrt seems to be ignore that.
  • How do I set up a DHCP server on eth0 (the LAN)? I set up the DHCP options in the Interface section, but it didn't produce any effect.
  • How do I make eth1 (the future WAN) a DHCP client? When connected to the ISP, eth1 will have to work as a client, as the IP address is dynamic. It should already be possible since eth1 is connected to my existing network and the router already assigns the addresses via DHCP.

Am I missing some packages not installed by default? I had to install the driver for the USB-to-Ethernet module. I installed the kernel module for "bonding", but it doesn't look like I actually need it.

I can include the content of my /etc/config/network if it's useful, but currently, I can only access the internet (like this website) or the OpenWrt server at a time, not both, so it would be a pain to get it right now, but I can add it as a follow-up later.

My router is a MR8300. I know I could flash it, but I'd rather start on a Pi. Also, the idea at some point will be to have the router run a domain name server, maybe Kerberos-based single-sign-on, and other central network functions. I don't think that the router will be able to run all that.

Even though it may not sound like it, I'm extremely impressed by OpenWrt. It's exactly what I had been seeking for this project. But now, I need to improve my understanding of how networks work.

Thanks!

if you want the Pi to be a future router, don't do this, nor do you need it.

this is the default, and it works, if you haven't broken the config elsewhere.

this should happen automagically, using the default config, and only swapping eth1 and eth0 in /etc/config/network.

same answer as above.

probably, which one depends on what hw it uses, lsusb or dmesg will tell you.

you don't need VLANs unless required by your ISP for logging in into the internet service.

I think I broke a few things, then. I'll just try resetting everything to default, except for the router's IP address, and if that doesn't work, I'll just write over the SD card with a new copy of OpenWrt. It's all part of the learning experience!

Thanks!

firstboot -y && reboot

Overwriting an SD card does not always work as expected.

Resetting to defaults with firstboot only works on squashfs images not ext4.

Use the Firmware Selector to create an image with the USB driver kmod built in. When you firstboot that image, the scripts will find two Ethernet ports and set up for lan to wan routing. You will still need to change the lan IP but otherwise the defaults should work.

1 Like

When did that change?
I've never used squashfs on an RPi.

At least that is how it used to work. There is no ROM partition in the ext4 system, thus if you modified for example /etc/config/firewall the working copy is the only copy; there is no way to get the default version back.

1 Like

The reason firstboot works (I don't remember the file system reason why) is needed with RPis is because ext4 will not just let go of settings.
You can reformat the card over and over but unless you flash another OS (because reformatting will not fix it) the settings persist.

Unless something has changed in the past 6 months (last time I played OpenWrt with my Pi4) I did it out of habit.

I'll boot it up later today and see what happens in 2025; could be anything.

@eje211 Ensure you have the latest bootloader.