Author Topic: Use Raspberry pi as router.  (Read 18235 times)

0 Members and 1 Guest are viewing this topic.

Offline yash101

  • Contributor
  • Posts: 48
  • Country: us
  • Sup there!
    • My Land
Re: Use Raspberry pi as router.
« Reply #25 on: May 02, 2015, 06:11:17 am »
Routers are designed to, well, route. They have really powerful DSPs, something that is just absent on the Pi. Being a long time low-level programmer, I know that it is a BAD idea to perform continuous loads such as signal processing on the applications processor. In an ideal condition, you would have some sort of FPGA or similar device controlling the network. The CPU would really just be a front end.

This is the main reason why every computer has a GPU. Surely, you can render on your CPU but it is horribly inefficient, unreliable and just a bad idea.

I'm sure that some microcontrollers with built-in DSP hardware might be able to beat the RasPi in performance in continuous signal processing loads, like voice recognition. Of course, I've never used one of these chips so I'm no expert.

Basically, avoid the CPU whenever possible. It's so general purpose that it's slow. While an FPGA can be similar, the way how it works makes it ideal for the workload. FPGAs can typically take a continuous load with a high efficiency and high stability. A 10MHz FPGA would probably beat a RasPi for a router.
 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5405
  • Country: gb
Re: Use Raspberry pi as router.
« Reply #26 on: May 02, 2015, 06:35:18 am »
Routers are designed to, well, route. They have really powerful DSPs, something that is just absent on the Pi. Being a long time low-level programmer, I know that it is a BAD idea to perform continuous loads such as signal processing on the applications processor. In an ideal condition, you would have some sort of FPGA or similar device controlling the network. The CPU would really just be a front end.

Not sure how a DSP would particularly help in routing? DSPs are for signal processing close to the analogue domain, not for shifting around and filtering packets of data.
 

Offline rolfe

  • Newbie
  • Posts: 6
  • Country: au
  • "This is me"
Re: Use Raspberry pi as router.
« Reply #27 on: May 02, 2015, 06:49:47 am »
If you want to roll your own home firewall/router on a Pi-like device, you might consider using a Banana Pi:

http://www.bananapi.com/index.php/component/content/article?layout=edit&id=59

It's got 4 LAN + 1 WAN port, driven by a dedicated BCM53125 ethernet switch, plus support for WiFi. It runs a variation of Raspbian (naturally called Bananian), so if you are familiar with a Pi there'll be no surprises.

I prefer to use iptables directly for setting up a firewall, so this was a good match for me.

Rolfe
 

Offline smjcuk

  • Frequent Contributor
  • **
  • Posts: 464
  • Country: gb
Re: Use Raspberry pi as router.
« Reply #28 on: May 02, 2015, 09:52:22 am »
I used to use this method extensively to simulate WAN latency using FreeBSD and Dummynet for perf testing those crappy applications some high-level software-only guys often write without considering such things as application turning.

Sounds like you work where I do. Sure we can shift 2mbytes of JavaScript to 50 people on IE8 running on an overloaded Citrix box...ugh.
 

Offline eldon

  • Newbie
  • Posts: 5
Re: Use Raspberry pi as router.
« Reply #29 on: May 02, 2015, 10:08:40 am »
If you want to roll your own home firewall/router on a Pi-like device, you might consider using a Banana Pi:

quite interesting i missed that version of bananapi, still a bit on the higher prices end, but plenty of hardware to play with.

i've been using a similar A20 based board (cpu/sata wise only), Pcduino 3 nano : http://www.linksprite.com/?page_id=815
Not for routing purposes, mostly nas / nzb / torrent box.

- a few comments :

the A20 cpu is not very powerful either, compared to RPI's cpu.

For example on my pcduino, i use vpn for my torrent client and the cpu load can go pretty high with heavy network loads.
At some point it will cap the vpn speed (around 100Mpbs).

That board doesn't have a dedicated network chip, only a transceiver chip, and the A20 "Gigabit" ethernet actually only goes up to 400-500Mbps (does it also use an internal usb link?)..

I don't know if it's used at all on that Bananapi board but then it would probably face the same speed limitation.

I have also had some sata problems on my A20 board, i'm not sure it's a A20 hardware bug or a bad design of the pcduino board but i wouldn't call the sata part "stable"..

I must say i'm not a big fan of the A20, there are much more powerful arm chips available now, it will be fine for basic routing and "home" lan services (nas, low speed usenet/torrent).

But if you plan on getting the full gigabit out of it, especially to/from its sata hdd, i'm not sure you'll be satisfied with the end result.


Well for strictly simple limited network projects, i've used several of those boards Gl.INET (basically an upgraded TL-WR703N) with openwrt and they work fine, of course no cpu power whatsoever, no "out of the box wan" feature but can be implemented with iptables.
http://www.dx.com/nl/p/gl-inet-6416a-micro-usb-powered-smart-router-w-16m-rom-white-335418


 

