Interview Prep/Linux/Networking, SSH & Scheduling

What is the difference between DHCP and static IP configuration on servers?

IntermediateConceptNetworking, SSH & Scheduling
Answer

DHCP leases an address, gateway and DNS from a server; cloud VMs use it, with the cloud providing fixed private IPs through reservations. Static configuration hardcodes them in netplan, NetworkManager or ifcfg files, typical for on-prem infrastructure servers (DNS, DHCP itself, databases).

# /etc/netplan/50-static.yaml
network:
  version: 2
  ethernets:
    eth0:
      addresses: [10.0.0.10/24]
      routes: [{to: default, via: 10.0.0.1}]
      nameservers: {addresses: [10.0.0.2]}

sudo netplan try reverts automatically if you lose connectivity.

All Linux questions Roadmap: Linux

More on Networking, SSH & Scheduling