Information Technology Grimoire

Version .0.0.1

IT Notes from various projects because I forget, and hopefully they help you too.

netplan

https://netplan.io

device name

sudo ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 22:32:4c:36:5a:99 brd ff:ff:ff:ff:ff:ff
    altname enp0s18
    inet 192.168.7.48/24 brd 192.168.7.255 scope global ens18
       valid_lft forever preferred_lft forever
    inet6 fe80::2032:4cff:fe36:5a99/64 scope link
       valid_lft forever preferred_lft forever

older way

sudo vim /etc/netplan/01-netcfg.yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    ens18: #Edit this line according to your network interface name you just saw.
      dhcp4: no
      addresses: [192.168.7.48/24]
      gateway4: 192.168.7.1
      nameservers:
        addresses: [8.8.8.8,8.8.4.4]

newer way

network:
  version: 2
  renderer: networkd
  ethernets:
    ens18:
      dhcp4: false
      dhcp6: false
      addresses:
        - 192.168.7.48/24
      routes:
        - to: default
          via: 192.168.7.1
      nameservers:
        addresses: [192.168.7.1]