summaryrefslogtreecommitdiff
path: root/network_config
diff options
context:
space:
mode:
Diffstat (limited to 'network_config')
-rw-r--r--network_config24
1 files changed, 24 insertions, 0 deletions
diff --git a/network_config b/network_config
new file mode 100644
index 0000000..e1233f1
--- /dev/null
+++ b/network_config
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+# à adapter à votre réseau
+
+sudo hostnamectl set-hostname $1
+
+sudo bash -c "cat > /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg << EOF
+network: {config: disabled}
+EOF"
+
+sudo bash -c "cat > /etc/netplan/50-cloud-init.yaml << EOF
+network:
+ ethernets:
+ enp0s17:
+ dhcp4: false
+ addresses: [$2/24]
+ gateway4: 172.19.30.254
+ nameservers:
+ addresses: [172.19.30.128,172.19.30.254]
+ version: 2
+EOF"
+
+sudo netplan apply
+
+rm $0