Last active
December 8, 2017 14:20
-
-
Save kangtastic/45b485701c2f1a47a83534185b70c2f4 to your computer and use it in GitHub Desktop.
Print (as a hexstring) the contents of a dhcp6c_duid file for the dhcp6c DHCPv6 client
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# File: dhcp6c-attduid.sh | |
# Description: Script to print (as a hexstring) the contents of a dhcp6c_duid | |
# file for the dhcp6c DHCPv6 client. | |
# Intended for use with routers connected to u-Verse Fiber with the | |
# Residential Gateway bypassed. | |
# this awk one-liner should be fully portable | |
printduidhexstring() { echo -n "$*" | awk 'BEGIN{for(n=0;n<256;n++)ord[sprintf("%c",n)]=n}{len=split($0,c,"");printf("%02x00000200000de9",len+6);for(i=1;i<=len;i++)printf("%x",ord[c[i]]);print("")}'; } | |
echo "Print (as a hexstring) the contents of a dhcp6c_duid file for the dhcp6c DHCPv6 client." | |
echo "Step 1) RG information" | |
while read -p " Manufacturer [1=Pace, 2=Motorola]: " mfg; do | |
([ "$mfg" = "1" ] || [ "$mfg" = "2" ]) && break | |
done | |
while read -p " Serial number: " serial; do [ -n "$serial" ] && break; done | |
echo | |
[ "$mfg" = "1" ] && mfg="00D09E" || mfg="001E46" | |
printduidhexstring "$mfg-$serial" | |
echo | |
echo "Step 2) Type the above into a hex editor or something and save it as dhcp6c_duid" | |
echo "Step 3) Move the file you created into the appropriate path on your system" | |
echo "Finished" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment