Results 1 to 8 of 8

Thread: How Layer 2 LAN work?

  1. #1
    Member
    Join Date
    Oct 2005
    Posts
    147
    Thanks
    0
    Thanked
    0 times in 0 posts

    How Layer 2 LAN work?

    Here is the setting:
    -Computer A ip 172.27.161.22
    -Computer B ip 10.84.10.58

    Computer A ------ Layer 2 LAN ------ Computer B

    I want to know is why computer A cannot ping Computer B.
    From what i know if the two computer are in the same IP segment they will be able to ping each other. I think it work like this. Computer A send the msg to the switch. If the switch does not know who to send it to, it will broadcast the message. When Computer B receive this broadcast it will reply to Switch to let it know the message is for it. So from this A can send message to B

    So now back to the problem. Well i am thinking when A send the message to Switch. switch broadcast and computer B(different ip segment) receive it should be able to tell switch that the message belong to it yeah? so A can actually ping B even though they are in different ip segment.

    I am really confuse about this. Can please someone explain to me technically on how the switch would actually handle this problem.

    Thank alot.

  2. #2
    seen, but not often heard
    Join Date
    Sep 2004
    Location
    Watford
    Posts
    318
    Thanks
    9
    Thanked
    14 times in 11 posts

    Re: How Layer 2 LAN work?

    AFAIK, a layer 2 switch cant handle it, but a router or layer 3 switch can.

    basically, the router knows what networks exist on each of its ports, so when it recieves a packet that needs to go to a diff network, it checks its routing table and pushes it out accourdingly.
    it does it by using encapsulation.
    layer 2 switches are not capable of encapsulation, and so wont be able to route to a diff network.

    make sense?
    (bear in mind i have had no sleep for ages, and been nearly a year since i did my CCNA)

  3. #3
    Senior Member
    Join Date
    Aug 2005
    Location
    Redhill, Surrey
    Posts
    202
    Thanks
    1
    Thanked
    4 times in 4 posts

    Re: How Layer 2 LAN work?

    Layer 2 uses physical MAC addressing as opposed to the logical IP addressing used in layer 3.

    When going over a layer 2 network the switch will use the MAC addresses to create a point-to-point connection between the devices using the ARP to find the MAC address of a node from the IP address.

    However, even though both computers are on the same physical network, they are on separate logical networks and because of that the ping will not reach computer B. This would require a layer 3 device such as a router to forward the packets between separate logical networks. It can decapsulate the packet to read the layer 3 IP address and the encapsulate it again before sending it to the new network, which is known as NAT (network address translation).

    Although this might not be technically sound, that is the best way to put it from what I just learnt in my first CCNA module!

  4. #4
    Member
    Join Date
    Oct 2005
    Posts
    147
    Thanks
    0
    Thanked
    0 times in 0 posts

    Re: How Layer 2 LAN work?

    Well these are not really the answer i was hopping to get. Mabye i will start one question at a time. So when Computer A send the Ping to computer B will the Switch receive this ping message? if so what does the switch do with this message?

  5. #5
    Senior Member
    Join Date
    Aug 2005
    Location
    Redhill, Surrey
    Posts
    202
    Thanks
    1
    Thanked
    4 times in 4 posts

    Re: How Layer 2 LAN work?

    Quote Originally Posted by games130 View Post
    Well these are not really the answer i was hopping to get. Mabye i will start one question at a time. So when Computer A send the Ping to computer B will the Switch receive this ping message? if so what does the switch do with this message?
    The switch does not receive the ping message.

    The packet is created but never physically leaves Computer A. When the packet is trying to be sent it can't find the IP address on the same subnet. Layer 3 devices (router) are used to transfer packets between subnetworks, a layer 2 device (switch) will not be able to do this. Computer A then drops the packet before it is actually sent.

    To answer your original question "I want to know is why computer A cannot ping Computer B." it is because the computers are on different subnets.

  6. #6
    One Great Ordeal!
    Join Date
    Feb 2005
    Posts
    1,764
    Thanks
    201
    Thanked
    56 times in 49 posts

    Re: How Layer 2 LAN work?

    Computer 1 =
    IP - 192.168.10.1
    Subnet mask - 255.255.255.0

    Computer 2 =
    IP - 192.168.10.2
    Subnet mask - 255.255.255.0

    Give that a whirl and you should be in business. Without the subnets being the same and indeed as bleak was saying a router involved your not going to be able to communicate with your current addressing.

  7. #7
    Member
    Join Date
    Oct 2005
    Posts
    147
    Thanks
    0
    Thanked
    0 times in 0 posts

    Re: How Layer 2 LAN work?

    Quote Originally Posted by Bleak View Post
    The switch does not receive the ping message.

    The packet is created but never physically leaves Computer A. When the packet is trying to be sent it can't find the IP address on the same subnet. Layer 3 devices (router) are used to transfer packets between subnetworks, a layer 2 device (switch) will not be able to do this. Computer A then drops the packet before it is actually sent...
    ok so in the bold. How does the Layer 2 switch know that the packet is not in the same subnet? Layer 2 cannot read IP right so how?

  8. #8
    The late but legendary peterb - Onward and Upward peterb's Avatar
    Join Date
    Aug 2005
    Location
    Looking down & checking on swearing
    Posts
    19,378
    Thanks
    2,892
    Thanked
    3,403 times in 2,693 posts

    Re: How Layer 2 LAN work?

    Bleak was on the right track in his reply -- although this has nothing to do with NAT!

    Ping is an IP 'applcation' and IP is a layer 3 protocol, not understood by the switch. The packet doesn't leave the originating computer because it doesn't know what address to give it.

    When the packet is sent, the computer checks to see if the destination computer is on the same subnet as itself. If it is, it sends out the packet which passes transparently through the switch. (I say transparently because in fact the switch will have cached the MAC and IP addresses of all computers onte same subnet earlier. If the pact is not on the ame subnet, it sends it to the defauklt gateway, which will be a router that has one interface in the subnet, and another that eventually leads to the destination computer.

    (Not only are you using a different subnet you are using a different class of IP address (10.x.y.z) is a class A address, the other is a class C, although that will only be of interest to routers.)

    In the case you describe, the packets to the default gateway will be lost because it doesn't exist.

    If you defined the default gateway as the computer you are trying to ping, that would probably work.

    You can do layer 2 routing using the MAC address using protocols supported by NETBIOS, and I think some other protocols (IPX) also use routing based on MAC addresses.
    (\__/)
    (='.'=)
    (")_(")

    Been helped or just 'Like' a post? Use the Thanks button!
    My broadband speed - 750 Meganibbles/minute

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. F@H Nvidia Beta Client is out
    By Salazaar in forum Software
    Replies: 84
    Last Post: 12-07-2008, 07:11 PM
  2. 4 days and counting...
    By Lowe in forum Software
    Replies: 72
    Last Post: 03-02-2008, 11:47 PM
  3. Internet Connection at Uni (LAN)
    By muddyfox470 in forum Help! Quick Relief From Tech Headaches
    Replies: 10
    Last Post: 09-10-2005, 12:13 AM
  4. Work so far
    By Maldonado in forum Automotive
    Replies: 43
    Last Post: 11-01-2005, 02:53 PM
  5. Work Toilets - User Error
    By aeonf242 in forum General Discussion
    Replies: 23
    Last Post: 25-06-2004, 03:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •