remember that discussion about ever changing non-standard ways of defining network interfaces and ip addresses under /etc/network…

well guess what, canonical just came up with a completely new config file format X-D (guess, everything is a yaml.yml now)

hostnamectl; # tested on
  Operating System: Ubuntu 20.04.3 LTS
            Kernel: Linux 5.4.0-88-generic
      Architecture: x86-64

virtual interfaces?

while temporarily adding a fixed ip to a interface “hack” like:

SUBNET=5;while true; do ifconfig enp2s0:4 192.168.$SUBNET.224 up; ip -c addr show; ping -c 3 192.168.$SUBNET.222; sleep 3; clear; done

still works.

this config will add the fixed ip 192.168.5.224 to enp0s3 in addition to a dhcp assigned address:

# this config file might be caleld something different
ls -lah /etc/netplan/*.yaml

# on ubuntu server 20.04.3 LTS it is
vim /etc/netplan/00-installer-config.yaml

# on ubuntu desktop 20.04.3 LTS it is
vim /etc/netplan/01-network-manager-all.yaml
# This is the network config written by 'subiquity'
# manually modified: add a fixed ip to the interface enp0s3 (in addition to dhcp asigned address)
# before that was called a virtual interface
# ifconfig enp0s3:0 192.168.5.101 up
network:
  ethernets:
    enp0s3:
      dhcp4: true
      addresses:
      - 192.168.5.224/24
  version: 2

:wq # write and quit in vim

# test out settings
netplan try; # <- that is pretty clever :)

Warning: Stopping systemd-networkd.service, but it can still be activated by: systemd-networkd.socket
Do you want to keep these settings?

Press ENTER before the timeout to accept the new configuration

Changes will revert in 101 seconds
# if a custom gateway and dns are required
vim /etc/netplan/00-installer-config.yaml 

hostnamectl; # tested with (creditz go to techrepublic.com and this guy)
Operating System: Ubuntu 20.04.6 LTS
Kernel: Linux 5.4.0-172-generic
Architecture: x86-64
# This is the network config written by 'subiquity'
network:
  ethernets:
    # disabled this gateway
    ens160:
      activation-mode: off
      #       dhcp4: true
    #fixed ip for this interface
    ens192:
      dhcp4: no
      addresses: [192.168.100.10/16]
      routes:
      - to: default
        via: 192.168.0.1
      nameservers:
              addresses: [192.168.0.1]
  version: 2

# apply the settings without try (WARNING ALL REMOTE WORKERS! THIS IS DANGER!)
netplan apply

# more verbose output
netplan --debug apply

# check what it has done
ip -c a s

another example:

# + use dhcp assigned ip & route & gateway + use multiple fixed ips on the same interface 
# + modify OpenDNS.gr to be the primary dns "phonebook" dns resolve names server: 116.202.176.26, second: Google's dns server

# manually modified: add a fixed ip to the interface enp0s3 (in addition to dhcp asigned address)
# before that was called a virtual interface ifconfig enp0s3:0 192.168.5.101 up
network:
  ethernets:
    enp0s25:
      dhcp4: true
      addresses:
      - 192.168.0.223/24
      - 192.168.4.223/24
      - 192.168.5.223/24
      nameservers:
        addresses:
        - 116.202.176.26
#        - 1.1.1.1 (CloudFlare)
#        - 8.8.8.8 (Google)
  version: 2

# for some reason ubuntu does not respect the order of the nameservers
# so when multiple nameservers are enabled, it could prefer Google's over LibreDNS

# apply and check
netplan try
# everything ok?
netplan apply
# check
ip -c a

then double check to: https://libredns.gr/ to check if it works

unencrypted & non private fallbacks:

if for some reason, unencrypted dns queries are preferred try:

88.198.92.222 https://libreops.cc/radicaldns.html

also: of course, the default nameservers of 1.1.1.1 (cloudflare) and 8.8.8.8 (Google)

can be put there too.

related articles:

BIND and DNS – the Phonebook of the internet – Berkeley Internet Name Domain – how to benchmark dns servers (find fastest) – LibreDNS

Fastest alternatives to Google’s DNS servers for StarLink users – how to manually dig-test dns nameservers

Links:

https://duckduckgo.com/?t=ffab&q=top+libre+dns+servers&ia=answer&iax=answer

https://libreops.cc/

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin