aboutsummaryrefslogtreecommitdiff
path: root/autoDHCP
blob: 7222d73010ba63d6a4b0f1ee5a986a25d631b6c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/env bash

interface="";
server="dhcpd"
ip="10.5.5.11"
range="/24"

# Todo : List interface
#        Select first
#        Select dhcpd or dnsmasq
#        Select ip range
#        Select ip

# Default first is the head of the non-wireless interfaces sorted alpha-num





function guess_nowifi {
    for i in `ls /sys/class/net/`; do
        if [ ! -d "/sys/class/net/$i/wireless" ] ; then 
            if [ "$interface" ] ; then 
                if [[ "$i" < "$înterface" ]] ; then
                    interface="$i"
                fi
            else
                interface="$i"
            fi
        fi
    done
}



guess_nowifi


interface="$interface"


echo "$interface"




sudo ip l set enp1s0 up
sudo ip a a 10.5.5.11/24 dev enp1s0
sudo /usr/bin/dhcpd -4 -q -pf /run/dhcpd4.pid enp1s0