You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
600 B
Bash
27 lines
600 B
Bash
#!/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
|
|
|