IP Address Configuration¶
This section details IP Addresses And Other Per-Interface IP settings.
Infix support several network interface types, each can be assigned one or more IP addresses, both IPv4 and IPv6 are supported. (There is no concept of a "primary" address.)
IPv4 Address Assignment¶
Multiple address assignment methods are available:
| Type | Yang Model | Description |
|---|---|---|
| static | ietf-ip | Static assignment of IPv4 address, e.g., 10.0.1.1/24 |
| link-local | infix-ip | Auto-assignment of IPv4 address in 169.254.x.x/16 range |
| dhcp | infix-dhcp-client | Assignment of IPv4 address by DHCP server, e.g., 10.0.1.1/24 |
Note
The DHCP address method is only available for LAN interfaces (Ethernet, virtual Ethernet (veth), bridge, link aggregates, etc.)
Supported DHCP (request) options, configurability (Cfg) and defaults,
are listed below. Configurable options can be disabled on a per client
interface basis, some options, like clientid and option 81, are
possible to set the value of as well.
| Opt | Name | Cfg | Description |
|---|---|---|---|
| 1 | netmask |
No | Request IP address and netmask |
| 3 | router |
Yes | Default route(s), see also option 121 and 249 |
| 6 | dns-server |
Yes | DNS server(s), static ones take precedence |
| 12 | hostname |
Yes | DHCP cannot set hostname, only for informing server |
| 15 | domain |
Yes | Default domain name, for name resolution |
| 28 | broadcast |
Yes | Broadcast address, calculated if disabled |
| 42 | ntp-server |
Yes | NTP server(s), static ones take precedence |
| 50 | address |
Yes | Request (previously cached) address |
| 61 | client-id |
Yes | Default MAC address (and option 12) |
| 81 | fqdn |
Yes | Similar to option 12, request FQDN update in DNS |
| 119 | search |
Yes | Request domain search list |
| 121 | classless-static-route |
Yes | Classless static routes |
| 249 | ms-classless-static-route |
Yes | Microsoft static route, same as option 121 |
Default: router, dns-server, domain, broadcast, ntp-server, search,
address, classless-static-route, ms-classless-static-route
When configuring a DHCP client, ensure that the NTP client is enabled
for the ntp-server DHCP option to be processed correctly. If the NTP
client is not enabled, any NTP servers provided by the DHCP server will
be ignored. For details on how to enable the NTP client, see the NTP
Client Configuration section.
Important
Per RFC3442, if the DHCP server returns both a Classless Static Routes option (121) and Router option (3), the DHCP client must ignore the latter.
IPv6 Address Assignment¶
Multiple address assignment methods are available:
| Type | Yang Model | Description |
|---|---|---|
| static | ietf-ip | Static assignment of IPv6 address, e.g., 2001:db8:0:1::1/64 |
| link-local | ietf-ip1 | (RFC4862) Auto-configured link-local IPv6 address (fe80::0 prefix + interface identifier, e.g., fe80::ccd2:82ff:fe52:728b/64) |
| global auto-conf | ietf-ip | (RFC4862) Auto-configured (stateless) global IPv6 address (prefix from router + interface identifier, e.g., 2001:db8:0:1:ccd2:82ff:fe52:728b/64 |
| dhcp | infix-dhcpv6-client | Assignment of IPv6 address by DHCPv6 server, e.g., 2001:db8::42/128 |
Both for link-local and global auto-configuration, it is possible to auto-configure using a random suffix instead of the interface identifier.
Note
The DHCPv6 address method is only available for LAN interfaces (Ethernet, virtual Ethernet (veth), bridge, link aggregates, etc.)
Supported DHCPv6 (request) options, configurability (Cfg) and defaults,
are listed below. Configurable options can be disabled on a per client
interface basis, some options, like client-id and client-fqdn, are
possible to set the value of as well.
| Opt | Name | Cfg | Description |
|---|---|---|---|
| 1 | client-id |
Yes | Client identifier (DUID), auto-generated by default |
| 2 | server-id |
Yes | Server identifier (DUID) |
| 23 | dns-server |
Yes | DNS recursive name servers, static ones take precedence |
| 24 | domain-search |
Yes | Domain search list |
| 25 | ia-pd |
Yes | Prefix delegation for downstream networks |
| 31 | sntp-server |
Yes | Simple Network Time Protocol servers |
| 32 | information-refresh-time |
Yes | Refresh time for stateless DHCPv6 |
| 39 | client-fqdn |
Yes | Client FQDN, request DNS update from server |
| 56 | ntp-server |
Yes | NTP time servers, static ones take precedence |
Default: dns-server, domain-search, ntp-server
DHCPv6 supports both stateful (address assignment) and stateless (information-only) modes:
- Stateful DHCPv6: The server assigns IPv6 addresses to clients. This is the default mode when enabling the DHCPv6 client.
- Stateless DHCPv6: Used with SLAAC (Stateless Address Autoconfiguration)
when only configuration information (DNS, NTP, etc.) is needed. Enable with
the
information-onlysetting.
When configuring a DHCPv6 client, ensure that the NTP client is enabled
for the ntp-server DHCPv6 option to be processed correctly. If the
NTP client is not enabled, any NTP servers provided by the DHCPv6 server
will be ignored. For details on how to enable the NTP client, see the
NTP Client Configuration section.
Examples¶
admin@example:/> show interfaces
INTERFACE PROTOCOL STATE DATA
eth0 ethernet UP 02:00:00:00:00:00
ipv6 fe80::ff:fe00:0/64 (link-layer)
lo ethernet UP 00:00:00:00:00:00
ipv4 127.0.0.1/8 (static)
ipv6 ::1/128 (static)
admin@example:/>
To illustrate IP address configuration, the examples below uses a switch with a single Ethernet interface (eth0) and a loopback interface (lo). As shown above, these examples assume eth0 has an IPv6 link-local address and lo has static IPv4 and IPv6 addresses by default.
Static and link-local IPv4 addresses¶
admin@example:/> configure
admin@example:/config/> edit interface eth0 ipv4
admin@example:/config/interface/eth0/ipv4/> set address 10.0.1.1 prefix-length 24
admin@example:/config/interface/eth0/ipv4/> set autoconf
admin@example:/config/interface/eth0/ipv4/> diff
+interfaces {
+ interface eth0 {
+ ipv4 {
+ address 10.0.1.1 {
+ prefix-length 24;
+ }
+ autoconf;
+ }
+ }
+}
admin@example:/config/interface/eth0/ipv4/> leave
admin@example:/> show interfaces
INTERFACE PROTOCOL STATE DATA
eth0 ethernet UP 02:00:00:00:00:00
ipv4 169.254.1.3/16 (random)
ipv4 10.0.1.1/24 (static)
ipv6 fe80::ff:fe00:0/64 (link-layer)
lo ethernet UP 00:00:00:00:00:00
ipv4 127.0.0.1/8 (static)
ipv6 ::1/128 (static)
admin@example:/>
As shown, the link-local IPv4 address is configured with set autoconf.
The presence of the autoconf container enables IPv4 link-local address
assignment. The resulting address (169.254.1.3/16) is of type random
(ietf-ip.yang).
The IPv4LL client also supports a request-address setting which can be
used to "seed" the client's starting address. If the address is free it
will be used, otherwise it falls back to the default algorithm.
admin@example:/config/interface/eth0/ipv4/> edit autoconf
admin@example:/config/interface/eth0/ipv4/autoconf/> set request-address 169.254.1.2
admin@example:/config/interface/eth0/ipv4/autoconf/> leave
Use of DHCP for IPv4 address assignment¶
admin@example:/> configure
admin@example:/config/> edit interface eth0 ipv4
admin@example:/config/interface/eth0/ipv4/> set dhcp
admin@example:/config/interface/eth0/ipv4/> leave
admin@example:/> show interfaces
INTERFACE PROTOCOL STATE DATA
eth0 ethernet UP 02:00:00:00:00:00
ipv4 10.1.2.100/24 (dhcp)
ipv6 fe80::ff:fe00:0/64 (link-layer)
lo ethernet UP 00:00:00:00:00:00
ipv4 127.0.0.1/8 (static)
ipv6 ::1/128 (static)
admin@example:/>
The resulting address (10.1.2.100/24) is of type dhcp.
To configure DHCP client options, such as sending a specific hostname to the server, you can specify options with values:
admin@example:/> configure
admin@example:/config/> edit interface eth0 ipv4 dhcp
admin@example:/config/interface/eth0/ipv4/dhcp/> set option hostname value myhost
admin@example:/config/interface/eth0/ipv4/dhcp/> show
option hostname {
value myhost;
}
admin@example:/config/interface/eth0/ipv4/dhcp/> leave
admin@example:/>
Tip
The special value auto can be used with the hostname option to
automatically use the configured system hostname.
Other useful DHCP options include:
client-id- Send a specific client identifier to the serverroute-preference- Set the administrative distance for DHCP-learned routes (default: 5)
For advanced usage with vendor-specific options, see the YANG model.
Use of DHCPv6 for IPv6 address assignment¶
admin@example:/> configure
admin@example:/config/> edit interface eth0 ipv6
admin@example:/config/interface/eth0/ipv6/> set dhcp
admin@example:/config/interface/eth0/ipv6/> leave
admin@example:/> show interface
INTERFACE PROTOCOL STATE DATA
eth0 ethernet UP 02:00:00:00:00:00
ipv6 2001:db8::42/128 (dhcp)
ipv6 fe80::ff:fe00:0/64 (link-layer)
lo ethernet UP 00:00:00:00:00:00
ipv4 127.0.0.1/8 (static)
ipv6 ::1/128 (static)
admin@example:/>
The resulting address (2001:db8::42/128) is of type dhcp.
To configure DHCPv6 client options, such as requesting prefix delegation for downstream networks, you can specify options:
admin@example:/> configure
admin@example:/config/> edit interface eth0 ipv6 dhcp
admin@example:/config/interface/eth0/ipv6/dhcp/> set option ia-pd
admin@example:/config/interface/eth0/ipv6/dhcp/> set option dns-server
admin@example:/config/interface/eth0/ipv6/dhcp/> show
option dns-server;
option ia-pd;
admin@example:/config/interface/eth0/ipv6/dhcp/> leave
admin@example:/>
For stateless DHCPv6 (used with SLAAC to get only configuration information):
admin@example:/> configure
admin@example:/config/> edit interface eth0 ipv6 dhcp
admin@example:/config/interface/eth0/ipv6/dhcp/> set information-only true
admin@example:/config/interface/eth0/ipv6/dhcp/> show
information-only true;
option dns-server;
option domain-search;
admin@example:/config/interface/eth0/ipv6/dhcp/> leave
admin@example:/>
Other useful DHCPv6 options include:
duid- Set a specific DHCPv6 Unique Identifier (auto-generated by default)client-fqdn- Request the server to update DNS records with client's FQDNroute-preference- Set the administrative distance for DHCPv6-learned routes (default: 5)
For advanced usage with vendor-specific options, see the YANG model.
Disabling IPv6 link-local address(es)¶
The (only) way to disable IPv6 link-local addresses is by disabling IPv6 on the interface.
admin@example:/> configure
admin@example:/config/> edit interface eth0 ipv6
admin@example:/config/interface/eth0/ipv6/> set enabled false
admin@example:/config/interface/eth0/ipv6/> leave
admin@example:/> show interfaces
INTERFACE PROTOCOL STATE DATA
eth0 ethernet UP 02:00:00:00:00:00
lo ethernet UP 00:00:00:00:00:00
ipv4 127.0.0.1/8 (static)
ipv6 ::1/128 (static)
admin@example:/>
Static IPv6 address¶
admin@example:/> configure
admin@example:/config/> edit interface eth0 ipv6
admin@example:/config/interface/eth0/ipv6/> set address 2001:db8::1 prefix-length 64
admin@example:/config/interface/eth0/ipv6/> leave
admin@example:/> show interfaces
INTERFACE PROTOCOL STATE DATA
eth0 ethernet UP 02:00:00:00:00:00
ipv6 2001:db8::1/64 (static)
ipv6 fe80::ff:fe00:0/64 (link-layer)
lo ethernet UP 00:00:00:00:00:00
ipv4 127.0.0.1/8 (static)
ipv6 ::1/128 (static)
admin@example:/>
Stateless Auto-configuration of Global IPv6 Address¶
Stateless address auto-configuration of global addresses is enabled by default. The address is formed by concatenating the network prefix advertised by the router (here 2001:db8:0:1::0/64) and the interface identifier. The resulting address is of type link-layer, as it is formed based on the interface identifier (ietf-ip.yang).
admin@example:/> show interfaces
INTERFACE PROTOCOL STATE DATA
eth0 ethernet UP 02:00:00:00:00:00
ipv6 2001:db8:0:1:0:ff:fe00:0/64 (link-layer)
ipv6 fe80::ff:fe00:0/64 (link-layer)
lo ethernet UP 00:00:00:00:00:00
ipv4 127.0.0.1/8 (static)
ipv6 ::1/128 (static)
admin@example:/>
Disabling auto-configuration of global IPv6 addresses can be done as shown below.
admin@example:/> configure
admin@example:/config/> edit interface eth0 ipv6
admin@example:/config/interface/eth0/ipv6/> set autoconf create-global-addresses false
admin@example:/config/interface/eth0/ipv6/> leave
admin@example:/> show interfaces
INTERFACE PROTOCOL STATE DATA
eth0 ethernet UP 02:00:00:00:00:00
ipv6 fe80::ff:fe00:0/64 (link-layer)
lo ethernet UP 00:00:00:00:00:00
ipv4 127.0.0.1/8 (static)
ipv6 ::1/128 (static)
admin@example:/>
Random Link Identifiers for IPv6 Stateless Autoconfiguration¶
By default, the auto-configured link-local and global IPv6 addresses are formed from a link-identifier based on the MAC address.
admin@example:/> show interfaces
INTERFACE PROTOCOL STATE DATA
eth0 ethernet UP 02:00:00:00:00:00
ipv6 2001:db8:0:1:0:ff:fe00:0/64 (link-layer)
ipv6 fe80::ff:fe00:0/64 (link-layer)
lo ethernet UP 00:00:00:00:00:00
ipv4 127.0.0.1/8 (static)
ipv6 ::1/128 (static)
admin@example:/>
To avoid revealing identity information in the IPv6 address, it is possible to specify use of a random identifier (ietf-ip.yang and RFC8981).
admin@example:/> configure
admin@example:/config/> edit interface eth0 ipv6
admin@example:/config/interface/eth0/ipv6/> set autoconf create-temporary-addresses true
admin@example:/config/interface/eth0/ipv6/> leave
admin@example:/> show interfaces
INTERFACE PROTOCOL STATE DATA
eth0 ethernet UP 02:00:00:00:00:00
ipv6 2001:db8:0:1:b705:8374:638e:74a8/64 (random)
ipv6 fe80::ad3d:b274:885a:9ffb/64 (random)
lo ethernet UP 00:00:00:00:00:00
ipv4 127.0.0.1/8 (static)
ipv6 ::1/128 (static)
admin@example:/>
Both the link-local address (fe80::) and the global address (2001:) have changed type to random.
IPv4 forwarding¶
To be able to route (static or dynamic) on the interface it is required to enable forwarding. This setting controls if packets received on this interface can be forwarded.
admin@example:/config/> edit interface eth0
admin@example:/config/interface/eth0/> set ipv4 forwarding
admin@example:/config/interface/eth0/> leave
admin@example:/>
IPv6 forwarding¶
Forwarding must be enabled on an interface for it to route IPv6 traffic (static or dynamic). The setting is per-interface and works the same way as IPv4 forwarding.
The following table shows the IPv6 features that the forwarding
setting controls when it is Enabled or Disabled:
| IPv6 Feature | Enabled | Disabled |
|---|---|---|
| IsRouter set in Neighbour Advertisements | Yes | No |
| Transmit Router Solicitations | No | Yes |
| Router Advertisements are ignored | Yes | Yes |
| Accept Redirects | No | Yes |
admin@example:/config/> edit interface eth0
admin@example:/config/interface/eth0/> set ipv6 forwarding
admin@example:/config/interface/eth0/> leave
admin@example:/>