User Tools

Site Tools


networking:linux:static_ip_addr

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
networking:linux:static_ip_addr [2020/12/18 08:57]
gcooper
networking:linux:static_ip_addr [2023/05/02 14:34]
gcooper
Line 19: Line 19:
 </file> </file>
  
-===== Ubuntu 18.04 =====+===== Netplan =====
  
-:!: Indenting is very important! +https://netplan.io/examples/
- +
-:!: We use 'netplan' and 'networkd' for network configuration. +
- +
-:!: YAML files can be named differently.+
  
 https://blog.ubuntu.com/2017/07/05/quick-and-easy-network-configuration-with-netplan https://blog.ubuntu.com/2017/07/05/quick-and-easy-network-configuration-with-netplan
  
 https://blog.ubuntu.com/2017/12/01/ubuntu-bionic-netplan https://blog.ubuntu.com/2017/12/01/ubuntu-bionic-netplan
 +
 +:!: **Indentation** is very important!
 +
 +:!: We use ''netplan'' and ''networkd'' for network configuration.
 +
 +:!: YAML files can be **renamed**.
  
   * bonds   * bonds
Line 37: Line 39:
   * static addresses   * static addresses
   * DHCP addresses   * DHCP addresses
 +
 +==== Regenerate and Reapply After Editing ====
  
 <file> <file>
-sudo vi /etc/netplan/50-cloud-init.yaml+sudo netplan --debug generate 
 +sudo netplan --debug apply
 </file> </file>
  
-Example:+==== Ubuntu 18/20/22 (LACP Bond) ====
  
 <file> <file>
 network: network:
-    ethernets: +  version: 2 
-        eth0+  ethernets: 
-            addresses: [10.1.1.17/24] +    enp0s8
-            gateway4: 10.1.1.1 +      dhcp4: no 
-            nameservers: +    enp0s9: 
-              addresses: [10.1.1.20,10.1.1.21] +      dhcp4: no 
-        eth1+  bonds: 
-            addresses[10.1.9.17/24] +    bond0: 
-            mtu9000 +      interfaces: [enp0s8, enp0s9] 
-    version2+      addresses: [10.1.1.19/24] 
 +      routes: 
 +        - to: default 
 +          via: 10.1.1.1 
 +      nameservers: 
 +        search: [internal.domain, domain] 
 +        addresses: [10.1.1.20, 10.1.1.21] 
 +      parameters
 +        mode802.3ad 
 +        transmit-hash-policylayer3+4 
 +        mii-monitor-interval1
 </file> </file>
 +
 +==== Ubuntu 18/20/22 (Static) ====
  
 <file> <file>
-sudo netplan --debug generate +sudo vi /etc/netplan/50-cloud-init.yaml 
-sudo netplan apply+</file>
  
-sudo netplan --debug apply+<note tip>To suppress (or define) the default IPv6 ''link-local'' address (''fe80::''), add this to the interface definition (same indentation as ''addresses:''): 
 + 
 +''link-local: []'' 
 +</note> 
 + 
 +Example: 
 + 
 +<file> 
 +network: 
 +  ethernets: 
 +    eth0: 
 +      addresses: [10.1.1.17/24] 
 +      routes: 
 +        - to: 0.0.0.0/0 
 +          via: 10.0.0.1 
 +      nameservers: 
 +        addresses: [10.1.1.20,10.1.1.21] 
 +    eth1: 
 +      addresses: [10.1.9.17/24] 
 +        mtu: 9000 
 +version: 2
 </file> </file>
  
-If you have trouble, try removing these files, then regenerate and reapply:+==== Troubleshooting ==== 
 + 
 +If you have trouble with netplan, try removing these files, then regenerate and reapply:
  
   * Extra addresses   * Extra addresses
Line 100: Line 139:
  
 ===== Hostname ===== ===== Hostname =====
 +
 +<file>
 +hostname short-hostname
 +hostnamectl set-hostname fqdn-host-name
 +</file>
  
 <file> <file>
Line 105: Line 149:
  
 192.168.1.30   hostname.example.com     hostname 192.168.1.30   hostname.example.com     hostname
 +</file>
  
-sudo sh -c "echo new-hostname > /etc/hostname" +<file> 
- +echo new-hostname > /etc/hostname 
-sudo hostnamectl set-hostname new-hostname+</file>
  
 +<file>
 hostname hostname
 hostname -f hostname -f
Line 227: Line 273:
  
 ===== Name Resolution ===== ===== Name Resolution =====
 +
 +<file>
 +systemd-resolve --status
 +
 +resolvectl status
 +</file>
  
 https://www.shellhacks.com/setup-dns-resolution-resolvconf-example/ https://www.shellhacks.com/setup-dns-resolution-resolvconf-example/
Line 264: Line 316:
 reboot reboot
 </file> </file>
 +
 +===== Grub Boot Delay =====
 +
 +<file>
 +sed -i -e 's/GRUB_TIMEOUT=0/GRUB_TIMEOUT=5/g' /etc/default/grub
 +update-grub
 +</file>
 +
networking/linux/static_ip_addr.txt · Last modified: 2023/05/02 14:34 by gcooper