# Could I use FreeBSD instead of OpenWRT?



## poorandunlucky (Nov 23, 2017)

Stupid question...

I have OpenWRT on a E4200 and EA4500 Linksys devices (1.7 GHz, 128 MB RAM, I think 2 x 32 GB NVRAM [dual-firmware failsafe])...

Could I install FreeBSD or TinyBSD on there?

I'm just having a problem with OpenWRT and I'm wondering if it's not worth flashing it with something else...


----------



## Beeblebrox (Nov 23, 2017)

One of the differences between those devices, mobile phones and other small units vs a "normal computer" is the concept of System On Chip (SOC) and Flash ROM. Flash ROMs are usually very limited in storage size and the whole design is what makes such devices both cheap and low power consumers. The flip side is that unlike normal computers, the image flashed to the device ROM must be tailor-made for that specific device in a manner that will fit in the ROM capacity of the device. (I'll leave it to you to look up SOC, embedded systems & ROM Flashing).

To answer your question, you would be extremely ill-advised to attempt a flash to an SOC device any OS designed for a computer. You would have to a) compile the OS for that specific chipset (arm for example) and b) figure out all the drivers needed to packaged c) create a raw disk image offset so as not to over write the device bootloader or provide a compatible bootloader in the image file.

OpenWRT is a bit complicated at first, but you just have to play around as with any software. I found the firewall the most unpleasent, but not much other choice out there. There is the FreeBSD Open Router project (https://bsdrp.net/) but has a limited number of flashable devices in inventory as I recall. Other open projects exists, you'll just have to search for the one that best suits you.


----------



## ronaldlees (Nov 23, 2017)

According to Linksys site, both the EA4200 and EA4500 v1,v2 routers used the Marvell Feroceon 88F6282 1.2 GHz processor (actually, an SoC).  The EA4500 v3 uses a Qualcom QCA9558 720 MHz processor.

According to the Wiki (below), FreeBSD runs on the Marvell 88F6281 processor:

https://wiki.freebsd.org/FreeBSDMarvell

So, the processor models seem very closely related, but I don't know whether or not they're close enough to do the job.  That 1.2 GHz ain't bad.  I didn't know the Linksys were that fast. As BeebleBrox mentions, the SoC is just one part of the apparatus. I wouldn't flash it unless someone else had paved the way on the exact same device ...


----------



## rigoletto@ (Nov 23, 2017)

Apparently, you can get FreeBSD is some Ubiquiti and Mikrotik hardware. Those are the only ones I "heard" about.

EDIT: MIPS.


----------



## poorandunlucky (Nov 23, 2017)

Beeblebrox said:


> One of the differences between those devices, mobile phones and other small units vs a "normal computer" is the concept of System On Chip (SOC) and Flash ROM. Flash ROMs are usually very limited in storage size and the whole design is what makes such devices both cheap and low power consumers. The flip side is that unlike normal computers, the image flashed to the device ROM must be tailor-made for that specific device in a manner that will fit in the ROM capacity of the device. (I'll leave it to you to look up SOC, embedded systems & ROM Flashing).
> 
> To answer your question, you would be extremely ill-advised to attempt a flash to an SOC device any OS designed for a computer. You would have to a) compile the OS for that specific chipset (arm for example) and b) figure out all the drivers needed to packaged c) create a raw disk image offset so as not to over write the device bootloader or provide a compatible bootloader in the image file.
> 
> OpenWRT is a bit complicated at first, but you just have to play around as with any software. I found the firewall the most unpleasent, but not much other choice out there. There is the FreeBSD Open Router project (https://bsdrp.net/) but has a limited number of flashable devices in inventory as I recall. Other open projects exists, you'll just have to search for the one that best suits you.



Thanks for the link, will check it out...



lebarondemerde said:


> Apparently, you can get FreeBSD is some Ubiquiti and Mikrotik hardware. Those are the only ones I "heard" about.
> 
> EDIT: MIPS.



Well, I know it's not an awesome idea, and I'm familiar with OpenWRT, it's just that opkg has an error and causes segmentation faults... I can't update it!  I have to flash the firmware instead of just upgrading the base package this time...  I figured maybe I could harmonize my ... that IT word that means the various OSes that run in your infrastructure... it's kind of a zoo-related term... harmonize my...  make everything FreeBSD...  : \

And just so you guys know exactly what's what, my two devices are the following:

Both are 1.2 GHz with 128 MB of RAM and Flash

E4200 v1: MIPS32/74K - Broadcom 4718
EA4500 v1: Marvell Feroceon 88F6282 - Kirkwood

The EA4500 actually has the stock Linksys firmware on it since the 5 GHz chipset wasn't supported when I first installed it, but looks like it's supported now...

The E4200 has Bind running on it, and sometimes NGINX...  It's mostly a DNS server, doesn't do any routing...  I don't really need to update it, but it kinda bothers me that opkg causes segfaults...  : \

I'm just gonna flash it with OpenWRT... not ready for this...

Although, do you guys know how one could go about building their own router?

Would one need four ethernet cards?

Would it be worth it?


----------



## rigoletto@ (Nov 23, 2017)

I am not too familiar with *WRT but when I wanted a cheap full featured home router I got a Mikrotik hAP ac lite, and I do not regret. I just find the firewall very confusing...

There is a DEMO of their OS just in case you are interested.


----------



## poorandunlucky (Nov 23, 2017)

lebarondemerde said:


> I am not too familiar with *WRT but when I wanted a cheap full featured home router I got a Mikrotik hAP ac lite, and I do not regret. I just find the firewall very confusing...
> 
> There is a DEMO of their OS just in case you are interested.



The next router I'm going to get is the Asus GT-AC5300 or the slightly less awesome RT-AC5300...  That's for sure...  Next time I bother with a router, that's what I'm getting...  Even if I need something else, I want at least one of those for fun.


----------



## tingo (Nov 23, 2017)

FWIW, OpenWRT works great (as long as you are using LEDE) on the devices that are supported and working. At my local makerspace we did run into a TP-Link model where they changed the hardware without changing the hardware version / revision of their unit; not a OpenWRT / LEDE problem. Luckily LEDE brings out new releases quite fast (as compared to OpenWRT at least).


----------



## sidetone (Nov 23, 2017)

https://www.freebsd.org/projects/newbies.html

https://distrowatch.com/search.php?...uage=All&defaultinit=All&status=Active#simple

From that, there are 3 BSD router projects: pfsense, OPNsense, BSDRP

As the responses above, I don't know how well (or if) those would work.

....


poorandunlucky said:


> Would one need four ethernet cards?


Use 1 or 2 ethernet cards (or ports), and an Internet switch (acts like a router) behind your firewall/computer router.


----------



## poorandunlucky (Nov 23, 2017)

sidetone said:


> https://www.freebsd.org/projects/newbies.html
> 
> https://distrowatch.com/search.php?...uage=All&defaultinit=All&status=Active#simple
> 
> ...



Do you think a full computer and a switch would be faster than a purpose-made router?

I think maybe a PowerPC machine or a SPARC machine would, but I think a amd64 or i686 CPU and motherboard would be a bit slower than an ARM router...


----------



## sidetone (Nov 23, 2017)

poorandunlucky said:


> Do you think a full computer and a switch would be faster than a purpose-made router?
> 
> I think maybe a PowerPC machine or a SPARC machine would, but I think a amd64 or i686 CPU and motherboard would be a bit slower than an ARM router...



If the specified bandwidth of the switch is the amount you need. A full custom purpose PC router with a switch (of required/wanted bandwidth) behind it, I imagine would be similar to the full-purpose made PC router without the standalone switch. The reason for the switch behind the router and firewall was lower price and more configurability than additional ethernet cards/ports for getting the same performance. It depends on the software configuration you can get for your custom build router for it to behave like a typical switch.

For the labeled bandwidth of the device, switches are faster than standalone routers. They send packets directly to the intended destination, instead of all destinations. That alone reduces clog, and helps security (granted it's behind a firewall with trusted devices) by not sending packets to where they're not wanted.

They weren't in much use in the past before because of prices. If the switch is up to your specifications, then it will be fast enough, in conjunction behind your computer based router/firewall. Per $ spent, it will be faster, just as good, and even more practical.

If every single device on that network needs to be firewalled from its own network, or is on an untrusted network, then go with a full PC customized router with that many ethernet ports.


----------



## Phishfry (Nov 23, 2017)

poorandunlucky said:


> Do you think a full computer and a switch would be faster than a purpose-made router?


No routers run from an ASIC. This is custom silicone to maximize packet flow.

https://networkengineering.stackexc...sics-vs-x86-general-purpose-routing-switching


----------



## Phishfry (Nov 23, 2017)

I use x86 hardware for my pfSense box and my wireless router.
Being a pfSense user I bought bunches of cheap off lease firewalls. I put pfSense on most and sent them back out the door.
I specialize in shelf sized units used in small medium sized businesses.

My Checkpoint U5 which I use as my Access Point behind pfSense has a measly 600mhz CeleronM ULV drawing 7W.
It has 4 Gigabit Intel interfaces and a MiniPCI slot. I use a Mikrotic RB52hn wireless card.
This rig is old but works well. I ran it as a pfSense WAP on it before I figured out how to use HostAPD on FreeBSD.
There are some caviets as the wifi card can only do 2.4 or 5ghz. Not both simultaneously like your common WAP does.

The control is nice and being able to upgrade it whenever a new FreeBSD comes out versus vendor lock-in and EOL crapola.


----------



## Phishfry (Nov 23, 2017)

Another big caveat is wireless speed. FreeBSD wireless speed on hostapd is not great.
Not terrible but if you are the benchmarking type it will disappoint you.(I get around 7 Megabyte/sec)
Especially compared to a 50 dollar off the shelf WAP with 802.11AC.
FreeBSD only supports 802.11N although that may change soon.


----------



## rigoletto@ (Nov 23, 2017)

poorandunlucky said:


> Do you think a full computer and a switch would be faster than a purpose-made router?
> 
> I think maybe a PowerPC machine or a SPARC machine would, but I think a amd64 or i686 CPU and motherboard would be a bit slower than an ARM router...



Its rather depends of the computer and router being compared.

Assuming a average modern computer, when comparing to those consumer level routers I would rather go to a small PC. If we are a talking about proper made enterprise level routers, that is another story...


----------



## balanga (Nov 23, 2017)

Beeblebrox said:


> One of the differences between those devices, mobile phones and other small units vs a "normal computer" is the concept of System On Chip (SOC) and Flash ROM. Flash ROMs are usually very limited in storage size and the whole design is what makes such devices both cheap and low power consumers. The flip side is that unlike normal computers, the image flashed to the device ROM must be tailor-made for that specific device in a manner that will fit in the ROM capacity of the device. (I'll leave it to you to look up SOC, embedded systems & ROM Flashing).
> 
> To answer your question, you would be extremely ill-advised to attempt a flash to an SOC device any OS designed for a computer. You would have to a) compile the OS for that specific chipset (arm for example) and b) figure out all the drivers needed to packaged c) create a raw disk image offset so as not to over write the device bootloader or provide a compatible bootloader in the image file.
> 
> OpenWRT is a bit complicated at first, but you just have to play around as with any software. I found the firewall the most unpleasent, but not much other choice out there. There is the FreeBSD Open Router project (https://bsdrp.net/) but has a limited number of flashable devices in inventory as I recall. Other open projects exists, you'll just have to search for the one that best suits you.



I bought a TP-Link TL-WDR3600 N600 recently, on which I installed OpenWRT, but even though there is a support page for installing FreeBSD on this router, I couldn't figure out how to do it.


----------

