Reputation: 10183
I am having trouble understanding IP addresses, specifically ones with 0s in them.
I understand that an IP address with all 0s for the Host ID refers to the network, such as 128.52.0.0/16
.
Can the network ID of an IP address have 0s in it and still be valid? E.g. 128.52.0.1
with subnet mask 255.255.255.0
.
Can the host ID of an IP address have 0s in it and still be valid? E.g. 128.52.0.1
with subnet mask 255.255.0.0
.
Also, for some reason I got it into my head that IP addresses with 0s for the network ID refers to the host with the host ID on the same network. E.g. 0.0.0.1
on network 192.168.1.0
with subnet mask 255.255.255.0
refers to 192.168.1.1
. Is this correct?
Upvotes: 2
Views: 3698
Reputation: 881353
Can the network ID of an IP address have 0s in it and still be valid? E.g.
128.52.0.1
with subnet mask255.255.255.0
?
Yes. It's perfectly okay for the network ID to have a zero octet.
Can the host ID of an IP address have 0s in it and still be valid? E.g. 128.52.0.1 with subnet mask 255.255.0.0?
Yes. It's perfectly okay for the host ID to have a zero octet although you should be made aware that the all-zero-bit host ID is reserved by convention, meant to refer to the network as a whole (just like the all-one-bit host ID is reserved as a broadcast address, meant to refer to every single host on the network).
Also, for some reason I got it into my head ...
This is correct, 0.0.0.0/8
is used for self-identification according to RFC5735:
0.0.0.0/8
- Addresses in this block refer to source hosts on "this" network. Address0.0.0.0/32
may be used as a source address for this host on this network; other addresses within0.0.0.0/8
may be used to refer to specified hosts on this network ([RFC1122], Section 3.2.1.3).
The convention is to use all-one-bits to mean every "object" and all-zero-bits to mean this "object". Quoting from "Internetworking with TCP/IP", Douglas E. Comer
:
Using netid 0 is especially important in those cases where a host wants to communicate over a network but does not yet know the network IP address. The host uses network id 0 temporarily, and other hosts on the network interpret the address as meaning "this" network. In most cases, replies will have the network address fully specified, allowing the original sender to record it for future use.
It may not be used that much in the "regular" world since both BOOTP and DHCP use the limited broadcast variant (all one bits) in situations where they don't yet know their network ID. But, since the RFC hasn't been obsoleted, I guess it's still valid.
Upvotes: 4
Reputation: 34537
128.52.0.1 is just an ip address on 128.52.0.0/16 network. Network id in this case is 128.52.0.0. Subnetmask, howerver, is 255.255.0.0. Mask of 255.255.255.0 corresponds to /24 subnet.
Your last paragraph seems correct.
Upvotes: 0