[Network] traffic question

pcMan

Limp Gawd
Joined
Apr 2, 2004
Messages
139
Just something really simple that's been bothering me, don't remember this from CCNA classes... Let's say I have 2 computers (A and B) connected to a hub and the hub is connected to a router (using DHCP). When computer A tries to send anything to computer B, I know the hub will send it everywhere so does comp. B discard it and wait for the router to send it or does the router discard it and it goes A->hub->B? To make it simple..does it go A->HUB->B or A->HUB->ROUTER->HUB->B? :confused:
 
by what I understand about how these thigns work, the switch sends it drectly to the other computer unless its in another subnet. honestly, how else could you have fast LAN setup if you were on a multi IP broadband setup? and I know that is true, cuz ive been on that.
 
the hub would send it to all ports therefore the router would drop the packet and it would go A>HUB>B
 
depends on the logical layout of the network but the main thing to remember is that the packet is addressed to a single MAC address. is your network set up so that the computers think they are on different subnets? if so, then the pkt will be addressed to the MAC addy of the gateway (which is the router). if they believe they are on the same LAN then comp A will address the pkt to the MAC addy of comp B.

whichever is the case, the pkt will be broadcast to every host by the stupid hub. but depending on who it is addressed to determines who will read the pkt and who will discard it.
 
Thank you...that makes sense, however, I thought this worked on the network layer (layer 3) which only uses ip addresses but I guess it uses the mac address until it gets routed somwehere.. :)
 
Routers dont come into play until you try to send a packet to a network other than your own.

In a hub environment, if all the machines plugged into a hub are 192.168.1.x/24, whenever you send a packet to any of those machines it is going to be flooded out all ports. The router is going to see that 192.168.1.x/24 is local to it, and thus it cannot route it anywhere and thus it drops the packet.

When you send a packet to another network, lets say 10.1.1.x, the router is going to see that 10.1.1.x is not local to it's network and is going to go "Do I have a direct route to 10.1.1.x?" if the answer is yes, it forwards the packet to whatever router is responsible for 10.1.1x. If the answer is no, the router forwards it to someone else. Then it is up to that router to find a route for that packet. Then you get into routing protocols and all that good stuff that confuses the hell out of a lot of people.
 
What if...let's say, computers A and B are NOT on the same subnet? :eek:
 
pcMan said:
What if...let's say, computers A and B are NOT on the same subnet? :eek:

well, then it has to find that subnet where ever it is, and go through the correct equipment, all other equipment will drop the packet.
 
think of NICs as operating at layer 2. hubs operate at layer 2. switches operate at layer 2. routers are the only layer 3 devices. (yes there are layer 3 switches, but i'm trying to make this as simple as possible, not more complicated.)

pkts have layer 2 addressing and layer 3 addressing. layer 2 addressing is a MAC address. layer 3 = IP address. your NIC sends a pkt somehwere. as the data comes down through the layers, layer 3 applies a an IP header to it in which there is a destination IP address. then it goes to layer 2 which adds the MAC address inside of the layer 2 header.

if you are sending the data to a remote network then the destination IP address is in that layer 3 header. but that is a package that is inside of another envelope which has the MAC addressing on it. your computer does not know the MAC address of the remote host. it knows it is on a remote segment though so it says "hey, i'll need to pass this through my gateway." so the MAC address it has put on the package is the MAC of the internal interface on your router.

once the router gets it it checks the MAC address and sees that the pkt is addressed to it so it removes the layer 2 header and reads the layer 3 info (remember, it is a layer 3 device). it sees the IP address is not its own. so the router looks up the addy in its routing table and finds the next router the pkt will need to go through.

it then puts a new layer 2 header on the pkt with the MAC address of an adjacent router. so on and so on, till the remote host gets it. all the while the destination IP address is not changing, but the MAC addressing is.

this is all the foundations of your CCNA studying. i suggest you go back and look at that again. it can be difficult to grasp at first, but once you have it it's like understanding that the sun rises in the morning and sets in the evening. as far as understanding how networks and internetworks functions, there is little info more basic than this. once you go over it a few times it seems to be common sense and then there is no need to make these kinds of faces --> :eek:
 
A computer only knows the MAC addresses of the other hosts on it's own subnet right? other than that, all clear now, thank you. :eek: :eek: :eek: (just kidding big daddy fatsacks ;))
 
the way i understand it is this

computer a on hub port 1
computer b on hub port 2
router on hub port 3 (pluged in to the router on port 1)

computer a sends traffic (ping/http/whatever) to computer b it hist hub port 1
hub sends the data to all ports (1,2,and 3)
computer a reads and ignores its data
computer b reads and accepts the data
router reads and knows that computer b is also on port 1 and ignors/drops the data.

hope this helps.
 
actually dagamore, the router comment is incorrect. the router has no clue where computer b is. all it knows is that the pkt was addressed to a MAC address which is not its own MAC address. so it says "not for me" and drops it.

that is why it is crucial to understand the 2 types of addressing- layer 2 (MAC addresses) and layer 3 (IP addressing). both re used to deliver pkts throughout internetworks. layer 2 addresses are used within a LAN, while IP addresses help get the pkts to remote networks.

pcMan, you are correct. they know the MAC addresses of the comps on the local subnet. if they do not know it they send a broadcast asking for it. if they get no response then they assume the host is remote and place the MAC address of the gateway on the pkt. okay, this last paragraph i'm not 100% sure about :eek:
 
big daddy fatsacks, you're pretty much correct.

A packet will be labelled with the correct destination IP in all circumstances. However, the destination MAC address is:
If the target computer is on the local subnet, the MAC address is that computer's MAC address​
or
If the target computer is not on the local subnet, the MAC address is the gateway's MAC address​

1) Your computer A will send the packet out it's interface, call it LAN0, addressed with the IP & MAC address of computer B
2) The hub blindly forwards the packet out all interfaces except the interface it received it on
3a) Computer B receives the packet, sees that it is addressed to its MAC address, and processes it
3b) The router receives the packet, sees that it is addressed to a different MAC address, and discards it

In this case, you can pretty much ignore the fact that the router exists.
 
Back
Top