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.
More on Networking, SSH & Scheduling
Which `ip` commands replace ifconfig, route and arp?BeginnerWhat does `ss` show, and which flags do you use?BeginnerExplain the TCP connection states you see in ss.AdvancedWhat happens, step by step, when you run `curl https://example.com`?AdvancedWhich curl flags are most useful for debugging?BeginnerHow do you use `dig` for DNS troubleshooting?Beginner