This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
networking:linux:static_ip_addr [2020/12/17 14:04] gcooper |
networking:linux:static_ip_addr [2023/05/02 14:34] (current) gcooper |
||
---|---|---|---|
Line 3: | Line 3: | ||
See also **[[https:// | See also **[[https:// | ||
- | ===== Ubuntu 18.04 ===== | + | ===== NetworkManager |
- | :!: Indenting is very important! | + | < |
+ | nmcli con show | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | nmcli con mod "Wired connection 1" ipv4.method manual \ | ||
+ | ipv4.addr 192.168.100.3/ | ||
+ | ipv4.gateway 192.168.100.1 \ | ||
+ | ipv4.dns 192.168.100.1, | ||
+ | connection.id " | ||
+ | |||
+ | nmcli con up " | ||
+ | </ | ||
- | :!: We use ' | + | ===== Netplan ===== |
- | :!: YAML files can be named differently. | + | https://netplan.io/ |
https:// | https:// | ||
https:// | https:// | ||
+ | |||
+ | :!: **Indentation** is very important! | ||
+ | |||
+ | :!: We use '' | ||
+ | |||
+ | :!: YAML files can be **renamed**. | ||
* bonds | * bonds | ||
Line 21: | Line 39: | ||
* static addresses | * static addresses | ||
* DHCP addresses | * DHCP addresses | ||
+ | |||
+ | ==== Regenerate and Reapply After Editing ==== | ||
< | < | ||
- | sudo vi /etc/netplan/50-cloud-init.yaml | + | sudo netplan --debug generate |
+ | sudo netplan --debug apply | ||
</ | </ | ||
- | Example: | + | ==== Ubuntu 18/20/22 (LACP Bond) ==== |
< | < | ||
network: | network: | ||
- | | + | version: 2 |
- | eth0: | + | |
- | addresses: [10.1.1.17/24] | + | |
- | | + | |
- | nameservers: | + | enp0s9: |
- | addresses: [10.1.1.20, | + | dhcp4: no |
- | eth1: | + | bonds: |
- | | + | bond0: |
- | mtu: 9000 | + | interfaces: [enp0s8, enp0s9] |
- | | + | |
+ | | ||
+ | - to: default | ||
+ | via: 10.1.1.1 | ||
+ | nameservers: | ||
+ | | ||
+ | | ||
+ | | ||
+ | mode: 802.3ad | ||
+ | | ||
+ | | ||
</ | </ | ||
+ | |||
+ | ==== Ubuntu 18/20/22 (Static) ==== | ||
< | < | ||
- | sudo netplan --debug generate | + | sudo vi /etc/netplan/50-cloud-init.yaml |
- | sudo netplan apply | + | </ |
- | sudo netplan | + | <note tip>To suppress (or define) the default IPv6 '' |
+ | |||
+ | '' | ||
+ | </ | ||
+ | |||
+ | Example: | ||
+ | |||
+ | < | ||
+ | network: | ||
+ | ethernets: | ||
+ | eth0: | ||
+ | addresses: [10.1.1.17/ | ||
+ | routes: | ||
+ | - to: 0.0.0.0/0 | ||
+ | via: 10.0.0.1 | ||
+ | nameservers: | ||
+ | addresses: [10.1.1.20, | ||
+ | eth1: | ||
+ | addresses: [10.1.9.17/ | ||
+ | mtu: 9000 | ||
+ | version: 2 | ||
</ | </ | ||
- | If you have trouble, try removing these files, then regenerate and reapply: | + | ==== Troubleshooting ==== |
+ | |||
+ | If you have trouble | ||
* Extra addresses | * Extra addresses | ||
Line 84: | Line 139: | ||
===== Hostname ===== | ===== Hostname ===== | ||
+ | |||
+ | < | ||
+ | hostname short-hostname | ||
+ | hostnamectl set-hostname fqdn-host-name | ||
+ | </ | ||
< | < | ||
Line 89: | Line 149: | ||
192.168.1.30 | 192.168.1.30 | ||
+ | </ | ||
- | sudo sh -c "echo new-hostname > / | + | < |
- | + | echo new-hostname > / | |
- | sudo hostnamectl set-hostname new-hostname | + | </ |
+ | < | ||
hostname | hostname | ||
hostname -f | hostname -f | ||
Line 211: | Line 273: | ||
===== Name Resolution ===== | ===== Name Resolution ===== | ||
+ | |||
+ | < | ||
+ | systemd-resolve --status | ||
+ | |||
+ | resolvectl status | ||
+ | </ | ||
https:// | https:// | ||
Line 248: | Line 316: | ||
reboot | reboot | ||
</ | </ | ||
+ | |||
+ | ===== Grub Boot Delay ===== | ||
+ | |||
+ | < | ||
+ | sed -i -e ' | ||
+ | update-grub | ||
+ | </ | ||
+ |