IP subnetting - TCP-IP

This is a discussion on IP subnetting - TCP-IP ; hello Sorry for so many question, but I didn't want to spam a group with 5 threads. I also assumed the answers will be rather short, else I wouldn't bother you guys with so many questions at once. 1) If ...

+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 20 of 29

Thread: IP subnetting

  1. IP subnetting

    hello

    Sorry for so many question, but I didn't want to spam a group with 5
    threads. I also assumed the answers will be rather short, else I
    wouldn't bother you guys with so many questions at once.

    1) If I write the following entry, then my router will route any IP
    address which begins with left most bit set to 1

    route add 128.0.0.0 mask 128.0.0.0 192.168.16.2

    a)
    route add 128.0.0.0 mask 128.0.0.0 192.168.16.2
    route add 128.0.0.0 mask 255.0.0.0 192.168.16.2

    I assume that with first entry routing mechanism "thinks" that network
    IP has value of 128, while in second case it "thinks" that besides
    network with left most octet having value of 128, there are other
    networks existing with values ranging between 1 and 254?




    2)
    Some web site has the following to say about subnet mask:

    "Because of the relationship between the destination and the subnet
    mask in defining routes, the destination cannot be more specific than
    its corresponding subnet mask. In other words, there cannot be a bit
    set to 1 in the destination if the corresponding bit in the subnet
    mask is a 0.


    I know PC has the following routing check mechanism

    ( Destination & Mask ) != destination,

    so we can't put into routing table entries where bits in netmask are
    zero, but corresponding bits in destination are set to 1.

    a)
    Why must bits set to 0 in a netmask also be set to 0 in a destination
    address? What would be wrong if we could put the following into
    routing table:

    Route add 140.32.128.0 mask 255.255.0.0 192.168.16.2

    Would routers suddenly stop working properly? Why?



    3)
    Suppose there is a network 140.196.0.0 ( netmask 255.255.0.0 ), but
    some router lying somewhere between a PC sending a packet and this
    network ( which is this packet's final destination ) has the
    following entries in its routing table:

    140.192.0.0 mask 255.192.0.0 200.20.20.20
    0.0.0.0 mask 0.0.0.0 200.20.20.28

    What would this router do when packet destined to network 140.196.0.0
    would arrive? I assume it would send it to the gateway with IP
    200.20.20.20 ?

    4)
    Say I build a Ethernet LAN with 2 PCs and one router. Now I give the
    two PCs same subnet IP, but I put router in different ( logical )
    subnet:

    IP of the two PCs is 192.168.16.1, 192.168.16.2

    IP of a router is 172.16.2.1

    Is there any chance that the PCs will be able to send a packet to
    this router ( besides giving router subnet address 192.168.16.0 or
    giving the two PCs subnet address 172.16.2.0 )? Physically they are
    all on the same LAN so there must be a way.

    5)
    According to wikipedia a subnet value can consist of all zeros.
    a) without subnet mask how do can know if for example 146.193.0.0
    represents subnet 146.193. or if it represents subnet 146.193.0. ( I
    assume there can be occasions where subnet mask is not available )?


    thank you

  2. Re: IP subnetting

    On Tue, 18 Dec 2007 09:01:11 -0800, failure_to wrote:

    > hello
    >
    > Sorry for so many question, but I didn't want to spam a group with 5
    > threads. I also assumed the answers will be rather short, else I
    > wouldn't bother you guys with so many questions at once.
    >
    > 1) If I write the following entry, then my router will route any IP
    > address which begins with left most bit set to 1
    >
    > route add 128.0.0.0 mask 128.0.0.0 192.168.16.2
    >
    > a)
    > route add 128.0.0.0 mask 128.0.0.0 192.168.16.2
    > route add 128.0.0.0 mask 255.0.0.0 192.168.16.2
    >
    > I assume that with first entry routing mechanism "thinks" that network
    > IP has value of 128, while in second case it "thinks" that besides


    No, the first entry tells your computer that anything from 128.0.0.1 to
    255.255.255.255 has to be sent to 192.168.16.2 for further routing. (And
    as there are a lot of special networks in that range, like all the
    multicast networks).

    > network with left most octet having value of 128, there are other
    > networks existing with values ranging between 1 and 254?


    Basically, yes. Well, between 0 and 255, but a lot of those are special
    so let's say from 1 to 223 with some exceptions (f.i. 192.168 is private,
    169.254 is link local, multicast starts at 224, iirc 128 is reserved,
    etc).

    > 2)
    > Some web site has the following to say about subnet mask:
    >
    > "Because of the relationship between the destination and the subnet mask
    > in defining routes, the destination cannot be more specific than its
    > corresponding subnet mask. In other words, there cannot be a bit set to
    > 1 in the destination if the corresponding bit in the subnet mask is a 0.
    >
    >
    > I know PC has the following routing check mechanism
    >
    > ( Destination & Mask ) != destination,
    >
    > so we can't put into routing table entries where bits in netmask are
    > zero, but corresponding bits in destination are set to 1.
    >
    > a)
    > Why must bits set to 0 in a netmask also be set to 0 in a destination
    > address?


    Because setting any of those bits to one makes no sense, they get anded
    off.

    > What would be wrong if we could put the following into routing
    > table:
    >
    > Route add 140.32.128.0 mask 255.255.0.0 192.168.16.2
    >
    > Would routers suddenly stop working properly? Why?


    It's nonsense. But either the router doesn't accept it, or treats
    destination as 140.32.0.0.

    >
    > 3)
    > Suppose there is a network 140.196.0.0 ( netmask 255.255.0.0 ), but some
    > router lying somewhere between a PC sending a packet and this network (
    > which is this packet's final destination ) has the following entries in
    > its routing table:
    >
    > 140.192.0.0 mask 255.192.0.0 200.20.20.20
    > 0.0.0.0 mask 0.0.0.0 200.20.20.28
    >
    > What would this router do when packet destined to network 140.196.0.0
    > would arrive? I assume it would send it to the gateway with IP
    > 200.20.20.20 ?


    Yes, 140.196 is in the range of the first routing entry, which runs from
    140.192.0.0 to 140.255.255.255.

    > 4)
    > Say I build a Ethernet LAN with 2 PCs and one router. Now I give the
    > two PCs same subnet IP, but I put router in different ( logical )
    > subnet:
    >
    > IP of the two PCs is 192.168.16.1, 192.168.16.2
    >
    > IP of a router is 172.16.2.1


    I assume a netmask of 255.255.255.0 here, else your question does not
    make much sense.

    >
    > Is there any chance that the PCs will be able to send a packet to this
    > router ( besides giving router subnet address 192.168.16.0 or giving the
    > two PCs subnet address 172.16.2.0 )? Physically they are all on the same
    > LAN so there must be a way.


    There are some dirty tricks to acomplish this, but you don't want to go
    there. (Basically, set up a static arp entry on the PCs that 192.168.16.3
    is at the MAC address of the router. Point a route to 192.168.16.3. The
    router doesn't know the incoming packets were sent to 192.168.16.3, in
    fact, that address never leaves the PCs. The router just sees a packet
    destined to it's MAC address, so it will accept the packet.)

    A simpler way would be to use a wider subnet, say 255.255.0.0.

    >
    > 5)
    > According to wikipedia a subnet value can consist of all zeros.
    > a) without subnet mask how do can know if for example 146.193.0.0
    > represents subnet 146.193. or if it represents subnet 146.193.0. ( I
    > assume there can be occasions where subnet mask is not available )?


    You cannot. A subnet of all zeros means the whole internet, it is used
    for the default route. Without a subnet (which is something different
    from a subnet consisting of all zeros) you cannot determine the subnet.

    HTH
    M4

  3. Re: IP subnetting

    hello

    On Dec 18, 9:51 pm, Martijn Lievaart wrote:
    > On Tue, 18 Dec 2007 09:01:11 -0800, failure_to wrote:
    > > hello

    >
    > > Sorry for so many question, but I didn't want to spam a group with 5
    > > threads. I also assumed the answers will be rather short, else I
    > > wouldn't bother you guys with so many questions at once.

    >
    > > 1) If I write the following entry, then my router will route any IP
    > > address which begins with left most bit set to 1

    >
    > > route add 128.0.0.0 mask 128.0.0.0 192.168.16.2

    >
    > > a)
    > > route add 128.0.0.0 mask 128.0.0.0 192.168.16.2
    > > route add 128.0.0.0 mask 255.0.0.0 192.168.16.2

    >
    > > I assume that with first entry routing mechanism "thinks" that network
    > > IP has value of 128, while in second case it "thinks" that besides

    >
    > No, the first entry tells your computer that anything from 128.0.0.1 to
    > 255.255.255.255 has to be sent to 192.168.16.2 for further routing.
    >


    You mean first entry tells that anything from 128.0.0.1 to
    128.255.255.255 has to be sent to 192.168.16.2 for further routing?



    >
    > > 3)
    > > Suppose there is a network 140.196.0.0 ( netmask 255.255.0.0 ), but some
    > > router lying somewhere between a PC sending a packet and this network (
    > > which is this packet's final destination ) has the following entries in
    > > its routing table:

    >
    > > 140.192.0.0 mask 255.192.0.0 200.20.20.20
    > > 0.0.0.0 mask 0.0.0.0 200.20.20.28

    >
    > > What would this router do when packet destined to network 140.196.0.0
    > > would arrive? I assume it would send it to the gateway with IP
    > > 200.20.20.20 ?

    >
    > Yes, 140.196 is in the range of the first routing entry, which runs from
    > 140.192.0.0 to 140.255.255.255.
    >
    > > 4)
    > > Say I build a Ethernet LAN with 2 PCs and one router. Now I give the
    > > two PCs same subnet IP, but I put router in different ( logical )
    > > subnet:

    >
    > > IP of the two PCs is 192.168.16.1, 192.168.16.2

    >
    > > IP of a router is 172.16.2.1

    >
    > I assume a netmask of 255.255.255.0 here, else your question does not
    > make much sense.
    >


    Yes, netmask for the two Pcs is 255.255.255.0, but netmask for router
    ( its IP being 172.16.2.1 ) could be something else, since I don't see
    how that would make a difference. Or does it?

    >
    >
    > > Is there any chance that the PCs will be able to send a packet to this
    > > router ( besides giving router subnet address 192.168.16.0 or giving the
    > > two PCs subnet address 172.16.2.0 )? Physically they are all on the same
    > > LAN so there must be a way.

    >
    > There are some dirty tricks to acomplish this, but you don't want to go
    > there. (Basically, set up a static arp entry on the PCs that 192.168.16.3
    > is at the MAC address of the router. Point a route to 192.168.16.3. The
    > router doesn't know the incoming packets were sent to 192.168.16.3, in
    > fact, that address never leaves the PCs. The router just sees a packet
    > destined to it's MAC address, so it will accept the packet.)
    >
    > A simpler way would be to use a wider subnet, say 255.255.0.0.
    >


    But using wider subnet ( 255.255.0.0. ) wouldn't work in the example
    above since the two Pcs would be on subnet 192.168.0.0. and router
    would be on subnet 172.16.0.0 ?


    >
    > > 5)
    > > According to wikipedia a subnet value can consist of all zeros.
    > > a) without subnet mask how do can know if for example 146.193.0.0
    > > represents subnet 146.193. or if it represents subnet 146.193.0. ( I
    > > assume there can be occasions where subnet mask is not available )?

    >
    > You cannot. A subnet of all zeros means the whole internet, it is used
    > for the default route. Without a subnet (which is something different
    > from a subnet consisting of all zeros) you cannot determine the subnet.
    >
    > HTH
    > M4


    I'm not sure I quite understand what you are trying to say here. I
    wasn't implying that there could be a subnet 0.0.0.0, I realise
    0.0.0.0 is used for default route, but I was assuming that subnet like
    190.0.0.0 could exists ( its subnet mask would be 255.255.0.0 )

    I appreciate your help

  4. Re: IP subnetting

    In article
    <6345c2f0-104c-45fa-8f67-d688fb4be072@q3g2000hsg.googlegroups.com>,
    failure_to@yahoo.co.uk wrote:

    > hello
    >
    > On Dec 18, 9:51 pm, Martijn Lievaart wrote:
    > > On Tue, 18 Dec 2007 09:01:11 -0800, failure_to wrote:
    > > > hello

    > >
    > > > Sorry for so many question, but I didn't want to spam a group with 5
    > > > threads. I also assumed the answers will be rather short, else I
    > > > wouldn't bother you guys with so many questions at once.

    > >
    > > > 1) If I write the following entry, then my router will route any IP
    > > > address which begins with left most bit set to 1

    > >
    > > > route add 128.0.0.0 mask 128.0.0.0 192.168.16.2

    > >
    > > > a)
    > > > route add 128.0.0.0 mask 128.0.0.0 192.168.16.2
    > > > route add 128.0.0.0 mask 255.0.0.0 192.168.16.2

    > >
    > > > I assume that with first entry routing mechanism "thinks" that network
    > > > IP has value of 128, while in second case it "thinks" that besides

    > >
    > > No, the first entry tells your computer that anything from 128.0.0.1 to
    > > 255.255.255.255 has to be sent to 192.168.16.2 for further routing.
    > >

    >
    > You mean first entry tells that anything from 128.0.0.1 to
    > 128.255.255.255 has to be sent to 192.168.16.2 for further routing?


    No, his answer was correct. The first entry matches any destination
    whose high-order bit is 1, as you said in your first sentence above.

    The second entry only matches destination 128.x.x.x.

    --
    Barry Margolin, barmar@alum.mit.edu
    Arlington, MA
    *** PLEASE post questions in newsgroups, not directly to me ***
    *** PLEASE don't copy me on replies, I'll read them in the group ***

  5. Re: IP subnetting

    failure_to@yahoo.co.uk wrote:

    > 1) If I write the following entry, then my router will route any IP
    > address which begins with left most bit set to 1
    >
    > route add 128.0.0.0 mask 128.0.0.0 192.168.16.2
    >
    > a)
    > route add 128.0.0.0 mask 128.0.0.0 192.168.16.2
    > route add 128.0.0.0 mask 255.0.0.0 192.168.16.2
    >
    > I assume that with first entry routing mechanism "thinks" that network
    > IP has value of 128, while in second case it "thinks" that besides
    > network with left most octet having value of 128, there are other
    > networks existing with values ranging between 1 and 254?


    Basically, a network address + mask pair uniquely identifies a range of IP
    addresses. Your first pair is 128.0.0.0/128.0.0.0, or 128.0.0.0/1, which
    identifies the range 128.0.0.0-255.255.255.255 (do the binary math to know
    why). Your second pair is 128.0.0.0/8, which identifies the range
    128.0.0.0-128.255.255.255. Thus, your route statemets say,
    respectively: "send all packets addressed for 128.0.0.0-255.255.255.255 to
    192.168.16.2" and "send all packets addressed for 128.0.0.0-128.255.255.255
    to 192.168.16.2". Of course, this is only in theory, because many of the
    addresses in those ranges are reserved for other uses (eg multicast).

    > 2)
    > Some web site has the following to say about subnet mask:
    >
    > "Because of the relationship between the destination and the subnet
    > mask in defining routes, the destination cannot be more specific than
    > its corresponding subnet mask. In other words, there cannot be a bit
    > set to 1 in the destination if the corresponding bit in the subnet
    > mask is a 0.
    >
    >
    > I know PC has the following routing check mechanism
    >
    > ( Destination & Mask ) != destination,
    >
    > so we can't put into routing table entries where bits in netmask are
    > zero, but corresponding bits in destination are set to 1.
    >
    > a)
    > Why must bits set to 0 in a netmask also be set to 0 in a destination
    > address? What would be wrong if we could put the following into
    > routing table:
    >
    > Route add 140.32.128.0 mask 255.255.0.0 192.168.16.2
    >
    > Would routers suddenly stop working properly? Why?


    Rather that "suddenly stop working", they probably will ignore the extra
    bits and take only the part of the network address identified by the mask.
    In your example, the route will be assumed to be to 140.32.0.0. It's highly
    implementation-dependent anyway.

    > 3)
    > Suppose there is a network 140.196.0.0 ( netmask 255.255.0.0 ), but
    > some router lying somewhere between a PC sending a packet and this
    > network ( which is this packet's final destination ) has the
    > following entries in its routing table:
    >
    > 140.192.0.0 mask 255.192.0.0 200.20.20.20
    > 0.0.0.0 mask 0.0.0.0 200.20.20.28
    >
    > What would this router do when packet destined to network 140.196.0.0
    > would arrive? I assume it would send it to the gateway with IP
    > 200.20.20.20 ?


    More specific matching routes are always preferred over less specific ones.
    Here "more specific" means "which identifies a smaller range of IP
    addresses". The destination address of the packet matches both routes, but
    the first is more specific (obviously, since the second is a default
    route), so the router will use that route and send the packet to
    200.20.20.20.

    > 4)
    > Say I build a Ethernet LAN with 2 PCs and one router. Now I give the
    > two PCs same subnet IP, but I put router in different ( logical )
    > subnet:
    >
    > IP of the two PCs is 192.168.16.1, 192.168.16.2
    >
    > IP of a router is 172.16.2.1
    >
    > Is there any chance that the PCs will be able to send a packet to
    > this router ( besides giving router subnet address 192.168.16.0 or
    > giving the two PCs subnet address 172.16.2.0 )? Physically they are
    > all on the same LAN so there must be a way.


    Not without playing tricks, which you better don't do anyway. But yes, if
    you absolutely need to send packets to the router you should be able to do
    that using static routes (both on the hosts and the router). There are
    probably other ways (one is a shorter subnet mask, as Martijn already
    mentioned).


    > 5)
    > According to wikipedia a subnet value can consist of all zeros.
    > a) without subnet mask how do can know if for example 146.193.0.0
    > represents subnet 146.193. or if it represents subnet 146.193.0. ( I
    > assume there can be occasions where subnet mask is not available )?


    Nowadays subnet masks are needed almost always, for exactly that purpose:
    identifying the network part of an address. Some software, when a network
    mask is not available, might fall back to classful behavior and guess the
    network address based on the class of the address, but classful addressing
    is mostly an ancient relic from the past. If you are interested, you can
    read something about that eg here:
    http://en.wikipedia.org/wiki/Classful_network

    hth


  6. Re: IP subnetting

    Hello,

    Martijn Lievaart a écrit :
    >
    > No, the first entry tells your computer that anything from 128.0.0.1 to
    > 255.255.255.255 has to be sent to 192.168.16.2 for further routing.


    Shouldn't 128.0.0.0 be included ?

    >>Say I build a Ethernet LAN with 2 PCs and one router. Now I give the
    >>two PCs same subnet IP, but I put router in different ( logical )
    >>subnet:
    >>
    >>IP of the two PCs is 192.168.16.1, 192.168.16.2
    >>
    >>IP of a router is 172.16.2.1

    >
    > I assume a netmask of 255.255.255.0 here, else your question does not
    > make much sense.
    >
    >>Is there any chance that the PCs will be able to send a packet to this
    >>router ( besides giving router subnet address 192.168.16.0 or giving the
    >>two PCs subnet address 172.16.2.0 )? Physically they are all on the same
    >>LAN so there must be a way.

    >
    > There are some dirty tricks to acomplish this, but you don't want to go
    > there. (Basically, set up a static arp entry on the PCs that 192.168.16.3
    > is at the MAC address of the router.


    No need to be so complicated. Just add a route telling that the gateway
    address is directly reachable on the local network.

    failure_to@yahoo.co.uk :
    >
    > Yes, netmask for the two Pcs is 255.255.255.0, but netmask for router
    > ( its IP being 172.16.2.1 ) could be something else, since I don't see
    > how that would make a difference. Or does it?


    The mask on the router matters if the router has to send traffic to the
    PCs, or if it does source address validation (checking that the source
    address of packets received on an interface would be routed back on the
    same interface) in order to prevent spoofing.

  7. Re: IP subnetting

    In article ,
    Pascal Hambourg wrote:
    >Martijn Lievaart a écrit :
    >> No, the first entry tells your computer that anything from 128.0.0.1 to
    >> 255.255.255.255 has to be sent to 192.168.16.2 for further routing.

    >
    >Shouldn't 128.0.0.0 be included ?


    Yes, his fingers probably thought he was typing 127.0.0.1 :-)

    --
    -- Rod --
    rodd(at)polylogics(dot)com

  8. Re: IP subnetting

    hello

    1) I still don't understand whether the following is allowed:

    a) Say we have network 192.168.0.0 ( mask 255.255.0.0 ) and we subnet
    it. Can one of subnets be 192.168.0.0 ( mask 255.255.255.0 )

    b) Can we also have all-ones subnets?


    I hope I don't get flamed for this, but can I ask an additional
    questions

    2) Say my PC is connected to two LANs, thus it has two NICs.
    * subnet of LAN_1 is 192.168.16.0 ( mask 255.255.255.0 )
    * subnet of LAN_2 is 192.168.17.0 ( mask 255.255.255.0 )

    Thus NIC_1 has IP 192.168.16.2 and NIC_2 has IP 192.168.17.2

    Among other entries in my routing table there is also :

    192.168.16.0 mask 255.255.255.0 gateway 192.168.16.2

    I assume this entry tells my PC that if packet's destination is subnet
    192.168.16.0, then packet should be sent through NIC_1. So in theory
    if my routing table had the following entry

    192.168.16.0 mask 255.255.255.0 gateway 192.168.17.2

    then packets destined for subnet 192.168.16.0 would go through NIC_2
    and thus to subnet 192.168.17.0?



    in any case, thank you very much

    cheers


  9. Re: IP subnetting

    On Wed, 19 Dec 2007 12:15:44 -0800, failure_to wrote:

    > hello
    >
    > 1) I still don't understand whether the following is allowed:
    >
    > a) Say we have network 192.168.0.0 ( mask 255.255.0.0 ) and we subnet
    > it. Can one of subnets be 192.168.0.0 ( mask 255.255.255.0 )


    Yes, absolutely. This used to be problematic in ancient days, but on
    todays IP networks, it's fine.

    (The main problem was RIPv1 that tried to guess the subnet and guess
    wrong in this case. RIPv2 solved that and RIPv1 is dead (though Windows
    ships it up to this day)).

    >
    > b) Can we also have all-ones subnets?


    Yes, absolutely, this is used f.i. for host routes. It's a subnet of one
    IP address, and sometimes it is very useful. Do note that Windows does
    not allow all-ones subnets, but that is just an implementation flaw of
    Windows.

    > I hope I don't get flamed for this, but can I ask an additional
    > questions
    >
    > 2) Say my PC is connected to two LANs, thus it has two NICs. *

    subnet of
    > LAN_1 is 192.168.16.0 ( mask 255.255.255.0 ) * subnet of LAN_2 is
    > 192.168.17.0 ( mask 255.255.255.0 )
    >
    > Thus NIC_1 has IP 192.168.16.2 and NIC_2 has IP 192.168.17.2
    >
    > Among other entries in my routing table there is also :
    >
    > 192.168.16.0 mask 255.255.255.0 gateway 192.168.16.2
    >
    > I assume this entry tells my PC that if packet's destination is subnet
    > 192.168.16.0, then packet should be sent through NIC_1.


    Yes, but there is some magic here. Because you give the IP of the machine
    itself, you tell it to send the packets out that interface. On other
    routers you just tell the router to use that interface.

    On Linux I would say:

    ip route add 192.168.16.0 dev eth0

    which makes it much clearer what happens. The packets get send out on the
    first NIC.

    So what you tell your router is that it has to do ARP resolution on the
    first NIC for any address in 192.168.16.0. Once it has the MAC of the
    destination, the packet is end to that MAC.

    > So in theory if
    > my routing table had the following entry
    >
    > 192.168.16.0 mask 255.255.255.0 gateway 192.168.17.2
    >
    > then packets destined for subnet 192.168.16.0 would go through NIC_2 and
    > thus to subnet 192.168.17.0?


    Whatever happens, they would not go to subnet 192.168.17.0. Your router
    might object to this syntax, or it may accept it. If it accepts it, it
    probably sends those packets to the network segment where NIC2 is
    attached. Where incidentaly subnet 192.168.17.0 is configured as one of
    the subnets -- in this case the only one -- on this network segment.

    Note that in Linux I would say:

    ip route add 192.168.16.0 dev eth1

    which makes it much clearer what happens. The packets get send out on the
    second NIC.

    > in any case, thank you very much


    You're welcome,
    M4

  10. Re: IP subnetting

    In article ,
    Pascal Hambourg wrote:

    > No need to be so complicated. Just add a route telling that the gateway
    > address is directly reachable on the local network.


    That requires the implementation to perform recursive route lookup.
    Many don't do this.

    --
    Barry Margolin, barmar@alum.mit.edu
    Arlington, MA
    *** PLEASE post questions in newsgroups, not directly to me ***
    *** PLEASE don't copy me on replies, I'll read them in the group ***

  11. Re: IP subnetting

    hello


    On Dec 19, 11:38 pm, Martijn Lievaart wrote:
    > On Wed, 19 Dec 2007 12:15:44 -0800, failure_to wrote:
    > > hello

    >
    > > 1) I still don't understand whether the following is allowed:

    >
    > > a) Say we have network 192.168.0.0 ( mask 255.255.0.0 ) and we subnet
    > > it. Can one of subnets be 192.168.0.0 ( mask 255.255.255.0 )

    >
    > Yes, absolutely. This used to be problematic in ancient days, but on
    > todays IP networks, it's fine.
    >
    > (The main problem was RIPv1 that tried to guess the subnet and guess
    > wrong in this case. RIPv2 solved that and RIPv1 is dead (though Windows
    > ships it up to this day)).
    >
    >
    >
    > > b) Can we also have all-ones subnets?

    >
    > Yes, absolutely, this is used f.i. for host routes. It's a subnet of one
    > IP address, and sometimes it is very useful. Do note that Windows does
    > not allow all-ones subnets, but that is just an implementation flaw of
    > Windows.
    >
    >
    >
    >
    >
    > > I hope I don't get flamed for this, but can I ask an additional
    > > questions

    >
    > > 2) Say my PC is connected to two LANs, thus it has two NICs. *

    > subnet of
    > > LAN_1 is 192.168.16.0 ( mask 255.255.255.0 ) * subnet of LAN_2 is
    > > 192.168.17.0 ( mask 255.255.255.0 )

    >
    > > Thus NIC_1 has IP 192.168.16.2 and NIC_2 has IP 192.168.17.2

    >
    > > Among other entries in my routing table there is also :

    >
    > > 192.168.16.0 mask 255.255.255.0 gateway 192.168.16.2

    >
    > > I assume this entry tells my PC that if packet's destination is subnet
    > > 192.168.16.0, then packet should be sent through NIC_1.

    >
    > Yes, but there is some magic here. Because you give the IP of the machine
    > itself, you tell it to send the packets out that interface. On other
    > routers you just tell the router to use that interface.
    >


    By "on other routers" you mean to say that if my machine wasn't
    ordinary PC but actual router with this two NICs ( NIC_1 and NIC_2 ),
    then the procedure for telling machine to which of the two NICs to
    send packets ( which this machine itself created ) would be different?

    > >
    > > So in theory if
    > > my routing table had the following entry

    >
    > > 192.168.16.0 mask 255.255.255.0 gateway 192.168.17.2

    >
    > > then packets destined for subnet 192.168.16.0 would go through NIC_2 and
    > > thus to subnet 192.168.17.0?

    >
    > Whatever happens, they would not go to subnet 192.168.17.0. Your router
    > might object to this syntax, or it may accept it. If it accepts it, it
    > probably sends those packets to the network segment where NIC2 is
    > attached.


    So if my PC doesn't object to this syntax, then packets for network
    192.168.16.0 would actually be sent out on second NIC to 192.168.17.0.

    > Where incidentaly subnet 192.168.17.0 is configured as one of
    > the subnets -- in this case the only one -- on this network segment.
    >


    I'm not sure I understand the point you were trying to make here. I
    realise 192.168.17.0. is one of the subnets, but not what you meant
    with "the only one on this network segment".

    >>
    > > in any case, thank you very much

    >
    > You're welcome,
    > M4


    I apologize for being a bit thick

    thank you


  12. Re: IP subnetting

    failure_to@yahoo.co.uk wrote:

    > hello
    >
    > 1) I still don't understand whether the following is allowed:
    >
    > a) Say we have network 192.168.0.0 ( mask 255.255.0.0 ) and we subnet
    > it. Can one of subnets be 192.168.0.0 ( mask 255.255.255.0 )


    Of course it can. Hosts in that subnet will have addresses 192.168.0.1,
    192.168.0.2, ... 192.168.0.254 (host numbers 0 and 255 are reserved).

    >
    > b) Can we also have all-ones subnets?


    You mean 192.168.255.0/24? Yes, it should theoretically be allowed.
    The all-zero and all-one subnets were not allowed in the past (when classful
    addresses were in use). Nowadays most implementation should work correctly
    with them. For the all-zero I can confirm that, for example, cisco routers
    work correctly; for the all-one I'm not sure but it should work (I haven't
    tried it).

    > I hope I don't get flamed for this, but can I ask an additional
    > questions
    >
    > 2) Say my PC is connected to two LANs, thus it has two NICs.
    > * subnet of LAN_1 is 192.168.16.0 ( mask 255.255.255.0 )
    > * subnet of LAN_2 is 192.168.17.0 ( mask 255.255.255.0 )
    >
    > Thus NIC_1 has IP 192.168.16.2 and NIC_2 has IP 192.168.17.2
    >
    > Among other entries in my routing table there is also :
    >
    > 192.168.16.0 mask 255.255.255.0 gateway 192.168.16.2
    >
    > I assume this entry tells my PC that if packet's destination is subnet
    > 192.168.16.0, then packet should be sent through NIC_1.


    Correct.

    > So in theory if my routing table had the following entry
    >
    > 192.168.16.0 mask 255.255.255.0 gateway 192.168.17.2
    >
    > then packets destined for subnet 192.168.16.0 would go through NIC_2
    > and thus to subnet 192.168.17.0?


    You could try it for yourself.
    Without trying, and assuming that ARP requests would be placed on the
    interface belonging to the IP network containing the looked-for address,
    one possibility is that packets would be sent out NIC_2, but proceed no
    further from that network, since they would be addressed at the data-link
    level to hosts physically located on the LAN connected to NIC_1.
    I think this is implementation-dependent however.


  13. Re: IP subnetting

    Barry Margolin a écrit :
    > Pascal Hambourg wrote:
    >
    >>No need to be so complicated. Just add a route telling that the gateway
    >>address is directly reachable on the local network.

    >
    > That requires the implementation to perform recursive route lookup.


    The gateway and the PCs are on the same LAN, so I don't see why
    recursive route lookup is required.

  14. Re: IP subnetting

    thank you all

    cheers


  15. Re: IP subnetting

    On Wed, 19 Dec 2007 16:13:56 -0800, failure_to wrote:

    >> > 2) Say my PC is connected to two LANs, thus it has two NICs. *

    >> subnet of
    >> > LAN_1 is 192.168.16.0 ( mask 255.255.255.0 ) * subnet of LAN_2 is
    >> > 192.168.17.0 ( mask 255.255.255.0 )

    >>
    >> > Thus NIC_1 has IP 192.168.16.2 and NIC_2 has IP 192.168.17.2

    >>
    >> > Among other entries in my routing table there is also :

    >>
    >> > 192.168.16.0 mask 255.255.255.0 gateway 192.168.16.2

    >>
    >> > I assume this entry tells my PC that if packet's destination is
    >> > subnet 192.168.16.0, then packet should be sent through NIC_1.

    >>
    >> Yes, but there is some magic here. Because you give the IP of the
    >> machine itself, you tell it to send the packets out that interface. On
    >> other routers you just tell the router to use that interface.
    >>
    >>

    > By "on other routers" you mean to say that if my machine wasn't ordinary
    > PC but actual router with this two NICs ( NIC_1 and NIC_2 ), then the
    > procedure for telling machine to which of the two NICs to send packets (
    > which this machine itself created ) would be different?


    No, I mean that the syntax to set up the route is different on different
    machines/routers. There are different types of routes, locally connected
    and remote.

    A route for a locally connected subnet tells the computer/router to send
    out on a given device, first using arp to locate the target.

    A remote route has a gateway assigned, all packets for this route go to
    the gateway. The gateway must be on a connected subnet.

    So the procedure for a packet destined for a local subnet is:

    - Consult the routing table, this yields a directly connected route with
    a device the packets should be sent out on.
    - On that device, do an arp query to get the MAC of the target machine.
    - Send the packet directly to the MAC of the target machine.

    For a remote route:

    - Consult the routing table, this yields a remote route with a gateway
    the packets should be send to.
    - Consult the routing table again for the route to the gateway, this
    yields a directly connected route with a device the packets should be
    sent out on.
    - On that device, do an arp query to get the MAC of the gateway machine.
    - Send the packet directly to the MAC of the gateway machine.

    So for a directly connected route the target in the routing table is a
    device, for a remote route, it's the IP address of the gateway. Using the
    IP of the machine itself for a directly connected route is just an
    alternate way to tell the machine which device to use.

    >> > So in theory if
    >> > my routing table had the following entry

    >>
    >> > 192.168.16.0 mask 255.255.255.0 gateway 192.168.17.2

    >>
    >> > then packets destined for subnet 192.168.16.0 would go through NIC_2
    >> > and thus to subnet 192.168.17.0?

    >>
    >> Whatever happens, they would not go to subnet 192.168.17.0. Your router
    >> might object to this syntax, or it may accept it. If it accepts it, it
    >> probably sends those packets to the network segment where NIC2 is
    >> attached.

    >
    > So if my PC doesn't object to this syntax, then packets for network
    > 192.168.16.0 would actually be sent out on second NIC to 192.168.17.0.


    No, not exactly, see below. It would be send out on the NIC to the
    network segment where 192.168.17.0 is. The difference is subtle but
    crucial. It is not send out to 192.168.17.0, but to 192.168.16.0, that is
    what you tell the machine to do. That 192.168.17.0 is on that same
    network segment is coincidental and irrelevant.

    >
    >> Where incidentaly subnet 192.168.17.0 is configured as one of the
    >> subnets -- in this case the only one -- on this network segment.
    >>
    >>

    > I'm not sure I understand the point you were trying to make here. I
    > realise 192.168.17.0. is one of the subnets, but not what you meant with
    > "the only one on this network segment".


    A network segment (actually I'm not completely precise here, but it'll
    do) is a network coupled on layer two where packets can be sent to other
    machines using the MAC of the other machine. In fact, besides broadcast
    and multicast which are not important right now, using the MAC of the
    target machine is the only way to send a packet to another machine.

    On such a network multiple IP subnets can exist. You could assign
    192.168.1.0/24 *and* 10.0.0.0/24 to this subnet and they would coexist
    nicely on the same network segment. It's like having two networks, but
    using one physical one.

    This same network segment could also be used for IPX, Decnet, Netbuei,
    etc.

    So a network segment is a layer two construct, while a subnet is a layer
    three construct. Often, there is a one to one correspondence, but there
    doesn't have to be at all.

    If you want to keep your sanity and avoid some particularly hard to find
    bugs, stick to one subnet on one network segment. But for understanding
    this stuff, it is important to realize there is not a one-to-one relation
    between the tow.

    You're not thick, it *is* hard. (B. Hubert) :-)

    M4

  16. Re: IP subnetting

    Martijn Lievaart a écrit :
    >
    > A route for a locally connected subnet tells the computer/router to send
    > out on a given device, first using arp to locate the target.
    >
    > A remote route has a gateway assigned, all packets for this route go to
    > the gateway. The gateway must be on a connected subnet.
    >
    > So the procedure for a packet destined for a local subnet is:
    >
    > - Consult the routing table, this yields a directly connected route with
    > a device the packets should be sent out on.
    > - On that device, do an arp query to get the MAC of the target machine.
    > - Send the packet directly to the MAC of the target machine.
    >
    > For a remote route:
    >
    > - Consult the routing table, this yields a remote route with a gateway
    > the packets should be send to.
    > - Consult the routing table again for the route to the gateway, this
    > yields a directly connected route with a device the packets should be
    > sent out on.
    > - On that device, do an arp query to get the MAC of the gateway machine.
    > - Send the packet directly to the MAC of the gateway machine.
    >
    > So for a directly connected route the target in the routing table is a
    > device, for a remote route, it's the IP address of the gateway. Using the
    > IP of the machine itself for a directly connected route is just an
    > alternate way to tell the machine which device to use.


    Some implementations operate sligthy differently. A route always
    contains an output interface, whether the destination is locally
    connected or remote. The goal of the routing process is to send the
    packet to the "next hop". If a gateway address is present, the next hop
    is the gateway address. Else the next hop is the destination address of
    the packet itself. Then ARP (or other applicable neighbour discovery
    mechanism) is used to get the MAC address of the next hop on the
    interface specified in the route.

  17. Re: IP subnetting

    thank you all for your help

  18. Re: IP subnetting

    pk wrote:
    > failure_to@yahoo.co.uk wrote:
    >
    >> b) Can we also have all-ones subnets?

    >
    > You mean 192.168.255.0/24? Yes, it should theoretically be allowed.
    > The all-zero and all-one subnets were not allowed in the past (when
    > classful addresses were in use). Nowadays most implementation should
    > work correctly with them. For the all-zero I can confirm that, for
    > example, cisco routers work correctly; for the all-one I'm not sure
    > but it should work (I haven't tried it).


    What exactly are "all-one" and "all-zero" subnets? I have never heard of
    them nor can I find any information on them.

    Thanks.




  19. Re: IP subnetting

    Wayne M. Poe wrote:

    > pk wrote:
    >> failure_to@yahoo.co.uk wrote:
    >>
    >>> b) Can we also have all-ones subnets?

    >>
    >> You mean 192.168.255.0/24? Yes, it should theoretically be allowed.
    >> The all-zero and all-one subnets were not allowed in the past (when
    >> classful addresses were in use). Nowadays most implementation should
    >> work correctly with them. For the all-zero I can confirm that, for
    >> example, cisco routers work correctly; for the all-one I'm not sure
    >> but it should work (I haven't tried it).

    >
    > What exactly are "all-one" and "all-zero" subnets? I have never heard of
    > them nor can I find any information on them.


    Well, as the name implies, those are subnets where the subnet bits are
    either all zero or all one.
    The basic process of subnetting involves assigning more bits to the network
    portion of a network address. For example, if you have the 172.16.0.0/16
    network address, you may decide to extend the network portion of the
    address to, say, 20 bits. In doing so, you are subnetting the original
    172.16.0.0/16 address, creating a number of /20 networks.
    The 4 extra bit are called "the subnet bits", and the "all-zero subnet" is
    the one where these 4 extra bits are all zero. In the same way,
    the "all-one subnet" is the one where these 4 bits are all one.
    In our example, this means that 172.16.0.0/20 is the "all-zero subnet", and
    172.16.240.0/20 is the "all-one subnet".


  20. Re: IP subnetting


    "pk" wrote in message news:fnlfq4$oj9$1@aioe.org...
    > Wayne M. Poe wrote:
    >
    >> pk wrote:
    >>> failure_to@yahoo.co.uk wrote:
    >>>
    >>>> b) Can we also have all-ones subnets?
    >>>
    >>> You mean 192.168.255.0/24? Yes, it should theoretically be allowed.
    >>> The all-zero and all-one subnets were not allowed in the past (when
    >>> classful addresses were in use). Nowadays most implementation should
    >>> work correctly with them. For the all-zero I can confirm that, for
    >>> example, cisco routers work correctly; for the all-one I'm not sure
    >>> but it should work (I haven't tried it).

    >>
    >> What exactly are "all-one" and "all-zero" subnets? I have never heard of
    >> them nor can I find any information on them.

    >
    > Well, as the name implies, those are subnets where the subnet bits are
    > either all zero or all one.


    > The basic process of subnetting involves assigning more bits to the
    > network
    > portion of a network address. For example, if you have the 172.16.0.0/16
    > network address, you may decide to extend the network portion of the
    > address to, say, 20 bits. In doing so, you are subnetting the original
    > 172.16.0.0/16 address, creating a number of /20 networks.
    > The 4 extra bit are called "the subnet bits", and the "all-zero subnet" is
    > the one where these 4 extra bits are all zero. In the same way,
    > the "all-one subnet" is the one where these 4 bits are all one.
    > In our example, this means that 172.16.0.0/20 is the "all-zero subnet",
    > and
    > 172.16.240.0/20 is the "all-one subnet".




    if the subnet bits are all zero - that is the network address of that
    subnetwork
    if the subnet bits are all one - that is the multicast of that subnetwork

    cheers!



+ Reply to Thread
Page 1 of 2 1 2 LastLast