Tuesday, October 5, 2010

Question about networking (layer 2) [static ip addresses] [ethernet packet]

Q: This is more a basic network involved. I just curious.

If, say, a switch and then a PC connected to one port (A) and another on a different port (B). They all have static IP address, say 192.168.0.1

From 0.2 and 0.1 PC I ping the machine is 0.2, the switch knows the MAC of 0.1 on port A, but how does PC know 0.1 what MAC address to set the “Destination Address” field in the ?
Best Answer: I don't know who told you only layer 1 devices can be touched, but that is just silly. What device exists that cannot be touched? There is no imagination layer in networking.

Switch/hub is usually layer 2, although some switches do some layer 3 functionality. router is layer 3 but many home routers contain a small switch (this is how they offer 4 or more LAN ports for example). So the line is not clear in every case in how to label a device. It is very clear however in how to label each function the device provides.

Server contain many parts, hardware and software. They contain a network card which functions on layer 1 and 2. They contain an IP stack which provides layer 3 and 4, and services and application software which provides layers 5-7 (things get murky in the upper layers, sometimes everything above layer 4 is called the "application layer" or "layer 7" and treated as a group.
Re:Ah ok, this makes a lot more sense now! I was looking for a command like that too.

Thanks everyone!
Re:Originally posted by: guy
So do each of the PCs keep a table of IPs to MAC address entries?

I understand how a switch knows how to forward to which port, just confused on how the PCs know which MAC address to put in for the DA MAC.
Yup, each host keeps an arp table/cache of the other hosts they can connect to over layer 2. If you're running a windows machine bring up a command prompt and type "arp -a" to see what your machine has in it's cache right now.

Erik
Re:So do each of the PCs keep a table of IPs to MAC address entries?

I understand how a switch knows how to forward to which port, just confused on how the PCs know which MAC address to put in for the DA MAC.
Re:A switch is essentially a fast, multi-port bridge, and it operates as a bridge does (@ Layer 2).

The bridge gets it's addresses (MACs) by passively listening and noting the *source* address of the frame on the "wire". If it hasn't seen that source before, it adds it to the forwarding table (for whatever the defined amount of time). It goes in the table as 'this MAC came in from this Port'.

When one device send a frame to another, the switch/bridge looks at the destination MAC … if it's in the table, it sends the frame out that port. It also looks at the source address … if that source is not in the table, it's added.

If the destination MAC is not in the table (unknown), the switch/bridge "Floods" the frame out all ports except the one it came in on.

Do not confuse "Flooding" with "Broadcasting" … they are different.

With a broadcast, the destination MAC is all ones (usually, by convention) which matches all addresses in the broadcast domain.

Flooding sends the frame out all ports with the source and destination address intact (not all ones destination). The general idea is that if the destination evice is out there, it'll get the frame and respond accordingly.

Hope this helps

Scott

Edit: Nuts. I somehow managed to miss the whole last paragraph of the OP … I gotta get some better drugs …
Re:Address Resolution Protocol. ARP.

It's a layer2 broadcast asking for "who has this IP address? Respond to my source mac address"

View the original article here

No comments:

Post a Comment