aboutsummaryrefslogtreecommitdiff
path: root/repos/core/busybox/net-static.run
blob: 0a43abee317fd3033fd383ca0d917d4a8ed2c565 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
exec 2>&1

[ -f ./conf ] && . ./conf

# bring interface up
ip link set "${IFACE:-wlan0}" up

# flush old IPs
ip addr flush dev "${IFACE:-wlan0}"

# assign static IP
ip addr add "${IP:-192.168.1.22}/${NETMASK:-24}" dev "${IFACE:-wlan0}"

# set default route
ip route add default via "${GATEWAY:-192.168.1.1}"

# configure DNS
echo "nameserver ${GATEWAY:-192.168.1.1}" > /etc/resolv.conf
echo "nameserver 8.8.8.8" >> /etc/resolv.conf

# block forever so runit keeps it "up"
exec sleep infinity