Created
March 17, 2018 00:48
-
-
Save jrgutier/283cf1469273b0b3ddcfb781e97be895 to your computer and use it in GitHub Desktop.
Get ipv6 working with the default eap_proxy interfaces on EdgeOS
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 | |
PREAMBLE="\x19\x00\x00\x02\x00\x00\x0d\xe9\x30\x30\x44\x30\x39\x45\x2d" # For Pace 5268AC | |
SERIAL=00000A000000 | |
WAN=eth0.0 | |
LAN=eth1 | |
to_shellcode() | |
{ | |
counter=0 | |
IFS=$'\n' # Split for each line | |
for line in `echo -n "$1" | hexdump`; do # For each line in hexdump | |
IFS=" " # Split for each space | |
for byte in $(echo "$line" | cut -c 9-); do # For each byte pair in line | |
echo -n "\x" | |
echo -n $byte | cut -c 3- | awk '{printf $0}' # Print the seconde one | |
echo -n "\x" | |
echo -n $byte | cut -c -2 | awk '{printf $0}' # Print the first one | |
counter=$((counter + 2)) # MIGHT COUNT THE LAST NULL | |
# BYTE IF ODD NUMBER OF BYTES | |
done | |
IFS='\n' | |
done | |
} | |
echo -n -e "$PREAMBLE$(to_shellcode $SERIAL)" > /var/lib/dhcpv6/dhcp6c_duid | |
cat << EOF > "/var/run/dhcp6c-$WAN-pd.conf" | |
interface $WAN { | |
send ia-na 1; | |
send ia-pd 1; | |
request domain-name-servers; | |
request ntp-servers; | |
}; | |
id-assoc na 1 {}; | |
id-assoc pd 1 { | |
prefix ::/60 21600 86400; | |
prefix-interface $LAN { | |
sla-id 0; | |
sla-len 4; | |
ifid 1; | |
}; | |
}; | |
EOF | |
/opt/vyatta/bin/vyatta-op-cmd-wrapper renew dhcpv6-pd interface $WAN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@janthony6: The first pair of bytes is the length of the DUID and whether it's
\x00\x19
or\x19\x00
depends on the endianess of your device. The ER-X is little-endian, so on that device\x19\x00
is correct. The other EdgeOS devices (ERLite, ER4) are big-endian so\x00\x19
is correct. The remaining bytes should all be big-endian regardless of the device's endianess. Relevant code:https://github.com/opnsense/dhcp6c/blob/e36db7ea3989716c240d671a80e816b3cd4f9ff5/common.c#L1072