# `VintageNet.IP.IPv4Config`
[🔗](https://github.com/nerves-networking/vintage_net/blob/v0.13.12/lib/vintage_net/ip/ipv4_config.ex#L6)

This is a helper module for VintageNet.Technology implementations that use
IPv4.

IPv4 configuration is specified under the `:ipv4` key in the configuration map.
Fields include:

* `:method` - `:dhcp`, `:static`, or `:disabled`

The `:dhcp` method supports the following optional field:

* `:dhcp_request_options` - a list of additional DHCP option names (strings) to
  request from the DHCP server beyond udhcpc's defaults. Each entry is passed
  through to udhcpc as `-O <entry>`. Either symbolic names ("wpad", "sipsrv")
  or numeric option codes ("252") are accepted; what's recognized depends on
  the busybox version in use. Defaults to `[]`. Values that the DHCP server
  returns are parsed by `VintageNet.DHCP.Options` and exposed via the
  `["interface", ifname, "dhcp_options"]` property. Requesting additional
  options changes the contents of the DHCP request, which some networks use
  to classify or segment clients (for example, fingerprint-based VLAN
  assignment), so only opt in to options you actually need.

The `:static` method uses the following fields:

* `:address` - the IP address
* `:prefix_length` - the number of bits in the IP address to use for the subnet (e.g., 24)
* `:netmask` - either this or `prefix_length` is used to determine the subnet. If you
  have a choice, use `prefix_length`
* `:gateway` - the default gateway for this interface (optional)
* `:name_servers` - a list of DNS servers (optional)
* `:domain` - DNS search domain (optional)

Configuration normalization converts `:netmask` to `:prefix_length`.

# `add_config`

```elixir
@spec add_config(VintageNet.Interface.RawConfig.t(), map(), keyword()) ::
  VintageNet.Interface.RawConfig.t()
```

Add IPv4 configuration commands for supporting static and dynamic IP addressing

# `normalize`

```elixir
@spec normalize(map()) :: %{ipv4: map()}
```

Normalize the IPv4 parameters in a configuration.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
