Skip to content
Snippets Groups Projects
Unverified Commit 766a8610 authored by Paul's avatar Paul :turtle:
Browse files

fix script and generate new ip on each start

parent 0613e599
No related branches found
No related tags found
No related merge requests found
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
DEST="./ffhl" DEST="./ffhl"
SECRET=$(fastd --generate-key | awk '/Secret/ {print $2 }') SECRET=$(fastd --generate-key | awk '/Secret/ {print $2 }')
# generate a random address and hope its not already used
IPADDRESS="10.130.$(( 16 + $RANDOM % 15)).$(( 1 + $RANDOM % 254))"
mkdir -p $DEST mkdir -p $DEST
...@@ -34,9 +33,12 @@ EOF ...@@ -34,9 +33,12 @@ EOF
# ip setup script # ip setup script
cat - > $DEST/fastd-up << EOF cat - > $DEST/fastd-up << EOF
#!/bin/sh #!/bin/bash
# generate a random ip on each start
IPADDRESS="10.130.\$(( 16 + \$RANDOM % 15)).\$(( 1 + \$RANDOM % 254))"
ip address add ${IPADDRESS}/16 dev \$INTERFACE ip address add \${IPADDRESS}/16 dev \$INTERFACE
ip link set \$INTERFACE up ip link set \$INTERFACE up
EOF EOF
...@@ -46,6 +48,6 @@ echo "==========================================================" ...@@ -46,6 +48,6 @@ echo "=========================================================="
echo "!!!!! send this key to someone !!!!!" echo "!!!!! send this key to someone !!!!!"
echo "run 'fastd --show-key -c $DEST/fastd.conf' to see it again" echo "run 'fastd --show-key -c $DEST/fastd.conf' to see it again"
echo "you also want to move $DEST to /etc/fastd/" echo "you also want to move $DEST to /etc/fastd/"
echo " sudo mv $DEST to /etc/fastd/" echo " sudo mv $DEST /etc/fastd/"
echo echo
fastd --show-key -c $DEST/fastd.conf fastd --show-key -c $DEST/fastd.conf
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment