summaryrefslogtreecommitdiff
path: root/alpine/networking.sh
diff options
context:
space:
mode:
Diffstat (limited to 'alpine/networking.sh')
-rwxr-xr-xalpine/networking.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/alpine/networking.sh b/alpine/networking.sh
new file mode 100755
index 0000000..8c5eff0
--- /dev/null
+++ b/alpine/networking.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# Copyright (C) 2025-2026 Maria Lisina
+# SPDX-License-Identifier: Apache-2.0
+#
+# networking configuration
+
+set -e
+
+if [ -n "${1}" ]
+then
+ __hostname="${1}"
+ shift
+else
+ __hostname="localhost"
+fi
+
+echo ${__hostname} > /etc/hostname
+
+cat << EOF > /etc/network/interfaces
+auto lo
+iface lo inet loopback
+
+auto eth0
+iface eth0 inet dhcp
+
+auto eth1
+iface eth1 inet static
+ address 172.16.0.1
+ netmask 255.240.0.0
+iface eth1 inet6 auto
+EOF
+
+cat << EOF > /etc/resolv.conf
+nameserver 8.8.8.8
+nameserver 8.8.4.4
+nameserver 2001:4860:4860::8888
+nameserver 2001:4860:4860::8844
+EOF
+
+cat << EOF > /etc/hosts
+127.0.0.1 localhost ${__hostname}
+::1 localhost ipv6-localhost ipv6-loopback ${__hostname}
+fe00::0 ipv6-localnet
+ff00::0 ipv6-mcastprefix
+ff02::1 ipv6-allnodes
+ff02::2 ipv6-allrouters
+ff02::3 ipv6-allhosts
+EOF