Hi Frank.
I'm a bit rusty on this, but perhaps this example will clear it up.
Put four PCs on a four port hub. Each packet sent from a PC will be
"repeated" to all ports. Just like a party line, all will "hear" the
message, but they will ignore the packets not addressed to them. Example:
PC "A" sends a packet addressed to "B". "C" and "D" will see the packet,
but since it's not addressed to them, they will toss it like junk mail.
Since all four machines share a common line, when things get busy, you have
less effective bandwidth available - thus the need for a switch. A switch
is a "smart" hub. It watches traffic on each port and takes note of the
"from" address of packets coming into each port. It learns that "A" on the
first port, "B" is on the second, and so on. Once it knows this, it only
sends packets addressed to "B" to the second port. You _can_ configure some
of the better switches to separate zones (multiple separate networks on a
shared physical hub) and other fun stuff.
A router takes care of the packets for all machines outside the network,
somewhat like the Fed-EX shipping desk. Since WebServer-X in not on the
local network, the PC will take packets addressed for it, and hand them off
to the designated "gateway" (your router, in this case). The gateway is in
charge of taking care of all packets that need to go elsewhere. The router
simply takes the packets and passes them up the line until they get to their
destination. So if packets need to be sent to a local PC, they are
addressed directly. If they need to be sent to a non-local address, they
are sent to the gateway for routing.
Here's how the actual logic works on an IP network: "PC-A" looks up the IP
address to "PC-B". It finds it in the "hosts" file on the local hard drive
(or a local DNS sever), and sends a broadcast message asking for the MAC
(media access control) address - the unique hardware address of every
network device. "PC-B" sees the request and replies with it's MAC address.
"PC-A" builds the packet, marked with the MAC address of "PC-B" and sends
the packet. The switch would see the MAC address of the packet, and sends
it to port #2 (since it has learned that is where packets with that MAC
address come from). "PC-B" receives the packet, sees that it is addressed
to itself and starts unwrapping it. It also sends an ACK (acknowledgement)
packet to the sender.
What about non-local addresses? Well, "www.redhat.com" is not a local
address, so it isn't found in the "hosts" file. So "PC-A" sends a message
to a DNS (Domain Name Server), and asks for the IP address of
www.redhat.com. The DNS server replies with the IP address. "PC-A" looks
at the address and realizes it is non-local (much like you do when you see a
909 area code on a phone number). So it wraps up the packet (a request for
a web page), puts the IP address of www.redhat.com on it, but (here it
comes) puts the MAC address of the "gateway" on it. The router gets it,
checks the IP address and sends it "upstream" to the next (much fancier)
router. Your router has (in this case) four local ports, but only one
upstream port. The fancy router at your ISP has several ports. It looks at
the IP address on your packet and decides which port to send it to. Your
packet hops from router-to-router, getting closer to the web server. At
some point, it makes it to RedHat's gateway, where your packet is assigned
the MAC address of the web server, where it arrives and is read. And
sometimes ignored....<grin>
The ISP's router seems like it is the same as a switch, but a switch
"learns", while a router is set with rules from a routing table. They both
"switch", but the router can make highly controlled decisions about when and
how a packet should be sent. Such a router can have multiple routes to the
same location and make decisions based on speed of response, amount of
traffic, etc. Fancy stuff. Big bucks, too.
So where does a bridge fit in to all this?
Assume we are using hubs instead of switches for now. Lets add a second hub
with another four PCs attached, in another building. We can connect the two
hubs together with a bridge. The bridge know that the "left" network has
addresses starting with 192.168.0 and the "right" network has addresses
starting with 192.168.1
When PC-A (on the "left" network) broadcasts a packet to a PC on the
"Right" network, the bridge will repeat the packet on the "Right" network,
so PC-B can see it. Why not just put them all on the same network? Imagine
you have 200 PCs and 20 are running CAD, 54" printers and some 36" color
scanners in the mapping department. Those 20 PCs, printers and scanner are
rather "chatty" and will consume most of the bandwidth. But if you separate
them from the other PCs with a bridge, all the local traffic stays in the
mapping department. Much nicer for the guys in the marketing department
playing Doom3.
Now, if you are thinking that this bridge is somewhat like a router, and
somewhat like a switch, you've caught on rather well. Today, the lines
between switches, bridges and routers have become blurred. It's more a
matter of small details of what the device is intended for. Just like a nut
vs. lug nut. They are both nuts, but a lug nut is used for holding on
wheels of a car. A nut is general purpose.
A switch routes packets among a local network. A bridge connects two or
more local networks, and a "Router" routes packets between a lower network
to a higher level network.
There will be a test....
P.S. Bob Foxworth is far more knowledgeable about this than I. I hope he
jumps in.
It's late, I'm tired and I'm sure I've missed a detail or made several
errerszzzz.....
Ken Elliott
=====================
-----Original Message-----
From: slug@nks.net [mailto:slug@nks.net] On Behalf Of SOTL
Sent: Wednesday, January 12, 2005 8:07 PM
To: SLUG
Subject: [SLUG] Hub, Switch, & Router
Hi All
Laying on the couch thinking about this I believe that the following is
correct:
Lets assume a device with one what we shall call a line connection and 5
output connection. This device will be a:
Hub
Non configurable
If all packages into any one port go to all other ports.
Switch
Non configurable
If an input package only goes to the port that contains the device that the
package is directed to. Can not figure this one out how the switch knows to
sent a package inputed to A to output B instead of C and what happens if you
need it to also go to D?
Router
If you configure the device such that that a package in A go to which ever
combination of ports you choose for outputs. By this one could configure all
e-mail to go to ports A & B AFN to no other port, all html to port C and
reject all other packages. You can configure this as you want.
Frank
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages posted
are those of the author and do not necessarily reflect the official policy
or position of NKS or any of its employees.
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.
This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:14:59 EDT