Is Dhcp option 53 mandatory in Dhcp offer? - networking

I'm trying to find out whether option 53 in DHCP offer is mandatory or not.
I've found this short snippet:
in book but I'm looking for any confirmation in rfc. I've checked this one but in section about option 53 there is no word of whether it is mandatory.
Do you have any suggestions about where I can find the answer?

I've found the answer in: https://datatracker.ietf.org/doc/html/rfc2131#section-3
Several options have been defined so far. One particular option -
the "DHCP message type" option - must be included in every DHCP
message. This option defines the "type" of the DHCP message.
Additional options may be allowed, required, or not allowed,
depending on the DHCP message type.

Related

Will a DHCP server hand out leases to unrecognized vendor class identifiers?

Can a DHCP Client that sends option 60 in DISCOVER/REQUEST message get ip-settings (ACK) even if the DHCP server does not recognize the vendor?
i.e will the DHCP server hand out lease but omit vendor specific parameters?
I think nothing prevents server from doing that. Especially given the separation between DISCOVER and REQUEST phases, as the server can answer with what it thinks is appropriate for the client and only if the client is satisfied with the OFFER will it send the REQUEST. So if the client really cares about some specific parameters, it can just ignore the "wrong" OFFER. And server shouldn't care at all.
Also, RFC 2132 specifically says that this information can be ignored:
9.13. Vendor class identifier
...
Servers not equipped to interpret the class-specific information sent by a
client MUST ignore it (although it may be reported). Servers that
respond SHOULD only use option 43 to return the vendor-specific
information to the client.

Could a DNS name look like an IP address?

My question stems from this process: Assume an application has a host or address field and would like to connect to some service at that address. Many applications will look at that address and guess if it is an ip address or a host name. This application may use a function like inet_pton() to do this checking. If the address does look like an ip address, the application would not perform a DNS lookup and use that ip address directly.
Now, I am not suggesting this is a good idea but what if some one defined a dns name that looked like 1.2.3.4. That looks like an ip address so the application above would use that as and ip address and not as a DNS name.
From observation, it seems most applications behave as described in the first paragraph. Which seems beneficial for a few reasons to me. Is there any documentation that states that DNS names that look like IP addresses should not be used. Or any documentation that says that even if some one defined a DNS name to look like an IP address it is OK to not honor it as such.
Others have answered already but I'll add and consolidate.
Relevant RFCs:
https://www.rfc-editor.org/rfc/rfc952 (Original)
https://www.rfc-editor.org/rfc/rfc1123 (Revised)
https://www.rfc-editor.org/rfc/rfc2606 (Extra)
Originally, a hostname could not begin with a number, to disambiguate between hostnames and IP addresses. In the revision, that was changed, and hostnames can begin with a number. Thus, domain names like 127.0.0.1.com are legal. TLDs cannot begin with a number (TLD stands for top level domain, of which .com, .net, .org, country codes, and others are members). Names must contain at least one character, must begin and end with alphanumeric characters, and may freely be up to 64 characters long (though the standard supports longer hostnames, systems are not required to support names longer than 64 characters).
Additionally, as described in the final RFC, some SLDs and TLDs are reserved and cannot be registered.
The relevant specification to look at is Section 2.1 of RFC 1123:
If a dotted-decimal number can be entered without such identifying delimiters, then a full syntactic check must be made, because a segment of a host domain name is now allowed to begin with a digit and could legally be entirely numeric (see Section 6.1.2.4). However, a valid host name can never have the dotted-decimal form #.#.#.#, since at least the highest-level component label will be alphabetic.

Asterisk + NAT. Either get called or be called

My Asterisk set up is as follows:
- I have 2 grandstream GXP 2000 phones connected to my router
- My small linux server (with asterisk) is connected to the router as well
I have a dynamic ip from my isp provider, but I signed up for DynDNS
When I started I could call people and talk to them. If people rang me, the phone would ring, and I could hear them speak. They could not hear me. I found out this was because of the directmedia / canreinvite setting. So I set this to:
canreinvite=no
directmedia=no
Now, people could call me and I could answer. However, due to this change I can call people, but as soon as they answer, I can't hear them, I only hear static. When I remove the two lines I add, everything is back as it was before.
What could be the issue ? The 5060 port is forwarded to my server ,as well as the 1000 - 2000 udp rang.
Regards,
Digits
First of all, you should probably read the sip.conf.sample file delivered with Asterisk. Specifically, read the NAT SUPPORT section. canreinvite and directmedia (which are the same setting by the way) attempt to set up the RTP streams directly between the UAs involved in a call, bypassing Asterisk. Thus, while that setting is affected by NAT, it does not necessarily control the channel driver behavior with respect to NAT - so its not surprising you're still having issues.
Without knowing whether or not the UAs in question are sending rport, its difficult to know for sure what your settings should be. That being said, based on your problem description, you may want to set the 'nat' parameter in your [general] section to either:
nat = force_rport,comedia
; or, depending your version
nat = yes
Note that you can set nat on a peer by peer basis, but that's discouraged for security reasons.
Additionally, you may also need to explore the extern* settings, such as externhost.
Ok, some information for other people in the same situation:
- check your codecs, make sure you get no errors in the Asterisk CLI (command line interface). I got errors, but it worked, so I didn't care. That was a mistake
- upgrade to asterisk 1.8
- set directmedia = no
- it's upd range 10000 to 20000 (I missed a 0).
This all fixed this problem.

