Univention Bugzilla – Attachment 8376 Details for
Bug 16923
DHCP without fixed IP address
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Your test in shell
16923_udm-dhcp-test.sh (text/plain), 2.65 KB, created by
Philipp Hahn
on 2017-01-26 12:43 CET
(
hide
)
Description:
Your test in shell
Filename:
MIME Type:
Creator:
Philipp Hahn
Created:
2017-01-26 12:43 CET
Size:
2.65 KB
patch
obsolete
>#!/bin/bash >set -e -u -x > >DN1 () { sed -ne 's/^DN: //p;T;q';} >MAC () { od -A n -N 6 -t x1 /dev/urandom|tr ' ' :|tail -c +2;} >NET=192.0.2 >IP () { echo "$NET.$((2 + RANDOM % 253))";} > >fqhn="$(hostname -f)" > >test="test$RANDOM" >udm container/cn create --set name="$test" >base="cn=$test,$(ucr get ldap/base)" >trap "udm container/cn remove --dn '$base'" EXIT >trap 'rv=$?;set +e +u +x;univention-ldapsearch -LLLo ldif-wrap=no -b "$base"|grep -v -e "^objectClass:" -e "^univentionObjectType:";tty&&read DUMMY||:;exit $rv' ERR > >udm dhcp/service create --position "$base" --set service="dhcp" >dhcp="cn=dhcp,$base" > >udm dns/forward_zone create --position "$base" --set zone="dns" --set nameserver="$fqhn." >fwd="zoneName=dns,$base" > >udm dns/reverse_zone create --position "$base" --set subnet="$NET" --set nameserver="$fqhn." >rev="zoneName=$(echo "$NET" | tr . '\n' | tac | tr '\n' .)in-addr.arpa,$base" > >udm networks/network create --position "$base" --set name="net" --set network="$NET.0" --set netmask=24 --set dhcpEntryZone="$dhcp" --set ipRange="$NET.2 $NET.253" --set dnsEntryZoneForward="$fwd" --set dnsEntryZoneReverse="$rev" >net="cn=net,$base" > > >echo "Let Network chose the IP" >mac="$(MAC)" host="l$RANDOM" >udm computers/linux create --position "$base" --set name="$host" --set mac="$mac" --set network="$net" >udm dhcp/host list --superordinate "$dhcp" --filter host="$host" | grep -F "fixedaddress: $NET." >udm dns/host_record list --superordinate "$fwd" --filter name="$host" | grep -F "a: $NET." >udm dns/ptr_record list --superordinate "$rev" --filter ptr_record="$host.dns." | grep -F "ip: $NET." > >echo "Give explicit IP, but DHCP from Network" >ip="$(IP)" mac="$(MAC)" host="l$RANDOM" >udm computers/linux create --position "$base" --set name="$host" --set mac="$mac" --set ip="$ip" --set network="$net" >udm dhcp/host list --superordinate "$dhcp" --filter host="$host" | grep -F "fixedaddress: $ip" >udm dns/host_record list --superordinate "$fwd" --filter name="$host" | grep -F "a: $ip" >udm dns/ptr_record list --superordinate "$rev" --filter relativeDomainName="${ip#$NET.}" | grep -F "ptr_record: $host." > >echo "Manual DHCP with dynamic IP from known-hosts-pool" >mac="$(MAC)" host="l$RANDOM" >udm computers/linux create --position "$base" --set name="$host" --set mac="$mac" --set dhcpEntryZone="$dhcp $mac" >udm dhcp/host list --superordinate "$dhcp" --filter host="$host" | grep -F "fixedaddress: None" > >echo "Manual DHCP with fixed IP" >ip="$(IP)" mac="$(MAC)" host="l$RANDOM" >udm computers/linux create --position "$base" --set name="$host" --set mac="$mac" --set ip="$ip" --set dhcpEntryZone="$dhcp $ip $mac" >udm dhcp/host list --superordinate "$dhcp" --filter host="$host" | grep -F "fixedaddress: $ip"
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
Attachments on
bug 16923
:
8375
| 8376