41
submitted 1 week ago by [email protected] to c/[email protected]

I have an unused Raspberry Pi 4 (2GB model) lying around and I would like to install OpenWRT on it and use it as a router. I get Internet from DSL so I can't hook it up on the Raspberry Pi directly, I need to plug an Ethernet cable coming from my actual router to the Pi.

I am no expert on networking, so please forgive me if I say something that is wrong. I want the WAN coming in from the router from the Pi's Ethernet port, and the LAN coming out as Wi-Fi. I may also stick an additional Ethernet adapter to it in the future. I have tried doing this many times and have failed. So, could anyone explain to me how could I do this?

Also, what are VLANs, what are their uses and if I wanted one, how could I setup it in OpenWRT?

Thanks in advance.

top 27 comments
sorted by: hot top controversial new old
[-] [email protected] 6 points 1 week ago

How did you fail?

VLANs (Virtual LANs) are for isolating devices from each other (while still being plugged to the "LAN" ports of the same router).

[-] [email protected] 6 points 1 week ago* (last edited 1 week ago)

To add a bit: With VLANs you can have several 'virtual' cables inside of a real (physical) cable. You probably don't need it in a home setup, I'm not sure. It's for use cases like you just have one ethernet port or one cable running through the wall, but you need two (or more) entirely separate networks on the other side. Like the telephone network or the seperate server network along with the normal network, all over one cable. It works by tagging all the network packets. In the end it's just a number that gets attached to the packets and the other side knows how to handle the packets with those additional numbers attached to them. And it can send them out through different ports again.

At home, most people just have one network, so that kind of functionality isn't needed. Some people put their TV set, NAS or the smart home devices or their home office and/or guests in different networks so the devices can't mess with each other. A VLAN might be handy for those kind of things. And OpenWRT has VLANs, too, since there are two separate networks attached (as with every router). In this case the WAN side, going to your ISP, and your LAN. If you have a router with like 5 ports on the back, you can map those to either port if you change the VLAN settings. The labeling (WAN/LAN) from the manufacturer is just the default with OpenWRT.

[-] [email protected] 2 points 1 week ago

I don’t think I am special but I have a few vlans setup. May main concern is using cheap “smart” devices from china and isolating anything they see or do to their own private network.

I also have a vlan setup for my guest network because I let my neighbors use it and wouldn’t want them exploring my nas.

[-] [email protected] 2 points 1 week ago* (last edited 1 week ago)

That's a bit more elaborate then 'usual'. But not unheard of. I spoke to some people here on Lemmy who have put their cheap IoT devices on a separate Wifi. And guest networks are fairly common. IMHO those should be easier to set up on OpenWRT.

Regarding the cheap 'chinesium' smart devices: I hope you're aware of projects like Tasmota, ESPHome and OpenBeken... I'm not that much into making everything smart, but I also have some smart sockets, LED strips and stuff. I had some luck with the first devices I bought and after that I payed attention to just buy things where I could replace the firmware. So for me they all communicate with my own MQTT broker and Home Assistant directly, and there isn't any firmware on them any more that'd talk to the china cloud.

It's not that easy though. Some require opening and flashing via an USB to serial adapter. And lots of devices aren't supported by aftermarket firmwares at all. Especially the more elaborate ones.

[-] [email protected] 2 points 1 week ago

Wow thanks. I’ll look into it. I bought a 4 pack of smart plugs for $25 and figured there had to be a catch. But 4 years later they are still working fine. Nothing I use them for is mission critical or high amperage but I’m happy.

I also have 4 levitation smart switches which I’m not as worried about them but still keep them on the vlan.

Besides those I have a cheap smart ir transmitter, and a google nest smart speaker. About to add 2 WiFi cameras to the vlan, so we will have to see how the performance works out.

[-] [email protected] 2 points 1 week ago

Nice.

Cameras definitely need some more bandwidth. And their presence has a bigger impact on your privacy than the lightswitch. So you might as well do it right.... I agree.

Me and by brother-in-law also each bought one of the 4 packs of cheap smart plugs with power metering. He had 2 fail after some years. But I guess he was just a bit unlucky. In our experience they're pretty reliable overall. And the 2 failed safe(ly). They just stopped switching and didn't burn down. I'm not 100% convinced, I use a more expensive brand one to make my washing machine smart since it draws a lot of power. But I use the cheap ones for everything else.

I -myself- am a bit reluctant towards cameras and smart speakers that listen in to arbitrary things. But that's just personal preference.

[-] [email protected] 1 points 1 week ago

Yeah totally agree with you on the smart speaker and camera bit. My google home mini resides in an upper cabinet in the kitchen. You have to yell in its direction to get it to hear you. We mostly just use it to add items to our shopping list. It also connects to a Bluetooth speaker system (that doesn’t have a mic) to play music through.

The cameras I’m getting are just for the outside of my house and I’m planning on getting the (rtp?) feed off of them and self hosting.

[-] [email protected] 2 points 1 week ago

While trying to set up the WLAN, I couldn't connect to the AP, it said no internet access, and I couldn't connect to the Pi, or ping any device from it.

[-] [email protected] 1 points 1 week ago

Can't you find something like a guide or walktrough? I can't believe you're the first person using a RasPi as an access point...

I mean I would love to help. But it's a bit difficult without seeing the situation. And "I can't connect to anything" isn't exactly detailed enough to lead me to any conclusions. There are a lot of moving parts in a router, the wifi itself, DHCP, routing, firewall, ...

[-] [email protected] 6 points 1 week ago

I honestly think you would be more happy with any hackable (openwrt compatible) router over the pi. The pi is great for many things but for a router is really lacking.

[-] [email protected] 2 points 1 week ago

Maybe, but I my router is not hackable and I don't plan on buying one that is.

[-] [email protected] 1 points 6 days ago

I got a top of the range one from 7 years ago for £25 on eBay.

How much are pis nowadays?

[-] possiblylinux127 3 points 1 week ago

It can be affordable if you go used.

[-] [email protected] 5 points 1 week ago

Toss OpenWRT into the trash and install OPNSense instead.

[-] [email protected] 7 points 1 week ago* (last edited 1 week ago)

Unless something has changed recently, OPNSense doesn't have an ARM build so it won't work on the Pi4.

[-] possiblylinux127 2 points 1 week ago

They are Apples and Oranges

[-] [email protected] 2 points 1 week ago

Agreed, OpenWRT is for something with limited resources like an OTS router.

[-] [email protected] 5 points 1 week ago* (last edited 1 week ago)

If you want to use the PI as a router you'll probably end up with a double NAT situation which isn't ideal but may work well enough. In terms of wifi performance, I wouldn't expect a Pi to be particularly good here so I'm not sure this even worth it unless it's just a budget issue and you don't have any other options.

In terms of your problem, you should be able to assign the Pi ethernet port to the default WAN and WAN6 networks. As for wifi, the Pi adapter needs to have support for AP mode, and looking around it doesn't seem clear if the built in wifi adapter supports that or not (most people using the Pi are using it purely as a router and not a wireless AP). If not, you'd need a USB wifi adapter that supports AP mode. You might want to get that additional ethernet adapter too for testing/debugging and it will allow you to add a dedicated wireless AP.

[-] [email protected] 3 points 1 week ago

If you want to use the PI as a router you'll probably end up with a double NAT situation which isn't ideal

Just don't do NAT on the Pi then...

[-] possiblylinux127 3 points 1 week ago

This a can versus should. You can do this but I would strongly discourage it. I would strongly recommend buying a proper device with Mimo and multiple reasonably sized antennas.

[-] [email protected] 1 points 1 week ago

OK, maybe I will think about some other use for the Raspberry Pi then.

[-] [email protected] 3 points 1 week ago

OpenWRT should have VLAN support out of the gate. Probably has an admin page for it.

Unless you want to go full wireless I would strongly suggest at least one USB ethernet dongle and a cheap managed switch (managed so you can take advangate of VLANs. Unmanaged switches are cheaper if you decide VLANs aren't for you).

[-] [email protected] 2 points 1 week ago

I agree about the USB Ethernet dongle. Unless you only require short distance wifi range (eg hotel room temp router) the radio in the pi isn't going to be enough

I built a pi4 router a few years ago, and it's still running great, I recommend the project. But unfortunately I can't find the HOWTO and it was before I started taking good notes. I assume your current router is a phone company supplied modem/router?

My setup is cable modem-->pi router-->switch--> old netgear router in Access point only mode

Being that your router/modem is upstream of router, I'm not sure if you could pass-through the WAN to the pi router, and pass back the LAN to the router/modem for the wifi... maybe someone on here can shed some light?

[-] [email protected] 2 points 1 week ago

I guess this would be a good starting point for your reading:

https://openwrt.org/docs/guide-user/start

[-] [email protected] 1 points 1 week ago* (last edited 1 week ago)

Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:

Fewer Letters More Letters
AP WiFi Access Point
DHCP Dynamic Host Configuration Protocol, automates assignment of IPs when connecting to a network
IoT Internet of Things for device controllers
MQTT Message Queue Telemetry Transport point-to-point networking
NAS Network-Attached Storage
NAT Network Address Translation

6 acronyms in this thread; the most compressed thread commented on today has 10 acronyms.

[Thread #855 for this sub, first seen 7th Jul 2024, 00:15] [FAQ] [Full list] [Contact] [Source code]

[-] [email protected] 1 points 1 week ago

Chuck made a great video explaining that. If I remember well, he suggested 2 Wi-Fi, one to connect to the hotel Wi-Fi for example and the other to distribute a secure connection to your gears. I guess you can do the 2nd one through the Ethernet port of the Pi: here you go.

[-] [email protected] 0 points 1 week ago

I want the WAN coming in from the router from the Pi’s Ethernet port, and the LAN coming out as Wi-Fi. I may also stick an additional Ethernet adapter to it in the future.

Can you try to explain this a bit more?

this post was submitted on 06 Jul 2024
41 points (97.7% liked)

Selfhosted

37923 readers
463 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS