Disable cloud-init DHCP for static IP setup
This commit is contained in:
parent
b1b5abc442
commit
e4e126bd43
@ -83,7 +83,9 @@ NET_MODE=$(whiptail --title "$TITLE" \
|
|||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
|
|
||||||
if [ "$NET_MODE" = "Static" ]; then
|
if [ "$NET_MODE" = "Static" ]; then
|
||||||
rm -f /etc/netplan/99-cezen-dhcp.yaml || true
|
mkdir -p /etc/cloud/cloud.cfg.d
|
||||||
|
printf "network: {config: disabled}\n" > /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
|
||||||
|
rm -f /etc/netplan/50-cloud-init.yaml /etc/netplan/99-cezen-dhcp.yaml || true
|
||||||
|
|
||||||
IP_ADDR=$(whiptail --title "$TITLE" \
|
IP_ADDR=$(whiptail --title "$TITLE" \
|
||||||
--inputbox "\nEnter static IP address:\n(Example: 192.168.1.100)" \
|
--inputbox "\nEnter static IP address:\n(Example: 192.168.1.100)" \
|
||||||
@ -123,6 +125,7 @@ network:
|
|||||||
nameservers:
|
nameservers:
|
||||||
addresses: [${DNS}]
|
addresses: [${DNS}]
|
||||||
EOF
|
EOF
|
||||||
|
chmod 0600 /etc/netplan/99-cezen-static.yaml
|
||||||
|
|
||||||
if ! netplan apply; then
|
if ! netplan apply; then
|
||||||
whiptail --title "$TITLE" \
|
whiptail --title "$TITLE" \
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user