Offline Cliff Matthews

  • Supporter
  • ****
  • Posts: 1911
  • Country: ca
    • General Repair and Support
Re: Use Raspberry pi as router.
« Reply #30 on: May 02, 2015, 11:53:56 am »
Routers are designed to, well, route. They have really powerful DSPs, something that is just absent on the Pi. Being a long time low-level programmer, I know that it is a BAD idea to perform continuous loads such as signal processing on the applications processor. In an ideal condition, you would have some sort of FPGA or similar device controlling the network. The CPU would really just be a front end.

This is the main reason why every computer has a GPU. Surely, you can render on your CPU but it is horribly inefficient, unreliable and just a bad idea.

I'm sure that some microcontrollers with built-in DSP hardware might be able to beat the RasPi in performance in continuous signal processing loads, like voice recognition. Of course, I've never used one of these chips so I'm no expert.

Basically, avoid the CPU whenever possible. It's so general purpose that it's slow. While an FPGA can be similar, the way how it works makes it ideal for the workload. FPGAs can typically take a continuous load with a high efficiency and high stability. A 10MHz FPGA would probably beat a RasPi for a router.
I think you were referring to ASIC's not Digital Signal Processors (eg: used in DSL modems and voice/video devices).
ASIC's haven't had much use in entry-level routers for many years.
 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5405
  • Country: gb
Re: Use Raspberry pi as router.
« Reply #31 on: May 02, 2015, 01:05:32 pm »
I used to use this method extensively to simulate WAN latency using FreeBSD and Dummynet for perf testing those crappy applications some high-level software-only guys often write without considering such things as application turning.

Sounds like you work where I do. Sure we can shift 2mbytes of JavaScript to 50 people on IE8 running on an overloaded Citrix box...ugh.

That sort of thing was my main work until a few years ago when I switched back into doing electronics mostly.
 

Offline GoneTomorrow

  • Regular Contributor
  • *
  • Posts: 125
  • Country: nz
Re: Use Raspberry pi as router.
« Reply #32 on: May 02, 2015, 01:42:51 pm »
A first gen Pi will be a horrid router. There's no way you'll be able to route anywhere close to 30Mbit/s, especially at smaller packet sizes.

 

Online amyk

  • Super Contributor
  • ***
  • Posts: 8399
Re: Use Raspberry pi as router.
« Reply #33 on: May 02, 2015, 02:08:49 pm »
That board doesn't have a dedicated network chip, only a transceiver chip, and the A20 "Gigabit" ethernet actually only goes up to 400-500Mbps (does it also use an internal usb link?)..
It's integrated into the SoC and memory-mapped onto the CPU (AMBA) bus, which means that it is theoretically the best you can get for general-purpose CPU-based routing.
 

Offline codeboy2k

  • Super Contributor
  • ***
  • Posts: 1836
  • Country: ca
Re: Use Raspberry pi as router.
« Reply #34 on: May 02, 2015, 02:21:27 pm »
The answer is yes, it can be done, but NO! the Pi will not make a good router. Just use a dedicated router as a router.. don't buy a fanless $99 motherboard, good God !

These days, everyone is throwing away routers, you can have them from your local used-sales board (i.e. craigslist) for about $10.
« Last Edit: May 02, 2015, 02:27:49 pm by codeboy2k »
 

Offline sam1275Topic starter

  • Frequent Contributor
  • **
  • Posts: 401
  • Country: us
Re: Use Raspberry pi as router.
« Reply #35 on: May 02, 2015, 02:31:28 pm »
Thank you everyone!
I just picked up a dedicated router.
 

Offline eas

  • Frequent Contributor
  • **
  • Posts: 601
  • Country: us
    • Tech Obsessed
Re: Use Raspberry pi as router.
« Reply #36 on: May 03, 2015, 01:07:29 am »
Routers are designed to, well, route. They have really powerful DSPs, something that is just absent on the Pi. Being a long time low-level programmer, I know that it is a BAD idea to perform continuous loads such as signal processing on the applications processor. In an ideal condition, you would have some sort of FPGA or similar device controlling the network. The CPU would really just be a front end.

This is the main reason why every computer has a GPU. Surely, you can render on your CPU but it is horribly inefficient, unreliable and just a bad idea.

I'm sure that some microcontrollers with built-in DSP hardware might be able to beat the RasPi in performance in continuous signal processing loads, like voice recognition. Of course, I've never used one of these chips so I'm no expert.

Basically, avoid the CPU whenever possible. It's so general purpose that it's slow. While an FPGA can be similar, the way how it works makes it ideal for the workload. FPGAs can typically take a continuous load with a high efficiency and high stability. A 10MHz FPGA would probably beat a RasPi for a router.

