• We should now be fully online following an overnight outage. Apologies for any inconvenience, we do not expect there to be any further issues.

simple question about switches

DeadSeaSquirrels

Senior member
Jul 30, 2001
515
0
0
I've read a million things about the differences between a hub, switch, and router, and I'm still a bit confused...maybe because of it.

But I just wanted to ask one thing...if I used a switch, does that mean I still need as many static IP's (or maybe even dynamic IPs) as I have computers? Is the router the only thing that will allow me to use one IP on the WAN side and multiple IPs on the LAN side? If so it sounds like the switch basically divies out packets to the appropriate computers on the LAN side, if the ISP gives you multiple IPs, where as the router is doing what used to be the ISPs job, of creating multiple IPs and also the switching part.

So a router is like a switch (with some other firewall, and port forwarding abilities) and also a DHCP server. Whereas the switch lacks that DHCP server aspect and needs to ISP to do that part.

On the LAN side it seems then that a switch or router behaves the same...since on the LAN side all the IPs on the computer are different for both setups. But when you try to communicate WAN->LAN or LAN->WAN the router is doing some masking of what's behind it, whereas the switch just passes the requests as it sees it. Please somebody correct me, or confirm some of the things I'm saying.
 

Tallgeese

Diamond Member
Feb 26, 2001
5,775
1
0
Here's the best way to understand the difference between a hub, a switch (also a bridge), and a router.

In data networking, certain conceptual models can be used to help understand how things operate/interoperate.
The most common is called the OSI (Open System Interconnect) Model.

The model consists of 7 layers, each corresponding to different components and/or functions.

Layer 7 = Application
Layer 6 = Presentation
Layer 5 = Session
Layer 4 = Transport
Layer 3 = Network
Layer 2 = Data-Link
Layer 1 = Physical

Each layer receives data from the upper and lower layer surrounding it, and "packages" the data in a way that is meaningful only to that particular layer.
Two important things to keep in mind:

The higher the layer, the more functionality offered.
The lower the layer, the less latency involved.

Hardware devices work at different layers.

Layer 3 = Router = Deals with a hierarchal address space (TCP/IP and its addresssing is one, there are others).
Layer 2 = Switch/bridge = Deals with a flat address space, in this case hardware/MAC addresses
Layer 1 = Hubs = Deals with physical connectivity primarily.

Switches and routers are COMPLETELY different animals. Very important concept to get your head around.
 

Kadarin

Lifer
Nov 23, 2001
44,296
16
81
Originally posted by: DeadSeaSquirrels
I've read a million things about the differences between a hub, switch, and router, and I'm still a bit confused...maybe because of it.

But I just wanted to ask one thing...if I used a switch, does that mean I still need as many static IP's (or maybe even dynamic IPs) as I have computers? Is the router the only thing that will allow me to use one IP on the WAN side and multiple IPs on the LAN side? If so it sounds like the switch basically divies out packets to the appropriate computers on the LAN side, if the ISP gives you multiple IPs, where as the router is doing what used to be the ISPs job, of creating multiple IPs and also the switching part.

So a router is like a switch (with some other firewall, and port forwarding abilities) and also a DHCP server. Whereas the switch lacks that DHCP server aspect and needs to ISP to do that part.

On the LAN side it seems then that a switch or router behaves the same...since on the LAN side all the IPs on the computer are different for both setups. But when you try to communicate WAN->LAN or LAN->WAN the router is doing some masking of what's behind it, whereas the switch just passes the requests as it sees it. Please somebody correct me, or confirm some of the things I'm saying.

You sound like you've got just enough grasp of the concepts to get yourself in trouble :)

A switch works strictly at Layer 2 in that it takes inbound packets and forwards them outbound on the port where it has learned the destination MAC address (note: not ip address), and if it doesn't know on which port the destination MAC is, it'll forward the packet out all ports on the device. That's all a switch does.

A router works at Layer 3: It will route packets whose destination ip addresses are in other subnets based on its route table. (Note that routers do not have to only route the ip protocol, but can also sometimes route ipx, AppleTalk, depending on what that particular router supports..)

What you're thinking of as a "router" is actually a very simplified router with only two interfaces, a WAN and a LAN. This "router" also implements the NAT protocol, which does the ip address masking, and the DHCP protocol, which provides for an automated means of assigning hosts connected to the LAN their ip addresses. Many of these "routers" will have a built-in switch, which comprises the LAN interface (multiple physical ports, but one router interface).
 

DeadSeaSquirrels

Senior member
Jul 30, 2001
515
0
0
I like TallGeese's reply. I can't say I totally understand it now, but I need to sit on the concept a little more. I read about this OSI explaination before, with the layers, and it didn't make as much sense. I think the idea that the whole networking system works on these 7 layers that only know how to talk to the layer above and below it, is a nice mode to work from. Now all I have to do is set right in my head why switches and hubs should be considered (or actually is) one layer below a router. Is it because it deals with physical hardware information, and the router deals with IP addresses?

But I guess knowing that with a switch you still need "x" number of IP's (provider by your ISP), for "x" number of computers, whereas you don't with a router, is good enough too.
 

ScottMac

Moderator<br>Networking<br>Elite member
Mar 19, 2001
5,471
2
0
You can pretty much think of hubs and switches as "intellegent wire" (with a switch being smarter than a hub).

If you send something into one port of a switch or hub, it is going to be repeated (through one mechanism or another) to one or more of the other ports. A hub IS a wire replacement: meant to emulate the single chunk of coax that connected all the other Ethernet-connected stations. Every bit put into a hub should be repeated out all ports. Since the hub is a logical piece of wire, it's considered a Layer 1 device.

A switch is a multiport bridge. Bridges keep track of where each station is on the local segment (everything on "this" side of the router - i.e., connected to a router port) by the "burned-in" address (the MAC address). Bridges don't care about layer three addresses (IP, IPX, DECNet, etc). When a FRAME enters a switch port, the switch looks in it's "Who's Where" MAC address table. If it finds the destination MAC address, it'll forward the frame out the port that the destination address came in on. A bridge / switch is considered a Layer 2 device, since it will act on a frame based on it's layer2 address (MAC address).

A switch has an extra advantage in that it can create a virtual connection between the source and destination ports. IF multiple PAIRS of computers connect through the switch, then there's a virtual amplification of bandwidth, since each pair active is given full point-to-point bandwidth. If you have three PAIR of machines in-session, the switch looks like a 300megabit path (some would say 600 because it's likely to be full duplex)

A router is, more or less, a traffic cop. A router looks a little higher up the stack (layer three) at which address the packet is to be routed, and sends it in that direction. If the router doesn't know where that specific (network) address is, and if there's a "Default Route" set, it will forward the traffic to the default route, assuming that some other router up-the-line will know where it goes.

A white board helps a lot with this explaination.....

You'll get it ... remain calm.

Good Luck

Scott