1. You are viewing our forum as a guest. For full access please Register. WindowsBBS.com is completely free, paid for by advertisers and donations.

Subnet Masking question

Discussion in 'Networking (Hardware & Software)' started by brimis, 2008/09/05.

  1. 2008/09/05
    brimis

    brimis Well-Known Member Thread Starter

    Joined:
    2006/09/13
    Messages:
    184
    Likes Received:
    2
    A question for the more experienced. If given an IP address of 192.168.4.1 and a default subnet of 255.255.255.0, why can you ping the 192.168.4.1 IP address if you change the subnet to 255.255.0.0 and 255.0.0.0?
    Thank you
     
  2. 2008/09/05
    seun

    seun Inactive

    Joined:
    2008/08/28
    Messages:
    3
    Likes Received:
    0
    Pinging from a different subnet is possible.

    Its possible to ping computers on 255.255.255.0 from 255.255.0.0 and 255.0.0.0 if,

    1. The subnets where connected using a router
    2. 255.0.0.0 spans across 255.255.0.0 & 255.255.255.0
     
    seun,
    #2

  3. to hide this advert.

  4. 2008/09/05
    brimis

    brimis Well-Known Member Thread Starter

    Joined:
    2006/09/13
    Messages:
    184
    Likes Received:
    2

    I understand you can ping if a router is in use. Let's say there is no router and your a PC with an ip address of 192.168.4.1 and I'm on a PC with an ip address of 192.168.4.15, both units will have a default subnet mask of 255.255.255.0. My question is, if the pc with ip address 192.168.4.1 were to change the subnet to 255.255.0.0 or 255.0.0.0 how can you ping if the subnet has now change?
     
  5. 2008/09/06
    Arie

    Arie Administrator Administrator Staff

    Joined:
    2001/12/27
    Messages:
    15,174
    Likes Received:
    412
    Start reading http://www.tcpipguide.com/free/t_IPSubnetAddressingSubnettingConcepts.htm

    A subnet of 255.255.255.0 will allow any device in the 192.168.4.x range to communicate.

    255.255.0.0 will allow any device in the 192.168.x.x range and (surprise) a 255.0.0.0 allows any device in the 192.x.x.x range to communicate.
     
    Arie,
    #4
  6. 2008/09/06
    ReggieB

    ReggieB Inactive Alumni

    Joined:
    2004/05/12
    Messages:
    2,786
    Likes Received:
    2
    I find it easier to understand at the binary level. When a computer needs to make a decision on where to send an IP packet it carries out a logical AND on its IP address and subnet mask.

    255.255.255.0 mask
    192.168.4.1
    255.255.255.0

    is this in binary

    11000000.10101000.00000100.00000001
    11111111.11111111.11111111.00000000

    Logical AND of the above gives:
    11000000.10101000.00000100.00000000

    So the network part of the address is that number which in decimal is
    192.168.4.0

    It does the same for any address it needs to send things to.

    So if it needs to send to 192.168.4.2 the addition looks like this:

    11000000.10101000.00000100.00000010
    11111111.11111111.11111111.00000000
    ---------------------------------------
    11000000.10101000.00000100.00000000

    That's the same result (192.168.4.0). If it gets a match it knows the new address is local and broadcasts for it or sends packets out directly on its own interface.

    However, what if it wants to send a packet to 192.168.2.1. The addition looks like this:

    11000000.10101000.00000010.00000001
    11111111.11111111.11111111.00000000
    ---------------------------------------
    11000000.10101000.00000010.00000000

    That's a different result (192.168.2.0). Therefore, the IP address is on not on the same subnet as the 192.168.4.1 PC. That PC will need to send the packet to a router.

    255.255.0.0 mask
    If you change the mask you get different results:

    192.168.4.1
    255.255.0.0

    Gives
    11000000.10101000.00000100.00000001
    11111111.11111111.00000000.00000000
    ---------------------------------------
    11000000.10101000.00000000.00000000

    A network address of 192.168.0.0

    192.168.4.2/255.255.0.0 gives:

    11000000.10101000.00000100.00000010
    11111111.11111111.00000000.00000000
    ---------------------------------------
    11000000.10101000.00000000.00000000

    A network address of 192.168.0.0 again

    And lastly 192.168.2.1:

    11000000.10101000.00000010.00000001
    11111111.11111111.00000000.00000000
    ---------------------------------------
    11000000.10101000.00000000.00000000

    A network address of 192.168.0.0 yet again.

    Now all three resolve the same network address, so they are on same subnet and will communicate directly together without using a router.

    So the submask simply defines the part of the address that is unique to the network and the part that is unique to a node on that network. Changing subnet simply defines the range of IP address that share the same network as the given IP address.

    BTW. Logical AND:

    1 + 1 = 1
    1 + 0 = 0
    0 + 1 = 0
    0 + 0 = 0
     
  7. 2008/09/06
    brimis

    brimis Well-Known Member Thread Starter

    Joined:
    2006/09/13
    Messages:
    184
    Likes Received:
    2
    Thank you for the detailed explaination.
     
  8. 2008/09/06
    Arie

    Arie Administrator Administrator Staff

    Joined:
    2001/12/27
    Messages:
    15,174
    Likes Received:
    412
    Yup, that's the proper way to do it ;)
     
    Arie,
    #7

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.