Ethernet Configuration¶
Basic Configuration¶
DHCP (Dynamic IP)¶
Static IP¶
network:
version: 2
ethernets:
eth0:
addresses:
- 192.168.1.100/24
routes:
- to: default
via: 192.168.1.1
nameservers:
addresses:
- 1.1.1.1
- 8.8.8.8
Dual Stack (IPv4 + IPv6)¶
Static Dual Stack¶
network:
version: 2
ethernets:
eth0:
addresses:
- 192.168.1.100/24
- "2001:db8::100/64"
routes:
- to: default
via: 192.168.1.1
- to: default
via: "2001:db8::1"
nameservers:
addresses:
- 1.1.1.1
- "2001:4860:4860::8888"
Interface Identification¶
By Device Name¶
Most common, uses predictable naming:
ethernets:
enp5s0: # PCI bus 5, slot 0
dhcp4: true
eno1: # Onboard port 1
dhcp4: true
ens192: # VMware interface
dhcp4: true
By MAC Address¶
Identify specific hardware:
By Driver¶
Match all interfaces using a driver:
Rename Interface¶
Multiple Addresses¶
Primary and Secondary¶
ethernets:
eth0:
addresses:
- 192.168.1.100/24 # Primary
- 192.168.1.101/24 # Secondary
- 192.168.1.102/24 # Another secondary
Different Subnets¶
ethernets:
eth0:
addresses:
- 192.168.1.100/24
- 10.0.0.100/24
routes:
- to: default
via: 192.168.1.1
With Labels¶
DHCP Options¶
Basic DHCP Customization¶
ethernets:
eth0:
dhcp4: true
dhcp4-overrides:
use-dns: true # Use DHCP DNS
use-ntp: true # Use DHCP NTP
use-hostname: true # Set hostname from DHCP
use-mtu: true # Use DHCP MTU
use-routes: true # Use DHCP routes
use-domains: true # Use DHCP search domains
send-hostname: true # Send hostname to server
Route Metric¶
Control route priority:
ethernets:
eth0:
dhcp4: true
dhcp4-overrides:
route-metric: 100 # Lower = higher priority
eth1:
dhcp4: true
dhcp4-overrides:
route-metric: 200 # Backup route
Custom Hostname¶
ethernets:
eth0:
dhcp4: true
dhcp4-overrides:
send-hostname: true
hostname: myserver # Send this hostname
Ignore DHCP Options¶
ethernets:
eth0:
dhcp4: true
dhcp4-overrides:
use-dns: false # Use static DNS instead
use-routes: false # Use static routes instead
nameservers:
addresses: [1.1.1.1]
routes:
- to: default
via: 192.168.1.1
DNS Configuration¶
Static DNS Servers¶
ethernets:
eth0:
addresses:
- 192.168.1.100/24
nameservers:
addresses:
- 192.168.1.1 # Local
- 1.1.1.1 # Cloudflare
- 8.8.8.8 # Google
Search Domains¶
ethernets:
eth0:
dhcp4: true
nameservers:
search:
- example.com
- internal.example.com
addresses:
- 192.168.1.1
DHCP with DNS Override¶
ethernets:
eth0:
dhcp4: true
dhcp4-overrides:
use-dns: false # Ignore DHCP DNS
nameservers:
addresses:
- 1.1.1.1 # Use Cloudflare instead
Routing¶
Default Gateway¶
Multiple Routes¶
ethernets:
eth0:
addresses:
- 192.168.1.100/24
routes:
- to: default
via: 192.168.1.1
- to: 10.0.0.0/8
via: 192.168.1.254
- to: 172.16.0.0/12
via: 192.168.1.253
Route Options¶
ethernets:
eth0:
addresses:
- 192.168.1.100/24
routes:
- to: 10.0.0.0/8
via: 192.168.1.254
metric: 100 # Priority
on-link: true # Gateway is on-link
table: 100 # Routing table
Link Properties¶
MTU¶
MAC Address Override¶
Wake-on-LAN¶
Link-Local Addresses¶
ethernets:
eth0:
dhcp4: true
link-local: [ipv4, ipv6] # Enable both
eth1:
dhcp4: true
link-local: [] # Disable link-local
Boot Behavior¶
Optional Interface¶
Don't wait for this interface at boot:
Critical Interface¶
Default behavior - wait for interface:
Activation Mode¶
Hardware Settings¶
Offloading¶
ethernets:
eth0:
dhcp4: true
receive-checksum-offload: true
transmit-checksum-offload: true
tcp-segmentation-offload: true
generic-segmentation-offload: true
generic-receive-offload: true
large-receive-offload: true
Ring Buffers¶
Multiple NICs¶
Different Roles¶
network:
version: 2
ethernets:
# Management network
eno1:
addresses:
- 192.168.1.100/24
routes:
- to: default
via: 192.168.1.1
nameservers:
addresses: [192.168.1.1]
# Storage network
enp5s0:
addresses:
- 10.0.0.100/24
mtu: 9000
routes:
- to: 10.0.0.0/8
via: 10.0.0.1
# VM network (no IP on host)
enp6s0:
dhcp4: false
dhcp6: false
Failover with Metrics¶
network:
version: 2
ethernets:
eth0:
dhcp4: true
dhcp4-overrides:
route-metric: 100 # Primary
eth1:
dhcp4: true
dhcp4-overrides:
route-metric: 200 # Failover
Server Examples¶
Basic Server¶
network:
version: 2
renderer: networkd
ethernets:
enp5s0:
addresses:
- 192.168.1.100/24
routes:
- to: default
via: 192.168.1.1
nameservers:
search: [home.local]
addresses: [192.168.1.1, 1.1.1.1]
Multi-Homed Server¶
network:
version: 2
renderer: networkd
ethernets:
# Public interface
enp1s0:
addresses:
- 203.0.113.100/24
routes:
- to: default
via: 203.0.113.1
nameservers:
addresses: [1.1.1.1]
# Private interface
enp2s0:
addresses:
- 10.0.0.100/24
routes:
- to: 10.0.0.0/8
via: 10.0.0.1
metric: 100