Skip to content

Commit

Permalink
Fix generic/ubuntu dns
Browse files Browse the repository at this point in the history
  • Loading branch information
derekbit committed Oct 18, 2021
1 parent 26df8d0 commit 12c07fc
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,17 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
apt-get update -y
apt-get install -y git vim curl build-essential openssh-server
apt-get install -y jq open-iscsi nfs-common
echo "export CRI_CONFIG_FILE=/var/lib/rancher/rke2/agent/etc/crictl.yaml" >> /root/.bashrc
echo "export PATH=$PATH:/var/lib/rancher/rke2/bin" >> /root/.bashrc
SHELL

config.vm.provision "net",
type: "shell",
path: "scripts/fix.generic-ubuntu-dns.sh",
privileged: true,
run: "always"

# Server node
config.vm.define "#{server_hostname}" do |node|
node.vm.hostname = "#{server_hostname}"
Expand Down
44 changes: 44 additions & 0 deletions scripts/fix.generic-ubuntu-dns.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
# see:
# https://github.com/lavabit/robox/issues/11
# https://github.com/lavabit/robox/issues/54

# exit if we are not on modern ubuntu version
test -d /etc/netplan || exit 0

# Reset netplan config, not really needed; just to clearly indicate no fixed dns is used
tee <<EOF > /etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: true
dhcp6: false
optional: true
nameservers:
addresses: []
EOF
netplan generate
systemctl restart systemd-networkd.service
systemctl restart ifplugd.service

# Remove fixed DNS entries and disable DNSSEC, disable flaky caching, or emdns
tee <<EOF > /etc/systemd/resolved.conf
[Resolve]
DNS=
FallbackDNS=
Domains=
#LLMNR=no
#MulticastDNS=no
DNSSEC=no
Cache=no
DNSStubListener=yes
EOF

systemctl daemon-reload
systemctl restart systemd-resolved

echo "Fixed networking."

# verify with: systemd-resolve --status

0 comments on commit 12c07fc

Please sign in to comment.