Tilted Forum Project Discussion Community  

Go Back   Tilted Forum Project Discussion Community > Interests > Tilted Technology


 
 
LinkBack Thread Tools
Old 07-27-2003, 07:26 PM   #1 (permalink)
Junkie
 
What's the difference between routers, hubs, switches and Proxy Servers

I just posted this to another board. As it took about 30 minutes to type, I thought some of the boardmembers here might enjoy it.

By necessity, this explanation is simplified, but it should give a good idea of the difference between switches/hubs & routers. I also include a little about proxy servers.


How do routers & switches work?

Think of computer networks as being made up of several different layers. There is a international standard that defines these layers; the OSI 7 layer model. This definition is conceptual, but it is very useful in discussing or defining networks and how they work.

The seven layers are

A - Application
P - Presentation
S - Session
T - Transport
N - Network
D - Data
P - Physical

For our purposes, all we need to worry about are the bottom 3 layers.

Layer 1 - Physical Layer
This is literally the layer that the covers the physical electrical signals on the wire (or the radio signals in a wireless network). This layer is concerned with how to transmit raw bits over the communications channel (ie, wire or radio). How many volts represent 1 and 0, how long the signals should last etc. As a user, you never have to worry about this.

Hubs work on this layer, as they repeat (or retransmit) EVERYTHING they receive on any port on every port.

Layer 2 - Data Layer
This is where the bits are grouped in frames. There are two "sub-layers" on the Data Layer - MAC (or Media Access Control) and LLC (or Logical Link Control). Most users will be familiar with the term MAC address. This is effectively the physical, burned in address of your network card.

Switches work at this layer.

They switch the packets (or frames) between what are called 'collision domains'.

Ethernet is known as "CSMA/CD - Carrier Sense, Multiple Access / Collision Detect" network. This means each device first listens (Carrier Sense) and if the line is clear sends its packet. However, there are other devices other doing the same (Multiple Access), so sometimes two devices listen at the same time, think the line is free, and transmit at the same time. Their transmission (remember, all a frame or packet is, is some rapid changes in voltage on the cable) "collide" and nothing gets through for either station or device. The senders know this has happened as the recipient of the frame they sent did not reply with an OK. In other words, the station transmitted but didn't hear anything back, so it knows there was a collision. It waits a random amount of time and then starts again. Listen, transmit, wait for acknowledgement.

So this explains what a Collision Domain is.

In Ethernet, when you transmit a packet, every device on that network (or collision domain) can hear or receive that packet (as described above). In large networks, with many devices, this becomes a problem because more and more computers or devices are trying to transmit at the same time. More and more collisions occur and the general network performance degrades. This is why network hubs, which connect all devices to one big collision domain, are not great for busy or large networks. When a PC on Port 1 sends a packet/frame, it is retransmitted on every port on the hub, even if the intended target is only on a single port.

Switches on the other hand are desinged to address this problem.

On a switch, each port is a seperate collision domain. This means that when a PC on Port 1 wants to talk to a PC on Port 8, the frames (and therefore the signals) are only sent to the destination port. All the other ports (and the computers connected to them) do not "hear" the transmission. They can continue to send and receive normally. The number of collisions is greatly reduced, and network performance is increased.

So...

Switches work on Layer 2, as opposed to Hubs which work on Layer 1. They handle the way Ethernet frames are sent along the wire, and what devices can "hear" them.

Routers, on the other hand, are an entirely different kettle of fish.


Layer 3 - Network Layer

Routers work on Layer 3.

We have seen how computers on an Ethernet network can use hubs and switches to communicate. However, Ethernet is a low layer protocol. Computers also need a higher layer protocol. Most computers today use TCP/IP (Transmission Control Protocol / Internet Protocol).

TCP/IP is actually a suite of many protocols. Most users only need to know about the IP part; the Internet Protocol.

Without going into too much detail, IP is a protocol that allows computers to talk to each other, whether they are on the same network or on a seperate network. The term "network" here is different from "collision domain". We are talking about a virtual collection of devices that could be on seperate switches or routers (ie throughout a large building), but are on the same network. The difference is subtle but important.

An IP address is divided into two parts; a host ID and a network ID. They are usually shown in decimal format, like the following 123.123.123.123. In otherwords, four numbers seperated by a period. The numbers can range from 1 to 255. You also need two other series of numbers. A Subnet Mask and a Default Gateway.

So, a computer on a typical network, with a proper IP address (ie, Layer 3 address) looks something like this:

IP address: 64.104.195.151
Subnet mask: 255.255.255.0
Default gateway: 64.104.195.1

