W. H. Heydt
Posts: 8511
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Router vs. Bridge

Sun Apr 22, 2018 4:56 am

Since the old thread on turning a Pi into a router has been locked, I can't correct some errors that were posted in it.

A "router" is to a "bridge" as a "switch" is to a "hub".

A hub takes any packet it receives and sends it out to all of it's other ports,. A switch checks the address on each packet and sends it to only the port that has the destination address. If the packet doesn't go to any device connected (even indirectly) to one of it's ports, it will be sent to it's uplink port. So...a switch is the "smart" version of a hub. Also note that switches can be connected in cascade. Hubs cannot.

Likewise, a bridge takes any packet that arrives on one of its two ports and sends it out the other port. A switch checks the address on each packet and only sends packets to the other port if the destination is not on network it came from. So...a router is a "smart" bridge.

A router (or bridge) generally has two connections (even in the SOHO market there are "deal-WAN" routers with one local and two WAN ports). Many SOHO routers come with a built-in switch, typically with 4 ports. (I once owned a pre-Cisco Linksys with an 8 port switch.) Many modern routers also include a switch capability to handle wireless connections. SOHO routers also typically provide additional services, the common one being DHCP.

It used to be that switches were very expensive and hubs were--relatively--cheap. These days, it's problaby very difficult to even *find* a hub. You are also very unlikely to actually encounter a bridge.

Now all of that said, one of the features o the typical broadband modem with a built-in router and switch, is the ability to "bridge" the "router". That is just turning off all routing activities and making it a simple pass-through device...a bridge. If a facility has a fixed block (usually a static one), then one can connect a switch to a bridged router, assign the devices static IP addresses, and then you have direct, public routing. The more common arrangement is to bridge the ISP_supplied "router" (really a modem-router-switch) and connect your own router to it. That way, you can have a router under your full control at all times, instead of one that may have hidden "features" that you don't want and can't turn off.

User avatar
rpdom
Posts: 12582
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK

Re: Router vs. Bridge

Sun Apr 22, 2018 5:18 am

W. H. Heydt wrote:
Sun Apr 22, 2018 4:56 am
Now all of that said, one of the features o the typical broadband modem with a built-in router and switch, is the ability to "bridge" the "router". That is just turning off all routing activities and making it a simple pass-through device...a bridge. If a facility has a fixed block (usually a static one), then one can connect a switch to a bridged router, assign the devices static IP addresses, and then you have direct, public routing. The more common arrangement is to bridge the ISP_supplied "router" (really a modem-router-switch) and connect your own router to it. That way, you can have a router under your full control at all times, instead of one that may have hidden "features" that you don't want and can't turn off.
I had to do this recently when my ISP "upgraded" my modem/router/switch for the latest model (due to the old one dropping connection many times a day). The new one had a fixed subnet (192.168.1.0) which would have meant a lot of work to reconfigure all of my systems to use that. So I put the modem into "modem mode" where it just does a straight pass-through of all traffic and bought an external router. Performance isn't as good for some reason, but at least I have control of my internal IP addresses and various other features that were fixed (broken) when running in "router mode".

Heater
Posts: 9337
Joined: Tue Jul 17, 2012 3:02 pm

Re: Router vs. Bridge

Sun Apr 22, 2018 8:21 am

Wikipedia says it well,
A router is a networking device that forwards data packets between computer networks. Routers perform the traffic directing functions on the Internet. A data packet is typically forwarded from one router to another router through the networks that constitute an internetwork until it reaches its destination node.
It was stated in the other thread that a Pi could not be a router. This is clearly not true. It can route packets between networks connected via Ethernet, WiFi, serial (SLIP, PPP), all manner of other connected interfaces. And perform all kind of other functions that routers are expected to perform now a days.

It was stated that the Pi could be a "bridge" between WiFi and ethernet. Which is kind of true but to my mind confuses things with the other meaning of "bridge", as in making two network interfaces appear to be one.

When connecting ethernet to WiFi one can still be doing it as a router, even if there is not much choice in routes, after all there is likely still network address translation going on. And one can choose not to route some traffic.

mikerr
Posts: 2683
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: Router vs. Bridge

Tue Apr 24, 2018 9:31 am

They operate at different layers of the OSI model:

Hubs operate at Physical layer (1) - take in one port, blindly broadcast to all other ports.

Bridge & switch operate at the Data Link layer (2), and see MAC addresses so forward data based on that
No knowledge of IP addresses.

Routers operate at the Network layer (3), so see more information e.g. IP addresses, TCP port etc
and can dynamically vary their actions depending on IP, protocol or port


Many devices can operate as a mixture of them...
Android app - Raspi Card Imager - download and image SD cards - No PC required !

Heater
Posts: 9337
Joined: Tue Jul 17, 2012 3:02 pm

Re: Router vs. Bridge

Tue Apr 24, 2018 9:53 am

That is a good description of the terms.

I think the confusion comes with "bridge".

People think of a WiFi router as a "bridge" between the ethernet world and the wireless world. Which is a reasonable thing to think.

Now I have some Wifi devices that actually do "bridge" their ethernet interface to their WiFi interface. The two interfaces become one. https://wiki.debian.org/BridgeNetworkConnections there is no routing going on.

On the other hand most WiFi routers, even if they only have one ethernet port do not bridge the WiFi interface to the Ethernet. They do actually route between them.

Return to “Off topic discussion”

Who is online

Users browsing this forum: No registered users and 5 guests