Last active
May 22, 2021 14:52
-
-
Save ictus4u/40af1a00a2d9caae48377936f8d0e332 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################## Start Netplan config (renderer: NetworkManager) | |
# Some useful commands for customisation | |
# NetConn=$(nmcli device show|grep GENERAL.CONNECTION|head -n1|awk '{print $2}') | |
# IP=$(nmcli device show|grep IP4.ADDRESS|head -n1|awk '{print $2}') | |
# GATEWAY=$(nmcli device show|grep IP4.GATEWAY|head -n1|awk '{print $2}') | |
# sed -i 's/renderer: networkd/renderer: NetworkManager/' //etc/netplan/01-netcfg.yaml | |
###################################### | |
systemctl start NetworkManager | |
NIC=$(nmcli device show|grep GENERAL.DEVICE|head -n1|awk '{print $2}') | |
##### create Netplan yaml config file | |
cat >/etc/netplan/01-netcfg.yaml <<EOF | |
# This file describes the network interfaces available on your system | |
# For more information, see netplan(5). | |
network: | |
version: 2 | |
renderer: NetworkManager | |
ethernets: | |
EOF | |
echo " ${NIC}:" >> /etc/netplan/01-netcfg.yaml | |
cat >>/etc/netplan/01-netcfg.yaml <<EOF | |
dhcp4: yes | |
nameservers: | |
search: [abc.domain.edu, def.domain.edu] | |
addresses: [10.10.11.22, 10.10.11.23] | |
EOF | |
#work around DNS resolv bug | |
systemctl stop systemd-resolved | |
sed -i 's/#DNS=/DNS=10.10.11.22 10.10.11.23/' /etc/systemd/resolved.conf | |
sed -i 's/#Domains=/Domains=abc.domain.edu def.domain.edu' /etc/systemd/resolved.conf | |
systemctl start systemd-resolved | |
systemctl restart NetworkManager | |
netplan apply | |
reboot | |
############### End Netplan Config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment