( l0ud | 2020. 10. 07., sze – 22:07 )

De a dhcpcd-t tudod nagyon ügyesen static IP-re is konfigurálni:(vagy fallback to static ha nincs DHCP...)

Static profile

Required settings are explained in Network configuration. These typically include the network interface name, IP address, router address, and name server.

Configure a static profile for dhcpcd in /etc/dhcpcd.conf, for example:

/etc/dhcpcd.conf

interface eth0
static ip_address=192.168.0.10/24	
static routers=192.168.0.1
static domain_name_servers=192.168.0.1 8.8.8.8

Fallback profile

It is possible to configure a static profile within dhcpcd and fall back to it when DHCP lease fails. This is useful particularly for headless machines, where the static profile can be used as "recovery" profile to ensure that it is always possible to connect to the machine.

The following example configures a static_eth0 profile with 192.168.1.23 as IP address, 192.168.1.1 as gateway and name server, and makes this profile fallback for interface eth0.

/etc/dhcpcd.conf

# define static profile
profile static_eth0
static ip_address=192.168.1.23/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

# fallback to static profile on eth0
interface eth0
fallback static_eth0