dygraspi
Posts: 2
Joined: Sun May 29, 2016 4:17 pm

Raspberry pi2 as a wired router

Sun May 29, 2016 4:25 pm

Hi all

I would like to make an wired router using raspberry pi2 like adsl modem router.
and nas

Could you please advice me concerning how can I do

Best regards

epoch1970
Posts: 5132
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Raspberry pi2 as a wired router

Sun May 29, 2016 8:02 pm

What will you do for the DSL part? Is there a box called a "modem" or a "bridge" that handles the connection to your ISP?

If the answer is yes, then I think it's a pretty easy deal, and I've located a few posts about this. Do search the forum.
If the answer is no and you want to replace completely the ISP modem and plug a telephone line into the Pi, I don't know if it has been attempted/documented but it sure looks like a project ;)
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

dygraspi
Posts: 2
Joined: Sun May 29, 2016 4:17 pm

Re: Raspberry pi2 as a wired router

Sun May 29, 2016 9:07 pm

I would like to do just bridge/router .
I will connect my raspberry pi2 to exist dsl modem

Thanks for your answer

User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: Raspberry pi2 as a wired router

Sun May 29, 2016 9:51 pm

dygraspi wrote:I would like to do just bridge/router .
I will connect my raspberry pi2 to exist dsl modem

Thanks for your answer
It can't be used as a wired router, because it only has one NIC.

... it can be used as a wifi bridge to wired network though... works great !
marcus
:ugeek:

epoch1970
Posts: 5132
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Raspberry pi2 as a wired router

Mon May 30, 2016 9:54 am

It is easy and cheap to get 2 or more interfaces on a Pi, even a Pi 2:
- get a usb-ethernet adapter (usb3-gigabit works fine, usb2-fast ethernet is cheaper and slower)
- or use a wifi interface (not a very good idea for a router, wifi is flakey)
- or define a Virtual Lan ("VLAN", wikipedia page) on eth0 and add either a "normal" switch or a "manageable" gigabit switch. A "normal" switch if the connected devices are modern/sophisticated enough and know how to use a VLAN. A manageable switch allows you to dedicate physical ports to a specific VLANs, you need that to connect devices that don't know what to do with a VLAN.

Best case (cost ~zero): your router box allows to add a VLAN interface to its physical port.
Define VLAN 12 (choose your ID between 2 and 4096) on the Pi, that'll give you a new interface "eth0.12". Set it to DHCP.
In the router, associate VLAN 12 to the ethernet port of the box.
On the Pi, set eth0 (the no-VLAN interface) to a static IP on another network than eth0.12. Add forwarding, NAT and filtering between eth0.12 and eth0
Get any old 5 port switch, no need here for a "manageable" one, 3 to 5 ethernet cables, and connect:
- box to the switch
- Pi to the switch
- PCs and stuff to the switch
Now the no-VLAN network will be the LAN zone, and the VLAN 12 network, with just the Pi and the box, will be the Internet zone. The Pi will do routing/filtering between the 2 just as if 2 cables were connected.

Of course, the Pi is *not* a very powerful router. Its ethernet interface goes at 100Mbps or so, there is quite a chance you won't filter/route much faster than 50Mbps once you've added rules and all. However this is still way superior to the bandwidth offered by a common DSL link, so it's perfectly fine. Within the LAN area, the performance will be guided by the switch characteristics. Gigabit switch recommended.

Cost: assuming you can't find someone to give you an old switch, or that old usb ethernet adapter bought for the now defunct macbook air ... an extra USB interface will run about ~10-15€. A manageable switch would be more expensive (~20-40€), but you get more ports; It's a bit bulky but switch+VLAN is the solution with most potential for expansion. Up to 4096 networks, imagine that :)
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

Return to “Advanced users”