How can you tell which part of the IP address is the host address and which is the subnet address? By using the subnet mask. This tells you which parts of the numbers are the network ID and which part is the host ID. This is not concrete and can change from IP address to IP address. In the example above, you can see the subnet mask has "maxed out" the first 3 sections of IP address. Remember, the decimal numbers can only range from 1 to 255. The first three sections are set to 255.255.255 and the last one is a zero (meaning it's blank). This means that the "network address" is the first 3 parts of the IP address, ie 64.104.195.151, and the "host address" (my computers address) is the last part of the IP address, ie 64.104.195.151

A computer can talk to another computer on the same network with no problems. In my example, I can talk to a computer on the 64.104.195.xxx with no difficulties. Say I have a second computer with the address 64.104.195.100. It may be in a different room (or even a different building), but because it is on the same network (ie, the network address, the first 3 numbers as defined by my subnet mask, are the same), then I can communicate to it easily. The IP protocol handles this easily. I don't need a router.

Things get a bit more complex when the computer wants to talk to another computer on a DIFFERENT network. Typically, this means something on the internet, or across a large companies network.

The IP packets need to be routed to the correct network, and then the correct host (ie, destination computer).

How does this happen? Well, this is where a router steps in . When my computer realizes I want to talk to another computer with a different network address, it has no idea where to send the packets. What does it do? Well, it simply forwards them to the Default Gateway. Effectively, your computer is saying "I have no idea of where this is, you handle it"...

The Default Gateway is always a router.

The router usually knows about its neighbours (ie, your network, because you're connected to it and whatever is down the line; for home users, this usually means the ISP).

Chances are you don't want to just talk to a box in your ISP's building, so the router forwards the packet onto the "next hop". This will be another router, that looks at the packet and, if it doesn't know where it is, forwards it again, up the line. It's saying "I don't know where this is either, let me send it on to my neighbour who is connected to more networks and might know".

This goes on until the packet reaches a major internet router that knows about loads of networks. Eventually it will come to a router that 'recognizes' the network address and says "OK, I know where this is, go down this path and you will get there".

The packet goes down the correct path until it finally reaches the correct network. The last router it talks to (which, is the Default Gateway for THAT network) says "Yeah, this network address is me! Let me transmit this packet out on the wire and the recipient will no doubt hear it and respond" The packet is transmitted onto the correct network. Every computer hears it but only the recipient responds (it could be another PC you are playing CounterStrike with, or it could be a webserver and your browsing a webpage). Eitherway, your packet has reached its destination and it sends back a reply.

The freaky thing is that this all occurs in milliseconds.



So...


Routers are usually pieces of hardware (though PCs can "act" as a router in some circumstances) that handle how IP packets are sent from network to network. They work in Layer 3 and above.

Hubs and switches are always pieces of hardware then physically handle how Ethernet frames are sent along the wire to the correct physical network card.

IP (ie, Layer 3) runs "on top of" Ethernet (or 802.11b for wireless etc) which is Layer 2.


Finally...

Proxy Servers are used to "disguise" where you are coming from when you browse the internet. As we can see from above, your IP packets traverse the internet eventually getting to their destination. The thing is, once they get to where they are going their original starting point is included in the packet.

How else would your destination (PC, website etc) know how to send the data back again?!

This is normally not a problem, but when websurfing some people don't WANT their location (or original IP address) to be known. This can be for security reasons for for anonyminity or privacy reasons. You don't want someone knowing you're surfing the "Big Beautiful Women in Uniforms" website etc...

So, you surf the internet through a Proxy Server. This 'strips' off your original IP address and sticks its own in there before sending the packet on its way.

When the response comes back, the Proxy Server knows that you were the one transmitting to that IP address and sends the reply to you.

Anyone intercepting the packets along the way and analyzing them only knows that the traffic is between "www.bighotwomen.in-uniforms.com" and the proxy server. They don't know the packets came from you.

Some companies use Proxy Servers for security, as it also prevents hackers trying to intercept packets and use them as a backdoor into the companies network (complicated, so I won't go into detail here).

There are also public Proxy Servers out there. http://www.anonymizer.com/ is a famous one.



I hope this helps to explain. I have deliberately simplified a lot of the issues to make it easier to understand. I'm sure someone will step in and make some pedantic correction... :-) But this is for beginners and it gives a good overview of the differences between switches, hubs and routers and how Proxy Servers work.



Mr Mephisto

Last edited by Mephisto2; 07-31-2003 at 12:58 PM..
Mephisto2 is offline  
Old 07-27-2003, 07:28 PM   #2 (permalink)
Junkie
 
PS

Let me know if this is of any use, or if I should edit it for clarity.

Mr Mephisto
Mephisto2 is offline  
Old 07-27-2003, 07:40 PM   #3 (permalink)
Addict
 
Location: Dodging the ice pick
I clicked into this thread thinking you had a question. If someone had a question this is far better than I ever could have answered. Thank you, for it taught me a good deal.
__________________
COYW
darkure is offline  
Old 07-27-2003, 07:44 PM   #4 (permalink)
Crazy
 
next lets do subnetting, then access list, and finnish with variable length subnet mask.

Pretty nice write up. You must have to explain this for a living.
egorey is offline  
Old 07-28-2003, 01:45 PM   #5 (permalink)
I am Winter Born
 
Pragma's Avatar
 
Location: Alexandria, VA
Excellent work on writing this up. I've been working with stuff for over 6 or 7 years now, so it's very familiar to me, as well as having a refresher course studying for the CCNA exam, so I was pleasantly surprised to see how in depth you went.
__________________
Eat antimatter, Posleen-boy!
Pragma is offline  
Old 07-30-2003, 09:23 PM   #6 (permalink)
Junkie
 
I'm glad it was of some use.

Do any threads that answer common questions ever get "stickies?"
Mephisto2 is offline  
Old 07-31-2003, 03:25 AM   #7 (permalink)
Banned
 
Location: shittown, CA
Mr Mephisto. no. All members are encuraged to search before they post a question.

As for the post, you don't think you left it a little technical for folks that want to know how to plug in a router?
juanvaldes is offline  
Old 07-31-2003, 09:58 AM   #8 (permalink)
Junkie
 
Juanvaldas,

No I don't.

Like I said, it was a response a question on the differences between routers, switches and proxy servers, NOT as a guide on how to "plug in" a router.

And, just out of curiousity, in exactly what circumstances would you recommend to a user to just "plug in" a router?

Finally, I don't think it's that technical! I tried to use "plain English" as much as possible...

Mr Mephisto
Mephisto2 is offline  
Old 07-31-2003, 12:34 PM   #9 (permalink)
Crazy
 
Location: Upstate NY
Just one comment, I thought a hub was a layer one device since its just a dumb device and passes whatever it gets to every port.
__________________
I am jack's broken heart

Last edited by silenced; 07-31-2003 at 12:38 PM..
silenced is offline  
Old 07-31-2003, 12:56 PM   #10 (permalink)
Junkie
 
Opps... you're absolutely correct.

Let me edit post accordingly...

Thanks

Mr Mephisto

Last edited by Mephisto2; 07-31-2003 at 01:08 PM..
Mephisto2 is offline  
Old 07-31-2003, 02:54 PM   #11 (permalink)
Insane
 
Thanks, this helped out alot
SonicRL is offline  
Old 07-31-2003, 03:34 PM   #12 (permalink)
Hello, good evening, and bollocks.
 
Fearless_Hyena's Avatar
 
Location: near DC
Mr Mephisto that is an *excellent*, concise description of the lower layers, I couldn't have said it better!! Thanks for taking the time to write that up, cheers!
Fearless_Hyena is offline  
Old 07-31-2003, 07:04 PM   #13 (permalink)
Junkie
 
Glad you liked it.

Thanks for the compliment.

Mr Mephisto
Mephisto2 is offline  
Old 07-31-2003, 07:05 PM   #14 (permalink)
Junkie
 
PS - Check out my "Introduction to WLANs" if you have interest in that area too...

http://www.tfproject.org/tfp/showthr...threadid=19245

Mr Mephisto
Mephisto2 is offline  
Old 08-01-2003, 10:49 AM   #15 (permalink)
Addict
 
Location: SoCal
Great info Mr Mephisto, thanks for posting
stazen is offline  
Old 08-01-2003, 01:51 PM   #16 (permalink)
Banned
 
Location: 'bout 2 feet from my iMac
Quote:
Originally posted by Mr Mephisto

And, just out of curiousity, in exactly what circumstances would you recommend to a user to just "plug in" a router?
when it's my mum, she's disassembled the network again, and you're tryign to explain to her to put the red cord in the one that looks like a funny phone jack hole.

very nice, you summarized a semesters worth of class in one post. I'm impressed
cheerios is offline  
Old 08-01-2003, 06:13 PM   #17 (permalink)
Junkie
 
LOL Cheerio...

Fair enough.

Also, happy you liked the thread...

Mr Mephisto
Mephisto2 is offline  
 

Tags
difference, hubs, proxy, routers, servers, switches


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 04:07 PM.

Tilted Forum Project

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360