#!/bin/bash PURPLE=`tput setaf 5` GREEN=`tput setaf 2` BLUE=`tput setaf 4` RED=`tput setaf 1` address=$(ip a | grep "2: " -A 2 | grep inet | awk '{print $2}') dns="your.dns.server.ip" gateway="your.gateway.ip" echo -e $BLUE"Creating$PURPLE /etc/netplan/1-network-manager-all.yaml with the following settings$BLUE" echo "network: version: 2 ethernets: eth0: dhcp4: no addresses: [$address] gateway4: $gateway nameservers: addresses: [$dns]" | tee /etc/netplan/1-network-manager-all.yaml echo -e $GREEN"Applying Netplan settings" sudo netplan apply