Purpose-built network devices these days have ASICs, is that what you mean? DSPs, I doubt, FPGAs, maybe but power consumption will be worse than an ASIC.

Many, if not most SOHO routers in the last 10 years have an ASIC for the LAN ports that includes switching functionality. Newer 802.11ac SOHO routers probably have hardware accelerated routing too (unfortunately not supported in open source firmwares, last I checked). Without the routing hardware, a router like the WNDR3700 can do maybe ~350Mbps. Not great, but not bad for a ~700MHz MIPS CPU. Of course, even though it lacks hardware routing acceleration, it does have two gigabit MACs on the chip.
 

Offline eas

  • Frequent Contributor
  • **
  • Posts: 601
  • Country: us
    • Tech Obsessed
Re: Use Raspberry pi as router.
« Reply #37 on: May 03, 2015, 01:32:42 am »
That board doesn't have a dedicated network chip, only a transceiver chip, and the A20 "Gigabit" ethernet actually only goes up to 400-500Mbps (does it also use an internal usb link?)..
It's integrated into the SoC and memory-mapped onto the CPU (AMBA) bus, which means that it is theoretically the best you can get for general-purpose CPU-based routing.

I don't know about the A20, but the designers of the iMX6 made some decisions that limit its GigE throughput to ~470Mbps. So, integration into the SoC using a high-speed interconnect isn't a guarantee.
 

Offline Cliff Matthews

  • Supporter
  • ****
  • Posts: 1911
  • Country: ca
    • General Repair and Support
Re: Use Raspberry pi as router.
« Reply #38 on: May 03, 2015, 10:06:01 am »
I wouldn't call the 4+1 port switch chip an ASIC, I'd consider it more like a peripheral device (way back in school we never thought a 6850 or 6821 was an ASIC).
 

Offline matts-uk

  • Contributor
  • Posts: 46
  • Country: gb
  • select * from user where clue = null
Re: Use Raspberry pi as router.
« Reply #39 on: May 03, 2015, 03:19:40 pm »
To be a pedant about this, technically you can route wirhout VLANs over a single interface,
If you want to be a pedant, I am not so sure you can.  A VLAN is an L2 switching operation.  Dummynet is an L7 application.  Neither is routing, because 'routing' is an L3 operation.

Logically speaking a 'router' operates at L3, forwarding packets from one broadcast domain to another.  Electrically speaking at L1, a broadcast domain is synonymous with a coax segment.    The advent of UTP saw the broadcast domain collapsed into hubs at L1 and eventually virtualised, with the emergence of L2 and L3 switching.

When NAT came along, it convinced me not to be a pedant ;)
 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5405
  • Country: gb
Re: Use Raspberry pi as router.
« Reply #40 on: May 03, 2015, 10:46:02 pm »
To be a pedant about this, technically you can route wirhout VLANs over a single interface,
If you want to be a pedant, I am not so sure you can.  A VLAN is an L2 switching operation.  Dummynet is an L7 application.  Neither is routing, because 'routing' is an L3 operation.

Logically speaking a 'router' operates at L3, forwarding packets from one broadcast domain to another.  Electrically speaking at L1, a broadcast domain is synonymous with a coax segment.    The advent of UTP saw the broadcast domain collapsed into hubs at L1 and eventually virtualised, with the emergence of L2 and L3 switching.

When NAT came along, it convinced me not to be a pedant ;)

You absolutely can route through a single interface without VLANs. I am not recommending it unless you know what you are doing and know the limitations and what you're trying to achieve. Ten or fifteen years ago it was a fairly common practice.
 

Offline matts-uk

  • Contributor
  • Posts: 46
  • Country: gb
  • select * from user where clue = null
Re: Use Raspberry pi as router.
« Reply #41 on: May 04, 2015, 09:16:24 am »
To be a pedant about this, technically you can route wirhout VLANs over a single interface,
Logically speaking a 'router' operates at L3, forwarding packets from one broadcast domain to another.  Electrically speaking at L1, a broadcast domain is synonymous with a coax segment.

You absolutely can route through a single interface without VLANs.
Note my use of quote marks and remember, you wanted to be pedantic. 

What I am saying is, the term 'routing' refers very specifically, to the forwarding of packets between (what were) electrically separated broadcast domains, carried out logically at Layer 3. 

Retransmission on a single interface may have the appearance of routing but it can not be 'routing.'  Because the term 'routing' infers moving packets between multiple interfaces.

Quote
Ten or fifteen years ago it was a fairly common practice.
I've worked in data networking a little longer than that.  The terminology started to get bastardised ~Y2K, when the need to have formal qualifications before being let anywhere near the comms rack, went into decline.
 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5405
  • Country: gb
