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
Next revision Both sides next revision
networking:linux:static_ip_addr [2020/12/18 08:48]
gcooper
networking:linux:static_ip_addr [2022/04/28 08:35]
gcooper
Line 11: Line 11:
 <file> <file>
 nmcli con mod "Wired connection 1" ipv4.method manual \ nmcli con mod "Wired connection 1" ipv4.method manual \
-  ipv4.addr 192.168.0.3/24 \ +  ipv4.addr 192.168.100.3/24 \ 
-  ipv4.gateway 192.168.0.1 \ +  ipv4.gateway 192.168.100.1 \ 
-  ipv4.dns 192.168.0.2,8.8.8.8,8.8.4.4 \+  ipv4.dns 192.168.100.1,8.8.8.8,8.8.4.4 \
   connection.id "Office LAN"   connection.id "Office LAN"
- 
-nmcli con mod "Wired connection 2" ipv4.method manual \ 
-  ipv4.addr 192.168.1.1/24 \ 
-  connection.id "Bench LAN" 
  
 nmcli con up "Office LAN" nmcli con up "Office LAN"
-nmcli con up "Bench LAN" 
 </file> </file>
  
 +===== Netplan =====
  
-===== Ubuntu 18.04 =====+https://netplan.io/examples/
  
-:!: Indenting is very important!+https://blog.ubuntu.com/2017/07/05/quick-and-easy-network-configuration-with-netplan
  
-:!: We use 'netplan' and 'networkd' for network configuration.+https://blog.ubuntu.com/2017/12/01/ubuntu-bionic-netplan
  
-:!: YAML files can be named differently.+:!: **Indentation** is very important!
  
-https://blog.ubuntu.com/2017/07/05/quick-and-easy-network-configuration-with-netplan+:!: We use ''netplan'' and ''networkd'' for network configuration.
  
-https://blog.ubuntu.com/2017/12/01/ubuntu-bionic-netplan+:!: YAML files can be **renamed**.
  
   * bonds   * bonds
Line 43: 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 (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 233: Line 266:
  
 ===== Name Resolution ===== ===== Name Resolution =====
 +
 +<file>
 +systemd-resolve --status
 +</file>
  
 https://www.shellhacks.com/setup-dns-resolution-resolvconf-example/ https://www.shellhacks.com/setup-dns-resolution-resolvconf-example/
networking/linux/static_ip_addr.txt · Last modified: 2023/05/02 14:34 by gcooper