Skip to content

Instantly share code, notes, and snippets.

@ruzickap
Last active November 24, 2021 14:24
Show Gist options
  • Select an option

  • Save ruzickap/10007364 to your computer and use it in GitHub Desktop.

Select an option

Save ruzickap/10007364 to your computer and use it in GitHub Desktop.

Revisions

  1. ruzickap revised this gist Apr 7, 2014. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions openwrt_dhcp.sh
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,6 @@ EOF

    chmod a+x /etc/dnsmasq-script.sh


    # WiFi
    uci add dhcp host
    uci set dhcp.@host[-1].name=peru-nb-work-wifi
    @@ -90,4 +89,4 @@ uci set dhcp.@host[-1].mac=b8:27:eb:8c:97:9e
    uci add dhcp host
    uci set dhcp.@host[-1].name=server-nic
    uci set dhcp.@host[-1].ip=192.168.1.135
    uci set dhcp.@host[-1].mac=00:1f:c6:e9:f5:14
    uci set dhcp.@host[-1].mac=00:1f:c6:e9:f5:14
  2. ruzickap revised this gist Apr 6, 2014. 1 changed file with 16 additions and 0 deletions.
    16 changes: 16 additions & 0 deletions openwrt_dhcp.sh
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,22 @@ uci set dhcp.lan.limit=54
    uci set dhcp.@dnsmasq[0].domain=xvx.cz
    uci set dhcp.@dnsmasq[0].leasefile=/etc/dnsmasq-dhcp.leases

    #Send email for new connections:
    echo "dhcp-script=/etc/dnsmasq-script.sh" >> /etc/dnsmasq.conf

    cat > /etc/dnsmasq-script.sh << \EOF
    #!/bin/sh
    /bin/echo `/bin/date +"%F %T"` $* >> /etc/dnsmasq.script.log
    if [ "$1" == "add" ] && ! grep -iq $2 /etc/config/dhcp; then
    echo -e "Subject: New MAC on `uci get system.@system[0].hostname`.`uci get dhcp.@dnsmasq[0].domain`\\n\\n`/bin/date +"%F %T"` $*" | sendmail petr.ruzicka@gmail.com
    fi
    EOF

    chmod a+x /etc/dnsmasq-script.sh


    # WiFi
    uci add dhcp host
    uci set dhcp.@host[-1].name=peru-nb-work-wifi
  3. ruzickap created this gist Apr 6, 2014.
    77 changes: 77 additions & 0 deletions openwrt_dhcp.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,77 @@
    uci set dhcp.lan.start=200
    uci set dhcp.lan.limit=54

    uci set dhcp.@dnsmasq[0].domain=xvx.cz
    uci set dhcp.@dnsmasq[0].leasefile=/etc/dnsmasq-dhcp.leases

    # WiFi
    uci add dhcp host
    uci set dhcp.@host[-1].name=peru-nb-work-wifi
    uci set dhcp.@host[-1].ip=192.168.1.2
    uci set dhcp.@host[-1].mac=5c:51:4f:7e:e0:d2

    uci add dhcp host
    uci set dhcp.@host[-1].name=andy-nb-wifi
    uci set dhcp.@host[-1].ip=192.168.1.3
    uci set dhcp.@host[-1].mac=74:f0:6d:93:c7:3a

    uci add dhcp host
    uci set dhcp.@host[-1].name=peru-nb-old-wifi
    uci set dhcp.@host[-1].ip=192.168.1.4
    uci set dhcp.@host[-1].mac=00:15:00:11:48:5A

    uci add dhcp host
    uci set dhcp.@host[-1].name=andy-android-wifi
    uci set dhcp.@host[-1].ip=192.168.1.5
    uci set dhcp.@host[-1].mac=00:23:76:D6:42:C7

    uci add dhcp host
    uci set dhcp.@host[-1].name=peru-android-work-wifi
    uci set dhcp.@host[-1].ip=192.168.1.6
    uci set dhcp.@host[-1].mac=a4:eb:d3:44:7a:23

    uci add dhcp host
    uci set dhcp.@host[-1].name=peru-palm-wifi
    uci set dhcp.@host[-1].ip=192.168.1.7
    uci set dhcp.@host[-1].mac=00:0b:6c:57:da:9a

    uci add dhcp host
    uci set dhcp.@host[-1].name=RTL8187-wifi
    uci set dhcp.@host[-1].ip=192.168.1.8
    uci set dhcp.@host[-1].mac=00:C0:CA:54:F5:BA

    uci add dhcp host
    uci set dhcp.@host[-1].name=peru-tablet-wifi
    uci set dhcp.@host[-1].ip=192.168.1.9
    uci set dhcp.@host[-1].mac=00:22:f4:f6:f3:0b

    # NIC
    uci add dhcp host
    uci set dhcp.@host[-1].name=peru-nb-work-nic
    uci set dhcp.@host[-1].ip=192.168.1.130
    uci set dhcp.@host[-1].mac=28:d2:44:31:31:90

    uci add dhcp host
    uci set dhcp.@host[-1].name=andy-nb-nic
    uci set dhcp.@host[-1].ip=192.168.1.131
    uci set dhcp.@host[-1].mac=20:cf:30:31:da:b3

    uci add dhcp host
    uci set dhcp.@host[-1].name=peru-nb-old-nic
    uci set dhcp.@host[-1].ip=192.168.1.132
    uci set dhcp.@host[-1].mac=00:13:D4:D1:03:57

    uci add dhcp host
    uci set dhcp.@host[-1].name=peru-tv-nic
    uci set dhcp.@host[-1].ip=192.168.1.133
    uci set dhcp.@host[-1].mac=00:12:FB:94:1B:9A

    uci add dhcp host
    uci set dhcp.@host[-1].name=raspberrypi-nic
    uci set dhcp.@host[-1].ip=192.168.1.134
    uci set dhcp.@host[-1].mac=b8:27:eb:8c:97:9e

    uci add dhcp host
    uci set dhcp.@host[-1].name=server-nic
    uci set dhcp.@host[-1].ip=192.168.1.135
    uci set dhcp.@host[-1].mac=00:1f:c6:e9:f5:14