Re: Use Raspberry pi as router.
« Reply #42 on: May 04, 2015, 10:24:02 am »
This is probably not going to get us very far, to me routing is the movement of traffic between two networks. The broadcast domain is indeed a problem on a single interface, that is why I mentioned the DHCP problem that would typically occur in the OP's use case, but I wouldn't use segregated broadcast domains as a definition for a router function.

If those networks happen to be on the same physical interface, then so be it, but you can still move traffic between two networks on that single interface.

If your definition is that a router has to have separate broadcast domains on each interface then we'll have to agree to disagree, but this is detail and is not going to help the OP, and neither of us recommend routing (or should I say movement of traffic) over a single interface anyway.

Regarding Y2K I agree that there were an awful lot of people jumping on the bandwagon at that time. Management mentality was to throw people at the problem, but I guess they never read about the mythical man month. Some of those people had done only a six week computer course and were contracting on outrageous money. I would regularly get people thrown at me, but to get an individual adding any value would take weeks of my time when I wouldn't be getting on with the job at hand, all very depressing it was too.
 

Offline yash101

  • Contributor
  • Posts: 48
  • Country: us
  • Sup there!
    • My Land
Re: Use Raspberry pi as router.
« Reply #43 on: May 04, 2015, 02:35:26 pm »
Routers are designed to, well, route. They have really powerful DSPs, something that is just absent on the Pi. Being a long time low-level programmer, I know that it is a BAD idea to perform continuous loads such as signal processing on the applications processor. In an ideal condition, you would have some sort of FPGA or similar device controlling the network. The CPU would really just be a front end.

This is the main reason why every computer has a GPU. Surely, you can render on your CPU but it is horribly inefficient, unreliable and just a bad idea.

I'm sure that some microcontrollers with built-in DSP hardware might be able to beat the RasPi in performance in continuous signal processing loads, like voice recognition. Of course, I've never used one of these chips so I'm no expert.

Basically, avoid the CPU whenever possible. It's so general purpose that it's slow. While an FPGA can be similar, the way how it works makes it ideal for the workload. FPGAs can typically take a continuous load with a high efficiency and high stability. A 10MHz FPGA would probably beat a RasPi for a router.

Purpose-built network devices these days have ASICs, is that what you mean? DSPs, I doubt, FPGAs, maybe but power consumption will be worse than an ASIC.

Many, if not most SOHO routers in the last 10 years have an ASIC for the LAN ports that includes switching functionality. Newer 802.11ac SOHO routers probably have hardware accelerated routing too (unfortunately not supported in open source firmwares, last I checked). Without the routing hardware, a router like the WNDR3700 can do maybe ~350Mbps. Not great, but not bad for a ~700MHz MIPS CPU. Of course, even though it lacks hardware routing acceleration, it does have two gigabit MACs on the chip.

I'm sure that's correct! The last router I took apart was a really old and really crappy DLink. It had a handful of ASICs as well as some sort of MIPS/ARM processor. I was 7 when I took it apart so I don't remember all the details.
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 8134
  • Country: de
  • A qualified hobbyist ;)
Re: Use Raspberry pi as router.
« Reply #44 on: May 04, 2015, 03:39:57 pm »
Many, if not most SOHO routers in the last 10 years have an ASIC for the LAN ports that includes switching functionality. Newer 802.11ac SOHO routers probably have hardware accelerated routing too (unfortunately not supported in open source firmwares, last I checked). Without the routing hardware, a router like the WNDR3700 can do maybe ~350Mbps. Not great, but not bad for a ~700MHz MIPS CPU. Of course, even though it lacks hardware routing acceleration, it does have two gigabit MACs on the chip.

I'm sure that's correct! The last router I took apart was a really old and really crappy DLink. It had a handful of ASICs as well as some sort of MIPS/ARM processor. I was 7 when I took it apart so I don't remember all the details.

There are two basic designs regarding the ethernet ports. If the CPU supports just a single ethernet the firmware puts LAN and WAN into two VLANs and the ethernet switch chip provides 4 LAN ports plus 1 WAN port. Since all routed traffic has to pass the single ethernet link between CPU and switch chip twice, it's a bottleneck. The other case is a CPU with two ethernet links, one for WAN and the second one for the LAN ports, i.e. switch chip. If the CPU has any hardware acceleration built in, it's mostly just for NAT. From the numbers I've seen, hardware NAT gives you about 2 times the throughput.
 

Offline Cliff Matthews

  • Supporter
  • ****
  • Posts: 1911
  • Country: ca
    • General Repair and Support
Re: Use Raspberry pi as router.
« Reply #45 on: May 04, 2015, 04:37:04 pm »
There's a general rule: if a part can be looked-up, it's not an ASIC it's likely an ASSP. (maybe things have changed... I can't keep up)  http://www.eetimes.com/author.asp?section_id=36&doc_id=1322856 Here's a good ASSP candidate, a 5-port switch with phy interface: https://www.broadcom.com/products/BCM5385
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf