NMSettingIP4Config — Describes IPv4 addressing, routing, and name service properties


char * dhcp-client-id Read / Write
char * dhcp-fqdn Read / Write
char * dhcp-vendor-class-identifier Read / Write

Object Hierarchy

    ╰── NMSetting
        ╰── NMSettingIPConfig
            ╰── NMSettingIP4Config


The NMSettingIP4Config object is a NMSetting subclass that describes properties related to IPv4 addressing, routing, and Domain Name Service.

NMSettingIP4Config has few properties or methods of its own; it inherits almost everything from NMSettingIPConfig.

NetworkManager supports 5 values for the “method” property for IPv4. If "auto" is specified then the appropriate automatic method (DHCP, PPP, etc) is used for the interface and most other properties can be left unset. If "link-local" is specified, then a link-local address in the 169.254/16 range will be assigned to the interface. If "manual" is specified, static IP addressing is used and at least one IP address must be given in the "addresses" property. If "shared" is specified (indicating that this connection will provide network access to other computers) then the interface is assigned an address in the 10.42.x.1/24 range and a DHCP and forwarding DNS server are started, and the interface is NAT-ed to the current default network connection. "disabled" means IPv4 will not be used on this connection.


nm_setting_ip4_config_new ()

NMSetting *
nm_setting_ip4_config_new (void);

Creates a new NMSettingIP4Config object with default values.


the new empty NMSettingIP4Config object.

[transfer full]

nm_setting_ip4_config_get_dhcp_client_id ()

const char *
                               (NMSettingIP4Config *setting);

Returns the value contained in the “dhcp-client-id” property.



the NMSettingIP4Config



the configured Client ID to send to the DHCP server when requesting addresses via DHCP.

nm_setting_ip4_config_get_dhcp_fqdn ()

const char *
nm_setting_ip4_config_get_dhcp_fqdn (NMSettingIP4Config *setting);

Returns the value contained in the “dhcp-fqdn” property.



the NMSettingIP4Config



the configured FQDN to send to the DHCP server

Since: 1.2

nm_setting_ip4_config_get_dhcp_vendor_class_identifier ()

const char *
                               (NMSettingIP4Config *setting);

Returns the value contained in the “dhcp_vendor_class_identifier” property.



the NMSettingIP4Config



the vendor class identifier option to send to the DHCP server

Since: 1.28

Types and Values




#define NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID               "dhcp-client-id"


#define NM_SETTING_IP4_CONFIG_DHCP_FQDN                    "dhcp-fqdn"


#define NM_SETTING_IP4_CONFIG_DHCP_VENDOR_CLASS_IDENTIFIER "dhcp-vendor-class-identifier"



IPv4 configuration should be automatically determined via a method appropriate for the hardware interface, ie DHCP or PPP or some other device-specific manner.



IPv4 configuration should be automatically configured for link-local-only operation.



All necessary IPv4 configuration (addresses, prefix, DNS, etc) is specified in the setting's properties.



This connection specifies configuration that allows other computers to connect through it to the default network (usually the Internet). The connection's interface will be assigned a private address, and a DHCP server, caching DNS server, and Network Address Translation (NAT) functionality will be started on this connection's interface to allow other devices to connect through that interface to the default network.



This connection does not use or require IPv4 address and it should be disabled.


typedef struct _NMSettingIP4Config NMSettingIP4Config;

IPv4 Settings

Property Details

The “dhcp-client-id” property

  “dhcp-client-id”           char *

A string sent to the DHCP server to identify the local machine which the DHCP server may use to customize the DHCP lease and options. When the property is a hex string ('aa:bb:cc') it is interpreted as a binary client ID, in which case the first byte is assumed to be the 'type' field as per RFC 2132 section 9.14 and the remaining bytes may be an hardware address (e.g. '01:xx:xx:xx:xx:xx:xx' where 1 is the Ethernet ARP type and the rest is a MAC address). If the property is not a hex string it is considered as a non-hardware-address client ID and the 'type' field is set to 0.

The special values "mac" and "perm-mac" are supported, which use the current or permanent MAC address of the device to generate a client identifier with type ethernet (01). Currently, these options only work for ethernet type of links.

The special value "ipv6-duid" uses the DUID from "ipv6.dhcp-duid" property as an RFC4361-compliant client identifier. As IAID it uses "ipv4.dhcp-iaid" and falls back to "ipv6.dhcp-iaid" if unset.

The special value "duid" generates a RFC4361-compliant client identifier based on "ipv4.dhcp-iaid" and uses a DUID generated by hashing /etc/machine-id.

The special value "stable" is supported to generate a type 0 client identifier based on the stable-id (see connection.stable-id) and a per-host key. If you set the stable-id, you may want to include the "${DEVICE}" or "${MAC}" specifier to get a per-device key.

If unset, a globally configured default is used. If still unset, the default depends on the DHCP plugin.

Owner: NMSettingIP4Config

Flags: Read / Write

Default value: NULL

The “dhcp-fqdn” property

  “dhcp-fqdn”                char *

If the “dhcp-send-hostname” property is TRUE, then the specified FQDN will be sent to the DHCP server when acquiring a lease. This property and “dhcp-hostname” are mutually exclusive and cannot be set at the same time.

Owner: NMSettingIP4Config

Flags: Read / Write

Default value: NULL

Since: 1.2

The “dhcp-vendor-class-identifier” property

  “dhcp-vendor-class-identifier” char *

The Vendor Class Identifier DHCP option (60). Special characters in the data string may be escaped using C-style escapes, nevertheless this property cannot contain nul bytes. If the per-profile value is unspecified (the default), a global connection default gets consulted. If still unspecified, the DHCP option is not sent to the server.

Since 1.28

Owner: NMSettingIP4Config

Flags: Read / Write

Default value: NULL