Should 0.0.0.0 be accepted as answer to IP/netmask?

For a product system that has prompts to configure the IP/netmask, should 0.0.0.0 etc be accepted when user enter them and throw an error immediately? Or should the system wait until the input is commited and return the error from underlying network adapter?
Prompts like this:
Please enter the IP:
Please enter the netmask:
(when user hit enter, both are commited and error is return, if any)
The argument for immediate rejection is that 0.0.0.0 is so obvious as invalid value. A system should be smart enough to detect that and prevent it from entering.
The argument for later rejection during commit is that there can be various invalid input and it's hard for the IP type system to catch. 1.1.1.1, 1.11.111.111 are invalid as well.
(well theoretically yes but practically not..)
Most systems handle this by having a list of 'martian' address ranges and invalidating things against that list. Whether that's part of the UI or backend validation is highly dependent on your system. If it's a networking system where people will by entering addresses and prefixes frequently, it's better to have that as a foreground capability.
BTW, rather than entering netmasks, modern systems now allow you to enter the number of significant bits, using CIDR's '/' notation for the number of significant bits.

Is 0.0.0.0 a valid IP address?

Is 0.0.0.0 a valid IP address? I want my program to be able to store it as an indication that no address is in use, but this won't work if it's actually valid.
It is valid inasmuch as it contains four octets, each within the range 0 through 255 inclusive. However, it is not usable as a real IP address.
RFC1700 (a) states that 0.0.0.0/8 (0.<anything>.<anything>.<anything>) is reserved as a source address only. You can get into situation where it appears you have this address but that's normally because no address has been assigned to you (by DHCP, for example).
See also Wikipedia entry on IPv4.
(a) Although this RFC is now considered obsolete, it is still correct in terms of the given behaviour. Its replacement, https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml, still has the same text detailing use of the 0.0.0.0 address.
Lets look at the Question being asked here by the OP.
Is 0.0.0.0 a valid IP address?
Yes. This is technically a valid IP address, and the other answers describe many various uses of it (I am not going to repost wikipedia links here ... or maybe I am).
As such I believe paxdiablo's answer above is the most correct, but lets look at the context of your question as well.
I want my program to be able to store it as an indication that no address is in use, but this won't work if it's actually valid.
This entirely depends on your use case. Given that this is a programmers forum, lets consider that perspective.
If your software is storing actual internet addresses - server locations, visitors to your website, replication/mirror or backup sites, web service or database servers etc. - then this will be perfectly valid. No machine on the internet will ever have this address assigned, nor will it ever resolve to a valid connection.
If on the other hand you are writing firewall or router firmware, then this address does take on special meaning; default route, accept any IP source/destination, block all IP source/destination, fall-trough catch-all, etc. as outlined by everyone else. However, let me point out that if you are coding on this level you should have a good enough understanding of network protocols so as to not need to ask this question in the first place.
I am therefore going to assume that most people viewing this question fall into the first category, and suggest that this is a perfectly valid way of storing a null, empty or missing IP address, if there is some reason that an actual null value cannot be used. Even if you neglect validation checking and your software does try to connect to this IP address, it will simply not be able to make a connection.
The 0.0.0.0 is used to bind all IPv4 interfaces. So it's a special value just like 127.0.0.1.
Yes, it is an IP address but it is reserved.
0.0.0.0/8 - Addresses in this block refer to source hosts on "this"
network. Address 0.0.0.0/32 may be used as a source address for this
host on this network; other addresses within 0.0.0.0/8 may be used to
refer to specified hosts on this network
It's reserved as the default route address.
It's common to see this via ipconfig when no address has been assigned to you.
for all intents and purposes, yes. Each of the four numbers separated by the period have a value ranging from 0-255, so 0.0.0.0 is technically valid.
I don't think that there would be anyone in the world who actually has that IP though.
EDIT: okay, it is reserved for the default route, but it is still valid.
You can use it in your application to represent that it does not have an IP address, Microsoft also uses 0.0.0.0 when the machine has no IP address.
the "Valid" scenarios talked about above are dependent on the specific scenarios where they have nothing to do with your application.
Doing a Network Whois query can also produce output that is quite helpful.
Example:
http://whois.arin.net/rest/nets;q=0.0.0.0?showDetails=true
Comment: The address 0.0.0.0 may only be used as the address of an outgoing packet when a computer is learning which IP address it should use. It is never used as a destination address. Addresses starting with "0." are sometimes used for broadcasts to directly connected devices.
As other answers have covered, 0.0.0.0 is a legal and valid for some purposes IP address.
If all values in a range are legal values, then any flag items you want to define must come from somewhere else. Otherwise you will overload a legal value with the meaning of a flag, and when using the overloaded value it won't be 100% possible to determine whether the legal value or the flag meaning was intended. This will lead to bugs which must be solved with a re-factor which can be an expensive endeavour.
Overloading legal values happens all the time, IP address and MAC addresses (yes, 00:00:00:00:00:00 is legal and allocated) are some of the most common victims.
Coincidentally, I am working on a system (not ethernet/IP based) now where the length of a frame is capped at about 40 bytes. Since a byte can represent lengths of 0 - 255 bytes, and the max length is 40 bytes, I can use some of the unused aka non-legal values (252 to 255) to represent flag items. These in-band flags are okay because there is no overloading.
of course it is.
it will not be valid for a single host on a network however. it is in the broadcast range for the local network. read here: https://www.rfc-editor.org/rfc/rfc1700

Resources