Specify an IP in CIDR notation


I would have liked to specify IP addresses in CIDR notation and not with a netmask. The documentation doesn't specify how to do this. Moreover, it seems that there are several variants available.


# /etc/config/dhcp
uci del dhcp.lan.ra_slaac
uci del dhcp.lan.domain
uci add_list dhcp.lan.domain='lan'
# /etc/config/network
uci del network.lan.netmask
uci del network.lan.ipaddr
uci add_list network.lan.ipaddr=''

This adds a list of IP addresses in CIDR notation.


The following notation seems to work but I'm not sure.

# /etc/config/network
uci set network.lan.ipaddr=''

It would be a good idea to indicate how to specify an IP address in CIDR notation in the documentation if this is possible.

Best regards,

It changes from place to place, but ok, it is totally impractical and useless to have other than CIDR bitmasks for netmask.

OpenWrt supports both ipaddr/netmask and ipaddr/bitcount notation.

So both these variants are valid and equivalent:

option ipaddr
option ipaddr


I would like you to substantiate this or, alternatively, refrain from making such blanket statements.

1 Like

Good to know!

Currently, there's no mention of this on either the IPv4 configuration or IPv4 examples pages.

Could we add a mention in the documentation?

The same as before: How is it "totally impractical and useless" to use dotted-decimal notation?

Manage your tone, please.

1 Like

Edited for clarity: RFC 4632 deprecates the outdated Class A/B/C segmentation of address space in favor of classless addressing, and naturally it uses CIDR prefix notation to, well, describe CIDR. Nowhere does it discourage the use of quad-dotted notation (which carries the exact same information as CIDR prefixes).

Let me chime in (because we had similar run ins in the recent past), yes, please try to accomodate to the fact that in a public forum maximally terse postings generally do not drive the discussion in a productive direction.
Generally, if you do not have the time to explicitly explain your position well enough others might understand the rationale, consider twice whether posting something terse has sufficient utility to be worth posting at all? Sure there are threads asking for pure oppions, but even there an oppinion with a rationale typically is more helpful.


I guess if one assumes only special cases like where full bytes are zerod out that might be a confusion one can end up in, but once one realises that is also a valid quad dotted notation the confusion should dissipate....

1 Like