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
Last revision Both sides next revision
networking:linux:static_ip_addr [2021/02/09 11:25]
gcooper
networking:linux:static_ip_addr [2023/03/02 11:20]
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>
 +sudo netplan --debug generate
 +sudo netplan --debug apply
 +</file>
 +
 +==== Ubuntu 18/20/22 (LACP Bond) ====
 +
 +<file>
 +network:
 +  version: 2
 +  ethernets:
 +    enp0s8:
 +      dhcp4: no
 +    enp0s9:
 +      dhcp4: no
 +  bonds:
 +    bond0:
 +      interfaces: [enp0s8, enp0s9]
 +      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:
 +        mode: 802.3ad
 +        transmit-hash-policy: layer3+4
 +        mii-monitor-interval: 1
 +</file>
 +
 +==== Ubuntu 18/20/22 (Static) ====
  
 <file> <file>
Line 42: Line 79:
 </file> </file>
  
-<note tip>To suppress (or define) the default IPv6 ''link-local'' address (''fe80::''), add this to the interface definition (same indentation as ''addresses: []''):+<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: []'' ''link-local: []''
Line 51: Line 88:
 <file> <file>
 network: network:
-    ethernets: +  ethernets: 
-        eth0: +    eth0: 
-            addresses: [10.1.1.17/24] +      addresses: [10.1.1.17/24] 
-            gateway4: 10.1.1.1 +      routes: 
-            nameservers: +        - to: 0.0.0.0/0 
-              addresses: [10.1.1.20,10.1.1.21] +          via: 10.0.0.1 
-        eth1: +      nameservers: 
-            addresses: [10.1.9.17/24] +        addresses: [10.1.1.20,10.1.1.21] 
-            mtu: 9000 +    eth1: 
-    version: 2+      addresses: [10.1.9.17/24] 
 +        mtu: 9000 
 +version: 2
 </file> </file>
  
-<file> +==== Troubleshooting ====
-sudo netplan --debug generate +
-sudo netplan --debug apply +
-</file>+
  
-If you have trouble, try removing these files, then regenerate and reapply:+If you have trouble with netplan, try removing these files, then regenerate and reapply:
  
   * Extra addresses   * Extra addresses
Line 103: Line 139:
  
 ===== Hostname ===== ===== Hostname =====
 +
 +<file>
 +hostname short-hostname
 +hostnamectl set-hostname fqdn-host-name
 +</file>
  
 <file> <file>
Line 108: 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 271: Line 314:
 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