Skip to content

Instantly share code, notes, and snippets.

@mwt
Last active September 28, 2023 00:42
Show Gist options
  • Save mwt/59458cd46a114cc07adc0c5de7525f7d to your computer and use it in GitHub Desktop.
Save mwt/59458cd46a114cc07adc0c5de7525f7d to your computer and use it in GitHub Desktop.
Update HOSTS file on my wireguard setup
#!/bin/sh
sed -i '/# BEGIN Wireguard vLAN #/,/# END Wireguard vLAN #/d' /etc/hosts
cat << EOF >> /etc/hosts
# BEGIN Wireguard vLAN #
10.7.0.1 letbox.wg
10.7.0.2 bellerophon.wg
10.7.0.3 specialk.wg
10.7.0.4 candy.wg
10.7.0.5 pixel7.wg
10.7.0.6 augustus.wg
10.7.0.7 kn-macbookpro.wg
10.7.0.8 meg-xps.wg
10.7.0.9 marsktop.wg
10.7.0.10 mwt-xps.wg
10.7.1.1 hosthatch.wg
fddd:2c4:0:1:: letbox.wg
fddd:2c4:0:2:: bellerophon.wg
fddd:2c4:0:3:: specialk.wg
fddd:2c4:0:4:: candy.wg
fddd:2c4:0:5:: pixel7.wg
fddd:2c4:0:6:: augustus.wg
fddd:2c4:0:7:: kn-macbookpro.wg
fddd:2c4:0:8:: meg-xps.wg
fddd:2c4:0:9:: marsktop.wg
fddd:2c4:0:10:: mwt-xps.wg
fddd:2c4:1:1:: hosthatch.wg
# END Wireguard vLAN #
EOF
@mwt
Copy link
Author

mwt commented Aug 15, 2023

Apply this with:

curl https://gist.githubusercontent.com/mwt/59458cd46a114cc07adc0c5de7525f7d/raw/wg-hosts.sh | sudo -s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment