Skip navigation
Cisco Learning Home > Certifications > Routing & Switching (CCNA) > Discussions

_Communities

This Question is Answered
10198 Views 13 Replies Latest reply: Jul 24, 2013 10:44 PM by Chandan Singh Takuli RSS

Currently Being Moderated

What does ip subnet-zero command do?

Jul 3, 2011 12:48 AM

Denis 30 posts since
Apr 2, 2011

What does ip subnet-zero command do?

  • Conwyn 7,914 posts since
    Sep 10, 2008
    Currently Being Moderated
    1. Jul 3, 2011 12:51 AM (in response to Denis)
    Re: What does ip subnet-zero command do?

    Hi Denis

     

    It is now the default but historically it allowed you to use the first and last subnet.

     

    So for example 192.168.0.0   and 192.168.255.0

     

    Regards Conwyn

  • Currently Being Moderated
    2. Jul 3, 2011 3:51 AM (in response to Denis)
    Re: What does ip subnet-zero command do?

    ip subnet-zero command provides the use of the first and last subnets.

    For example if you have a subnet of 255.255.255.224 or /27, which will give you a block of 32 addresses. The ip subnet-zero command will allow you to start with the block 0 (0-31) instead of starting with 32. This just provide a more efficient way to use your ip

    addresses and not waste any of them. By using this command you gain the blocks 0 and 224 to provide 0, 32, 64, 96, 128, 160, 192, and 224.

    here is more details from cisco

    http://www.cisco.com/en/US/tech/tk648/tk361/technologies_tech_note09186a0080093f18.shtml#subnetzero

  • Paul Stewart  -  CCIE Security, CCSI 6,952 posts since
    Jul 18, 2008
    Currently Being Moderated
    3. Jul 3, 2011 6:03 AM (in response to Conwyn)
    Re: What does ip subnet-zero command do?

    What Conwyn says is perfect with one caveat. 192.168.0.0 and 192.168.255.0 aren't actually subnets because they are class c networks. So both of those networks are permitted either way. An example I'd give is 172.16.0.0/24 and 172.16.255.0/24.

     

    Ismail is also correct. I just wanted to add the clarification that we need to consider the classful address space to understand what the first and last subnet are.

  • Conwyn 7,914 posts since
    Sep 10, 2008

    Hi Paul

     

    They are only class c in a classful world. In a classless world they are just IPs with a /24 subnet. Unfortunately classful still exists our our classless world such as in routing protocols.

     

    Regards Conwyn

  • Keith Barker - CCIE RS/Security, CISSP 5,351 posts since
    Jul 3, 2009
    Currently Being Moderated
    5. Jul 3, 2011 10:52 AM (in response to Denis)
    Re: What does ip subnet-zero command do?

    Hello Denis-

     

    Lets consider this class A network, with a custom mask:

     

    50.0.0.0/10

     

    Possible subnets are:

    50.0000 0000.x.x (first subnet)

    50.0100 0000.x.x

    50.1000 0000.x.x

    50.1100 0000.x.x (last subnet)

     

    A long time ago, it was not allowed to use the all 00 (the first subnet above, also called "subnet zero") subnet, as the subnet bits were all zeros.  In that same thinking, it was not allowed to assign (or use) a subnet where all the subnet bits were all 1's, such as the last subnet above.

     

    The "subnet-zero" command really should be called:

     

    "Go ahead and use the all zeros and all ones subnets (first and last)" but I suppose that would have been too big of a command. 

     

    The subnet-zero would allow 4 subnets above to be used instead of just 2.   This command is the default on current IOS, and doesn't need to be added to the configuration.

     

    Here is an example.  Without the use of the subnet-zero, it won't allow us to assign an IP address in the first subnet (subnet zero):

     

     

    R1(config)#no ip subnet-zero

    R1(config)#int loopback 1

    R1(config-if)#ip address 50.0.0.1 255.192.0.0

    Bad mask /10 for address 50.0.0.1

     

    If we add the subnet-zero command back into the configuration, now it allows an IP address to be assigned from that subnet:

     

    R1(config)#ip subnet-zero

    R1(config)#int loopback 1

    R1(config-if)#ip address 50.0.0.1 255.192.0.0

     

     

    Best wishes,

     

    Keith

     

  • Paul Stewart  -  CCIE Security, CCSI 6,952 posts since
    Jul 18, 2008
    Currently Being Moderated
    6. Jul 3, 2011 11:05 AM (in response to Conwyn)
    Re: What does ip subnet-zero command do?

    Conwyn, I agree with what your statement.  However, 192.168.0.0 and 192.168.255.0 are not subnets and can be applied to interfaces with or without "subnet-zero".  Below is a demonstration that shows everything necessary to understand about subnet zero.  What it shows is disabling "subnet-zero".  This is necessary since "ip subnet-zero" is now the default.  It also demonstrates one other often incorrectly documented (including by myself) item about "subnet" zero.

     

    Enter configuration commands, one per line.  End with CNTL/Z.

    RouterC(config)#no ip subnet-zero

    RouterC(config)#int loop 1

    RouterC(config-if)#ip address 192.168.0.1 255.255.255.0

    RouterC(config-if)#int loop 2

    RouterC(config-if)#ip address 192.168.255.1 255.255.255.0

    RouterC(config-if)#

     

    //now let's see s zero subnet

    RouterC(config-if)#int loop 3

    RouterC(config-if)#ip address 172.16.0.1 255.255.255.0

    Bad mask /24 for address 172.16.0.1

     

    //let's try the last subnet (all 1's subnet)

    RouterC(config-if)#ip address 172.16.255.1 255.255.255.0

    //so "no ip subnet-zero" only aplies to the first subnet, not the last

     

    //now let's re-enable subnet-zero

    RouterC(config-if)#ip subnet-zero

    RouterC(config)#int loop 4

    RouterC(config-if)#ip address 172.16.0.1 255.255.255.0

    RouterC(config-if)#

  • Bit.Decoder 51 posts since
    Dec 24, 2008

    This answer i have copied and stored in file form. I dont want to forget it. Great Great Great explanation and practical example. Thanks alot Keith.

     

    Bit

  • Conwyn 7,914 posts since
    Sep 10, 2008

    Hi Paul

     

    R1(config-if)#ip subnet-zero

    R1(config)#int fa0/1

    R1(config-if)#ip address 192.169.0.1 255.255.255.252

    R1(config-if)# no ip subnet-zero                  

    R1(config)#int fa0/1                           

    R1(config-if)#ip address 192.169.0.1 255.255.255.252

    Bad mask /30 for address 192.169.0.1

    R1(config-if)#ip address 192.169.0.5 255.255.255.252

    R1(config-if)#ip address 192.169.0.253 255.255.255.252

     

    Regards Conwyn

  • Paul Stewart  -  CCIE Security, CCSI 6,952 posts since
    Jul 18, 2008
    Currently Being Moderated
    9. Jul 3, 2011 12:28 PM (in response to Conwyn)
    Re: What does ip subnet-zero command do?

    Conwyn, that is correct. You will also find that "192.168.1.1 255.255.255.252" will also result in "bad mask". In your first reply you called attention to 192.168.0.0 and 192.168.255.0. Some might have seen this as the first and last subnet.  Those aren't subnets, rather they are networks. Therefore, I was wanting to illustrate the insignificance of those two networks in that example. Your example with 192.168.0.1/30 is perfect. That would be the first subnet on the 192.168.0.0 classful network.

     

    Here is a similar example with 192.168.1.0

     

    RouterA>

    RouterA>en

    RouterA#conf t

    Enter configuration commands, one per line.  End with CNTL/Z.

    RouterA(config)#no ip subnet-zero

    RouterA(config)#int loop 1

    RouterA(config-if)#ip address 192.168.1.1 255.255.255.252

    Bad mask /30 for address 192.168.1.1

    RouterA(config-if)#

     

     

  • DjIns1ght 12 posts since
    Jul 14, 2013

    Keith,

     

    Does this include all times any addressing is subnetted (on older iOS)?  Or is this JUST first and last subnets from a classful range?

    Edit: My question better explained in my reply Chandan Singh Takuli

  • Currently Being Moderated
    11. Jul 24, 2013 10:11 PM (in response to DjIns1ght)
    Re: What does ip subnet-zero command do?

    Hi DjIns1ght

     

    in older ios, the first & last subnet address of a subnet not the classfull address.

     

    check this link as posted above too

     

    http://www.cisco.com/en/US/tech/tk648/tk361/technologies_tech_note09186a0080093f18.shtml

  • Currently Being Moderated
    12. Jul 24, 2013 10:44 PM (in response to Chandan Singh Takuli)
    Re: What does ip subnet-zero command do?

    take a look over here an article written by paul sir:

     

    http://www.packetu.com/2011/11/14/the-ip-subnet-zero-command/

     

    suppose you have a classful network A. now you create subnets like A1, A2, A3

     

    now without every ip subnet-zero in each A1, A2,A3 you cannot use first & last subnet address.

     

    IP subnet-zero is by default enabled now in ios.

  • DjIns1ght 12 posts since
    Jul 14, 2013
    Currently Being Moderated
    13. Jul 24, 2013 11:02 PM (in response to Chandan Singh Takuli)
    Re: What does ip subnet-zero command do?

    Edit:  Your article link helped me.  This has to do with the IP address binary being zeros or 1's according to the mask.

     

    So when no subnet zero command is on then in a mask that is for example a 19 bit one,

     

    11111111.11111111.11100000.00000000

     

    Then any HOST IP address that looks like:

     

    11111111.11111111.000xxxxx.xxxxxxxx

     

    OR

     

    11111111.11111111.111xxxxx.xxxxxxxx

     

    In binary...Is not allowed

     

    Did I get it?

Actions

More Like This

  • Retrieving data ...

Bookmarked By (2)