Last active
December 7, 2022 06:57
-
-
Save abykal/2e2704e81296d98157b7f7a440c7a331 to your computer and use it in GitHub Desktop.
Ubuntu Server Static IP [17.10+]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# change ip/gateway/dns as per your network design | |
network: | |
version: 2 | |
renderer: networkd | |
ethernets: | |
enp3s0: | |
addresses: | |
- 10.10.10.2/24 | |
nameservers: | |
search: [mydomain, otherdomain] | |
addresses: [10.10.10.1, 1.1.1.1] | |
routes: | |
- to: default | |
via: 10.10.10.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Post Ubuntu 17.10, Netplan is the default network management tool | |
# 2 renderers: | |
# Systemd-networkd [Server] / NetworkManager [Desktop] | |
# identify the ethernet interface name (like ens2) | |
ip a | |
ip link | |
# Disable any Cloud.init configurations, if present | |
sudo nano /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg | |
#------------------------------------------ | |
network: {config: disabled } | |
#------------------------------------------ | |
# Assign static IP | |
sudo nano /etc/netplan/01-netcfg.yaml | |
#------------------------------------------ | |
network: | |
version: 2 | |
renderer: networkd | |
ethernets: | |
enp3s0: | |
addresses: | |
- 10.10.10.2/24 | |
nameservers: | |
search: [mydomain, otherdomain] | |
addresses: [10.10.10.1, 1.1.1.1] | |
routes: | |
- to: default | |
via: 10.10.10.1 | |
#------------------------------------------ | |
# Save and apply changes | |
sudo netplan apply |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment