add tinc-generate-mac tinc-generate-macc
This commit is contained in:
parent
4d8885b590
commit
4e57a1ceb6
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,4 +1,4 @@
|
|||||||
rsa_key.priv
|
rsa_key.priv
|
||||||
ecdsa_key.priv
|
ecdsa_key.priv
|
||||||
tinc-up
|
|
||||||
tinc.conf
|
tinc.conf
|
||||||
|
tinc-macaddr
|
||||||
|
21
tinc-generate-mac
Executable file
21
tinc-generate-mac
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
|
||||||
|
MACADDR_FILE="$DIR/tinc-macaddr"
|
||||||
|
if [ -e "$MACADDR_FILE" ]; then
|
||||||
|
echo "Skip generating MAC: '$MACADDR_FILE' does already exists."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
# Locally Administered Address Ranges:
|
||||||
|
#x2-xx-xx-xx-xx-xx
|
||||||
|
#x6-xx-xx-xx-xx-xx
|
||||||
|
#xA-xx-xx-xx-xx-xx
|
||||||
|
#xE-xx-xx-xx-xx-xx
|
||||||
|
# Replacing x with any hex value.
|
||||||
|
printf '02:1F:%02X:%02X:%02X:%02X\n' \
|
||||||
|
$[RANDOM%256] $[RANDOM%256] $[RANDOM%256] $[RANDOM%256] \
|
||||||
|
> "$MACADDR_FILE"
|
||||||
|
fi
|
||||||
|
cat $MACADDR_FILE
|
Loading…
Reference in New Issue
Block a user