Leading zeros in IPv4 address; is that a no-no by convention or standard?
up vote
2
down vote
favorite
I teach a class on a software product my company makes and I find that students frequently add leading zeros to a configuration page to have the software connect to our hardware. Leading zeros are problematic in our software, that's how and why this comes up.
I always explained that leading zeros were against "the standard" thinking that's what I had been taught. As I was submitting the bug report up the chain to my engineering department, I was unable to find an authoritative source for this (i.e. "The Standard"), but I did find some interesting and related information.
Are leading zeros bad because of convention, or do they go against the standard?
This was the closest I could find to a standard to not use leading zeros, but it's an expired draft of some kind:
Textual Representation of IPv4 and IPv6 Addresses
In the relevant section, it says:
3 Syntax and Semantics
3.1 IPv4 Dotted Octet Format
A 32-bit IPv4 address is divided into four octets. Each octet is
represented numerically in decimal, using the minimum possible number
of digits (leading zeroes are not used, except in the case of 0
itself). The four encoded octets are given most-significant first,
separated by period characters.
IPv4address = d8 "." d8 "." d8 "." d8
d8 = DIGIT ; 0-9
/ %x31-39 DIGIT ; 10-99
/ "1" 2DIGIT ; 100-199
/ "2" %x30-34 DIGIT ; 200-249
/ "25" %x30-35 ; 250-255
I also found the following articles discussing the phenomenon:
Ping and FTP Resolve IP Address with Leading Zero as Octal
Leading zeros in IP address can result in incorrect routing
Are IP addresses with and without leading zeroes the same?
Is there any documentation for omitting zeroes in dot-decimal notation of IPV4 addresses?
networking ip ipv4
add a comment |
up vote
2
down vote
favorite
I teach a class on a software product my company makes and I find that students frequently add leading zeros to a configuration page to have the software connect to our hardware. Leading zeros are problematic in our software, that's how and why this comes up.
I always explained that leading zeros were against "the standard" thinking that's what I had been taught. As I was submitting the bug report up the chain to my engineering department, I was unable to find an authoritative source for this (i.e. "The Standard"), but I did find some interesting and related information.
Are leading zeros bad because of convention, or do they go against the standard?
This was the closest I could find to a standard to not use leading zeros, but it's an expired draft of some kind:
Textual Representation of IPv4 and IPv6 Addresses
In the relevant section, it says:
3 Syntax and Semantics
3.1 IPv4 Dotted Octet Format
A 32-bit IPv4 address is divided into four octets. Each octet is
represented numerically in decimal, using the minimum possible number
of digits (leading zeroes are not used, except in the case of 0
itself). The four encoded octets are given most-significant first,
separated by period characters.
IPv4address = d8 "." d8 "." d8 "." d8
d8 = DIGIT ; 0-9
/ %x31-39 DIGIT ; 10-99
/ "1" 2DIGIT ; 100-199
/ "2" %x30-34 DIGIT ; 200-249
/ "25" %x30-35 ; 250-255
I also found the following articles discussing the phenomenon:
Ping and FTP Resolve IP Address with Leading Zero as Octal
Leading zeros in IP address can result in incorrect routing
Are IP addresses with and without leading zeroes the same?
Is there any documentation for omitting zeroes in dot-decimal notation of IPV4 addresses?
networking ip ipv4
Thanks for the link edits. Normally I prefer to have the full text of the URL below the title, but I couldn't get that done, and then I couldn't have more than 2 links, so that really cleaned up the question.
– YetAnotherRandomUser
Jun 17 '15 at 16:29
In the end, it all comes down to the parser implementation, so most systems should like it fine, but some may not.... standards implementations are always like that.
– Frank Thomas
Jun 17 '15 at 16:45
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I teach a class on a software product my company makes and I find that students frequently add leading zeros to a configuration page to have the software connect to our hardware. Leading zeros are problematic in our software, that's how and why this comes up.
I always explained that leading zeros were against "the standard" thinking that's what I had been taught. As I was submitting the bug report up the chain to my engineering department, I was unable to find an authoritative source for this (i.e. "The Standard"), but I did find some interesting and related information.
Are leading zeros bad because of convention, or do they go against the standard?
This was the closest I could find to a standard to not use leading zeros, but it's an expired draft of some kind:
Textual Representation of IPv4 and IPv6 Addresses
In the relevant section, it says:
3 Syntax and Semantics
3.1 IPv4 Dotted Octet Format
A 32-bit IPv4 address is divided into four octets. Each octet is
represented numerically in decimal, using the minimum possible number
of digits (leading zeroes are not used, except in the case of 0
itself). The four encoded octets are given most-significant first,
separated by period characters.
IPv4address = d8 "." d8 "." d8 "." d8
d8 = DIGIT ; 0-9
/ %x31-39 DIGIT ; 10-99
/ "1" 2DIGIT ; 100-199
/ "2" %x30-34 DIGIT ; 200-249
/ "25" %x30-35 ; 250-255
I also found the following articles discussing the phenomenon:
Ping and FTP Resolve IP Address with Leading Zero as Octal
Leading zeros in IP address can result in incorrect routing
Are IP addresses with and without leading zeroes the same?
Is there any documentation for omitting zeroes in dot-decimal notation of IPV4 addresses?
networking ip ipv4
I teach a class on a software product my company makes and I find that students frequently add leading zeros to a configuration page to have the software connect to our hardware. Leading zeros are problematic in our software, that's how and why this comes up.
I always explained that leading zeros were against "the standard" thinking that's what I had been taught. As I was submitting the bug report up the chain to my engineering department, I was unable to find an authoritative source for this (i.e. "The Standard"), but I did find some interesting and related information.
Are leading zeros bad because of convention, or do they go against the standard?
This was the closest I could find to a standard to not use leading zeros, but it's an expired draft of some kind:
Textual Representation of IPv4 and IPv6 Addresses
In the relevant section, it says:
3 Syntax and Semantics
3.1 IPv4 Dotted Octet Format
A 32-bit IPv4 address is divided into four octets. Each octet is
represented numerically in decimal, using the minimum possible number
of digits (leading zeroes are not used, except in the case of 0
itself). The four encoded octets are given most-significant first,
separated by period characters.
IPv4address = d8 "." d8 "." d8 "." d8
d8 = DIGIT ; 0-9
/ %x31-39 DIGIT ; 10-99
/ "1" 2DIGIT ; 100-199
/ "2" %x30-34 DIGIT ; 200-249
/ "25" %x30-35 ; 250-255
I also found the following articles discussing the phenomenon:
Ping and FTP Resolve IP Address with Leading Zero as Octal
Leading zeros in IP address can result in incorrect routing
Are IP addresses with and without leading zeroes the same?
Is there any documentation for omitting zeroes in dot-decimal notation of IPV4 addresses?
networking ip ipv4
networking ip ipv4
edited May 23 '17 at 12:41
Community♦
1
1
asked Jun 17 '15 at 16:10
YetAnotherRandomUser
84831230
84831230
Thanks for the link edits. Normally I prefer to have the full text of the URL below the title, but I couldn't get that done, and then I couldn't have more than 2 links, so that really cleaned up the question.
– YetAnotherRandomUser
Jun 17 '15 at 16:29
In the end, it all comes down to the parser implementation, so most systems should like it fine, but some may not.... standards implementations are always like that.
– Frank Thomas
Jun 17 '15 at 16:45
add a comment |
Thanks for the link edits. Normally I prefer to have the full text of the URL below the title, but I couldn't get that done, and then I couldn't have more than 2 links, so that really cleaned up the question.
– YetAnotherRandomUser
Jun 17 '15 at 16:29
In the end, it all comes down to the parser implementation, so most systems should like it fine, but some may not.... standards implementations are always like that.
– Frank Thomas
Jun 17 '15 at 16:45
Thanks for the link edits. Normally I prefer to have the full text of the URL below the title, but I couldn't get that done, and then I couldn't have more than 2 links, so that really cleaned up the question.
– YetAnotherRandomUser
Jun 17 '15 at 16:29
Thanks for the link edits. Normally I prefer to have the full text of the URL below the title, but I couldn't get that done, and then I couldn't have more than 2 links, so that really cleaned up the question.
– YetAnotherRandomUser
Jun 17 '15 at 16:29
In the end, it all comes down to the parser implementation, so most systems should like it fine, but some may not.... standards implementations are always like that.
– Frank Thomas
Jun 17 '15 at 16:45
In the end, it all comes down to the parser implementation, so most systems should like it fine, but some may not.... standards implementations are always like that.
– Frank Thomas
Jun 17 '15 at 16:45
add a comment |
4 Answers
4
active
oldest
votes
up vote
5
down vote
accepted
There is no standard that demands an IPv4 address be expressed a certain way. That is, the RFC doesn't specify one and multiple formats are in widespread use. Most commonly, you'll see four octets as decimal numbers, but you may also see a single 8-digit hexadecimal number or even a single decimal number used instead. Though octal numbers are uncommon, many implementations accept those too.
This is the reason leading zeroes are usually avoided; the address could be ambiguous. '010.010.010.010' could be in a private range, but could also be Google's famous DNS server at '8.8.8.8'. Numbers that start with one leading zero and do not contain the digits 8 or 9 are often interpreted as octal.
Which RFC are you referring to?
– YetAnotherRandomUser
Jun 17 '15 at 17:49
1
@allanonmage - In the context used. The only possability would be the RFC that cover IPv4
– Ramhound
Jun 17 '15 at 18:23
1
RFC 791, to be exact.
– Marcks Thomas
Jun 17 '15 at 20:48
add a comment |
up vote
1
down vote
Ideally it shouldn't matter, as when it breaks down to binary/hex/whatever, the leading zeros shouldn't affect the end result.
Example: 192.168.1.1 to binary
192 = 11000000
168 = 10101000
1 = 00000001
1 = 00000001
Is the exact same as 192.168.001.001
192 = 11000000
168 = 10101000
001 = 00000001
001 = 00000001
See a previous SU answer here.
On some systems they might be interpreted differently, thus they should be avoided: superuser.com/a/857618/27205
– Radu Maris
Nov 4 '15 at 11:59
add a comment |
up vote
0
down vote
0.0.0.0/8 is reserved for the local network (see RFC 6890 or for an easier read https://en.wikipedia.org/wiki/IPv4#Special-use_addresses).
Thus any address starting with 0 is valid but it's not the ip address of a particular machine.
add a comment |
up vote
0
down vote
Let's go way back when some of us were pioneering the Internet world and look at this from an actual historical standpoint.
Historical Fact: Many if not most of the early routers required (again: required) this exact format for IP address inputs: xxx.xxx.xxx.xxx
What this means: Most folks who were around in the 1980s - 1990s configuring routers never gave a second thought to seeing IP addresses shown as: 192.168.001.010 After all, the padding with leading zeros was most often mandatory and never, ever, have I and I doubt most anyone else encountered a router, firewall, IP host of any kind really, that asked for Octal numbers.
And so...
001.001.001.001 = 1.1.1.1
10.001.1.010 = 10.1.1.10 (inconsistently padding only some octets makes me sad)
Why use padding now when almost year 2020 when most systems accept 1-3 base 10 characters in each octet rather than the old school 3? I can think of a reason that I encounter frequently:
A sorted list of IP addresses in Excel.
10.1.1.1
10.100.254.50
10.16.2.3
10.3.129.44
10.3.2.50
^ thats how Excel would sort these addresses (not numerically ordered!)
But if you have a large list of IPs and wish to sort them: use padding zeros so that Excel provides this sorted list:
010.001.001.001
010.003.002.050
010.003.129.044
010.016.002.003
010.100.254.050
Now, if this list were 300+ addresses, lets say, and you wanted to view them in order, padding is your friend.
Also, if these are in a database and a string sort was used to sort the list, padding is also you friend.
add a comment |
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
accepted
There is no standard that demands an IPv4 address be expressed a certain way. That is, the RFC doesn't specify one and multiple formats are in widespread use. Most commonly, you'll see four octets as decimal numbers, but you may also see a single 8-digit hexadecimal number or even a single decimal number used instead. Though octal numbers are uncommon, many implementations accept those too.
This is the reason leading zeroes are usually avoided; the address could be ambiguous. '010.010.010.010' could be in a private range, but could also be Google's famous DNS server at '8.8.8.8'. Numbers that start with one leading zero and do not contain the digits 8 or 9 are often interpreted as octal.
Which RFC are you referring to?
– YetAnotherRandomUser
Jun 17 '15 at 17:49
1
@allanonmage - In the context used. The only possability would be the RFC that cover IPv4
– Ramhound
Jun 17 '15 at 18:23
1
RFC 791, to be exact.
– Marcks Thomas
Jun 17 '15 at 20:48
add a comment |
up vote
5
down vote
accepted
There is no standard that demands an IPv4 address be expressed a certain way. That is, the RFC doesn't specify one and multiple formats are in widespread use. Most commonly, you'll see four octets as decimal numbers, but you may also see a single 8-digit hexadecimal number or even a single decimal number used instead. Though octal numbers are uncommon, many implementations accept those too.
This is the reason leading zeroes are usually avoided; the address could be ambiguous. '010.010.010.010' could be in a private range, but could also be Google's famous DNS server at '8.8.8.8'. Numbers that start with one leading zero and do not contain the digits 8 or 9 are often interpreted as octal.
Which RFC are you referring to?
– YetAnotherRandomUser
Jun 17 '15 at 17:49
1
@allanonmage - In the context used. The only possability would be the RFC that cover IPv4
– Ramhound
Jun 17 '15 at 18:23
1
RFC 791, to be exact.
– Marcks Thomas
Jun 17 '15 at 20:48
add a comment |
up vote
5
down vote
accepted
up vote
5
down vote
accepted
There is no standard that demands an IPv4 address be expressed a certain way. That is, the RFC doesn't specify one and multiple formats are in widespread use. Most commonly, you'll see four octets as decimal numbers, but you may also see a single 8-digit hexadecimal number or even a single decimal number used instead. Though octal numbers are uncommon, many implementations accept those too.
This is the reason leading zeroes are usually avoided; the address could be ambiguous. '010.010.010.010' could be in a private range, but could also be Google's famous DNS server at '8.8.8.8'. Numbers that start with one leading zero and do not contain the digits 8 or 9 are often interpreted as octal.
There is no standard that demands an IPv4 address be expressed a certain way. That is, the RFC doesn't specify one and multiple formats are in widespread use. Most commonly, you'll see four octets as decimal numbers, but you may also see a single 8-digit hexadecimal number or even a single decimal number used instead. Though octal numbers are uncommon, many implementations accept those too.
This is the reason leading zeroes are usually avoided; the address could be ambiguous. '010.010.010.010' could be in a private range, but could also be Google's famous DNS server at '8.8.8.8'. Numbers that start with one leading zero and do not contain the digits 8 or 9 are often interpreted as octal.
answered Jun 17 '15 at 17:07
Marcks Thomas
5,47311736
5,47311736
Which RFC are you referring to?
– YetAnotherRandomUser
Jun 17 '15 at 17:49
1
@allanonmage - In the context used. The only possability would be the RFC that cover IPv4
– Ramhound
Jun 17 '15 at 18:23
1
RFC 791, to be exact.
– Marcks Thomas
Jun 17 '15 at 20:48
add a comment |
Which RFC are you referring to?
– YetAnotherRandomUser
Jun 17 '15 at 17:49
1
@allanonmage - In the context used. The only possability would be the RFC that cover IPv4
– Ramhound
Jun 17 '15 at 18:23
1
RFC 791, to be exact.
– Marcks Thomas
Jun 17 '15 at 20:48
Which RFC are you referring to?
– YetAnotherRandomUser
Jun 17 '15 at 17:49
Which RFC are you referring to?
– YetAnotherRandomUser
Jun 17 '15 at 17:49
1
1
@allanonmage - In the context used. The only possability would be the RFC that cover IPv4
– Ramhound
Jun 17 '15 at 18:23
@allanonmage - In the context used. The only possability would be the RFC that cover IPv4
– Ramhound
Jun 17 '15 at 18:23
1
1
RFC 791, to be exact.
– Marcks Thomas
Jun 17 '15 at 20:48
RFC 791, to be exact.
– Marcks Thomas
Jun 17 '15 at 20:48
add a comment |
up vote
1
down vote
Ideally it shouldn't matter, as when it breaks down to binary/hex/whatever, the leading zeros shouldn't affect the end result.
Example: 192.168.1.1 to binary
192 = 11000000
168 = 10101000
1 = 00000001
1 = 00000001
Is the exact same as 192.168.001.001
192 = 11000000
168 = 10101000
001 = 00000001
001 = 00000001
See a previous SU answer here.
On some systems they might be interpreted differently, thus they should be avoided: superuser.com/a/857618/27205
– Radu Maris
Nov 4 '15 at 11:59
add a comment |
up vote
1
down vote
Ideally it shouldn't matter, as when it breaks down to binary/hex/whatever, the leading zeros shouldn't affect the end result.
Example: 192.168.1.1 to binary
192 = 11000000
168 = 10101000
1 = 00000001
1 = 00000001
Is the exact same as 192.168.001.001
192 = 11000000
168 = 10101000
001 = 00000001
001 = 00000001
See a previous SU answer here.
On some systems they might be interpreted differently, thus they should be avoided: superuser.com/a/857618/27205
– Radu Maris
Nov 4 '15 at 11:59
add a comment |
up vote
1
down vote
up vote
1
down vote
Ideally it shouldn't matter, as when it breaks down to binary/hex/whatever, the leading zeros shouldn't affect the end result.
Example: 192.168.1.1 to binary
192 = 11000000
168 = 10101000
1 = 00000001
1 = 00000001
Is the exact same as 192.168.001.001
192 = 11000000
168 = 10101000
001 = 00000001
001 = 00000001
See a previous SU answer here.
Ideally it shouldn't matter, as when it breaks down to binary/hex/whatever, the leading zeros shouldn't affect the end result.
Example: 192.168.1.1 to binary
192 = 11000000
168 = 10101000
1 = 00000001
1 = 00000001
Is the exact same as 192.168.001.001
192 = 11000000
168 = 10101000
001 = 00000001
001 = 00000001
See a previous SU answer here.
edited Mar 20 '17 at 10:17
Community♦
1
1
answered Jun 17 '15 at 16:42
kazoni
584212
584212
On some systems they might be interpreted differently, thus they should be avoided: superuser.com/a/857618/27205
– Radu Maris
Nov 4 '15 at 11:59
add a comment |
On some systems they might be interpreted differently, thus they should be avoided: superuser.com/a/857618/27205
– Radu Maris
Nov 4 '15 at 11:59
On some systems they might be interpreted differently, thus they should be avoided: superuser.com/a/857618/27205
– Radu Maris
Nov 4 '15 at 11:59
On some systems they might be interpreted differently, thus they should be avoided: superuser.com/a/857618/27205
– Radu Maris
Nov 4 '15 at 11:59
add a comment |
up vote
0
down vote
0.0.0.0/8 is reserved for the local network (see RFC 6890 or for an easier read https://en.wikipedia.org/wiki/IPv4#Special-use_addresses).
Thus any address starting with 0 is valid but it's not the ip address of a particular machine.
add a comment |
up vote
0
down vote
0.0.0.0/8 is reserved for the local network (see RFC 6890 or for an easier read https://en.wikipedia.org/wiki/IPv4#Special-use_addresses).
Thus any address starting with 0 is valid but it's not the ip address of a particular machine.
add a comment |
up vote
0
down vote
up vote
0
down vote
0.0.0.0/8 is reserved for the local network (see RFC 6890 or for an easier read https://en.wikipedia.org/wiki/IPv4#Special-use_addresses).
Thus any address starting with 0 is valid but it's not the ip address of a particular machine.
0.0.0.0/8 is reserved for the local network (see RFC 6890 or for an easier read https://en.wikipedia.org/wiki/IPv4#Special-use_addresses).
Thus any address starting with 0 is valid but it's not the ip address of a particular machine.
answered Jun 17 '15 at 16:55
Jason Parachoniak
1
1
add a comment |
add a comment |
up vote
0
down vote
Let's go way back when some of us were pioneering the Internet world and look at this from an actual historical standpoint.
Historical Fact: Many if not most of the early routers required (again: required) this exact format for IP address inputs: xxx.xxx.xxx.xxx
What this means: Most folks who were around in the 1980s - 1990s configuring routers never gave a second thought to seeing IP addresses shown as: 192.168.001.010 After all, the padding with leading zeros was most often mandatory and never, ever, have I and I doubt most anyone else encountered a router, firewall, IP host of any kind really, that asked for Octal numbers.
And so...
001.001.001.001 = 1.1.1.1
10.001.1.010 = 10.1.1.10 (inconsistently padding only some octets makes me sad)
Why use padding now when almost year 2020 when most systems accept 1-3 base 10 characters in each octet rather than the old school 3? I can think of a reason that I encounter frequently:
A sorted list of IP addresses in Excel.
10.1.1.1
10.100.254.50
10.16.2.3
10.3.129.44
10.3.2.50
^ thats how Excel would sort these addresses (not numerically ordered!)
But if you have a large list of IPs and wish to sort them: use padding zeros so that Excel provides this sorted list:
010.001.001.001
010.003.002.050
010.003.129.044
010.016.002.003
010.100.254.050
Now, if this list were 300+ addresses, lets say, and you wanted to view them in order, padding is your friend.
Also, if these are in a database and a string sort was used to sort the list, padding is also you friend.
add a comment |
up vote
0
down vote
Let's go way back when some of us were pioneering the Internet world and look at this from an actual historical standpoint.
Historical Fact: Many if not most of the early routers required (again: required) this exact format for IP address inputs: xxx.xxx.xxx.xxx
What this means: Most folks who were around in the 1980s - 1990s configuring routers never gave a second thought to seeing IP addresses shown as: 192.168.001.010 After all, the padding with leading zeros was most often mandatory and never, ever, have I and I doubt most anyone else encountered a router, firewall, IP host of any kind really, that asked for Octal numbers.
And so...
001.001.001.001 = 1.1.1.1
10.001.1.010 = 10.1.1.10 (inconsistently padding only some octets makes me sad)
Why use padding now when almost year 2020 when most systems accept 1-3 base 10 characters in each octet rather than the old school 3? I can think of a reason that I encounter frequently:
A sorted list of IP addresses in Excel.
10.1.1.1
10.100.254.50
10.16.2.3
10.3.129.44
10.3.2.50
^ thats how Excel would sort these addresses (not numerically ordered!)
But if you have a large list of IPs and wish to sort them: use padding zeros so that Excel provides this sorted list:
010.001.001.001
010.003.002.050
010.003.129.044
010.016.002.003
010.100.254.050
Now, if this list were 300+ addresses, lets say, and you wanted to view them in order, padding is your friend.
Also, if these are in a database and a string sort was used to sort the list, padding is also you friend.
add a comment |
up vote
0
down vote
up vote
0
down vote
Let's go way back when some of us were pioneering the Internet world and look at this from an actual historical standpoint.
Historical Fact: Many if not most of the early routers required (again: required) this exact format for IP address inputs: xxx.xxx.xxx.xxx
What this means: Most folks who were around in the 1980s - 1990s configuring routers never gave a second thought to seeing IP addresses shown as: 192.168.001.010 After all, the padding with leading zeros was most often mandatory and never, ever, have I and I doubt most anyone else encountered a router, firewall, IP host of any kind really, that asked for Octal numbers.
And so...
001.001.001.001 = 1.1.1.1
10.001.1.010 = 10.1.1.10 (inconsistently padding only some octets makes me sad)
Why use padding now when almost year 2020 when most systems accept 1-3 base 10 characters in each octet rather than the old school 3? I can think of a reason that I encounter frequently:
A sorted list of IP addresses in Excel.
10.1.1.1
10.100.254.50
10.16.2.3
10.3.129.44
10.3.2.50
^ thats how Excel would sort these addresses (not numerically ordered!)
But if you have a large list of IPs and wish to sort them: use padding zeros so that Excel provides this sorted list:
010.001.001.001
010.003.002.050
010.003.129.044
010.016.002.003
010.100.254.050
Now, if this list were 300+ addresses, lets say, and you wanted to view them in order, padding is your friend.
Also, if these are in a database and a string sort was used to sort the list, padding is also you friend.
Let's go way back when some of us were pioneering the Internet world and look at this from an actual historical standpoint.
Historical Fact: Many if not most of the early routers required (again: required) this exact format for IP address inputs: xxx.xxx.xxx.xxx
What this means: Most folks who were around in the 1980s - 1990s configuring routers never gave a second thought to seeing IP addresses shown as: 192.168.001.010 After all, the padding with leading zeros was most often mandatory and never, ever, have I and I doubt most anyone else encountered a router, firewall, IP host of any kind really, that asked for Octal numbers.
And so...
001.001.001.001 = 1.1.1.1
10.001.1.010 = 10.1.1.10 (inconsistently padding only some octets makes me sad)
Why use padding now when almost year 2020 when most systems accept 1-3 base 10 characters in each octet rather than the old school 3? I can think of a reason that I encounter frequently:
A sorted list of IP addresses in Excel.
10.1.1.1
10.100.254.50
10.16.2.3
10.3.129.44
10.3.2.50
^ thats how Excel would sort these addresses (not numerically ordered!)
But if you have a large list of IPs and wish to sort them: use padding zeros so that Excel provides this sorted list:
010.001.001.001
010.003.002.050
010.003.129.044
010.016.002.003
010.100.254.050
Now, if this list were 300+ addresses, lets say, and you wanted to view them in order, padding is your friend.
Also, if these are in a database and a string sort was used to sort the list, padding is also you friend.
answered Nov 21 at 14:23
shaggy1966
11
11
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f929153%2fleading-zeros-in-ipv4-address-is-that-a-no-no-by-convention-or-standard%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Thanks for the link edits. Normally I prefer to have the full text of the URL below the title, but I couldn't get that done, and then I couldn't have more than 2 links, so that really cleaned up the question.
– YetAnotherRandomUser
Jun 17 '15 at 16:29
In the end, it all comes down to the parser implementation, so most systems should like it fine, but some may not.... standards implementations are always like that.
– Frank Thomas
Jun 17 '15 at 16:45