You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update dynamic DNS records on Google Domain every hour
Script
#!/bin/sh
### Google Domains provides an API to update a DNS "Syntheitc record". This script
### updates a record with the script-runner's public IP, as resolved using a DNS
### lookup.
###
### Google Dynamic DNS: https://support.google.com/domains/answer/6147083
### Synthetic Records: https://support.google.com/domains/answer/6069273
USERNAME=""
PASSWORD=""
HOSTNAME=""
while true
do
# Resolve current public IP
IP=`curl -s http://ifconfig.co`
URL="https://${USERNAME}:${PASSWORD}@domains.google.com/nic/update?hostname=${HOSTNAME}&myip=${IP}"
curl -s $URL --insecure
echo ""
date
echo ""
sleep 3600
done
Using the mips_linux_gcc toolchain to build iperf2 statically:
Tweak GCC
First start the making process of the toolchain, then:
cd ~/uclibc-crosstools-gcc-4.4.2-1-full/buildroot-4.4.2-1/output/toolchain/gcc-4.4.2/gcc/
nano unwind-dw2-fde-glibc.c
# Search for dl_iterate_phdr, comment out the if () and return NULL;
Build iperf2
git clone https://github.com/svn2github/iperf2
cd iperf2/branches/2.0-STABLE
./configure --host=mips-linux CFLAGS=-static CXXFLAGS=-static --enable-static --disable-shared
make
# Assume dropbear binaries are in PATH
mkdir -p /root/.ssh
# Generate keys
dropbearkey -t rsa -f /root/.ssh/dropbear_rsa_host_key
dropbearkey -t dss -f /root/.ssh/dropbear_dss_host_key
# Create server starting script
echo "dropbear -d /root/.ssh/dropbear_dss_host_key -r /root/.ssh/dropbear_rsa_host_key -p ????" > /root/.ssh/start_dropbear
chmod +x /root/.ssh/start_dropbear
# Set password for root
passwd
# Make root password permenant
mv /usr/etc/passwd /usr/etc/passwd.bak
cp /etc/passwd /usr/etc/
Use the router in network switch mode
The WAN port is left unused!
Connect a computer to LAN port (Using DHCP), do not connect WAN yet
Change the router IP to 192.168.0.2 (to be used on 192.168.0.x)
Disable DHCP server on the router
Save settings and reboot the router
Plug in WAN cable to LAN port on the router
Telnet into the router and run:
# Delete blackhole rules
ip rule del prio 32763
ip rule del prio 32764
ip rule del prio 32765
# To allow programs on the router to access the internet:
# Set a default gateway for the network bridge (LAN ports)
route add default gw 192.168.0.1 group1
# Set DNS name server:
echo "nameserver 8.8.8.8" > /etc/resolv.conf
wget https://github.com/arsv/perl-cross/releases/download/1.3/perl-cross-1.3.tar.gz
wget https://github.com/Perl/perl5/archive/v5.30.0.tar.gz
tar -xzf perl-cross-1.3.tar.gz
tar -xzf v5.30.0.tar.gz
cp -rfv perl-cross-1.3/* perl5-5.30.0
cd perl5-5.30.0
# Rikka's patch for no __builtin_bswap16
# Implement my own!
echo "unsigned short __builtin_bswap16(unsigned short a){return (a<<8)|(a>>8);}" > rikka.c
mips-linux-gcc -c rikka.c
./configure --prefix=/usr --target=mips-linux-uclibc --target-tools-prefix=mips-linux-
make
# Wait until error occurs
mips-linux-gcc -Wl,-E -o perl perlmain.o libperl.a rikka.o -lm -lcrypt -ldl
# make the rest
make
file ./perl
Not too sure why
# ./perl -del
Can't locate perl5db.pl in @INC (@INC contains: /usr/lib/perl5/site_perl/5.30.0/mips-linux /usr/lib/perl5/site_perl/5.30.0 /usr/lib/perl5/5.30.0/mips-linux /usr/lib/perl5/5.30.0 .).
BEGIN failed--compilation aborted.
Netgear did not provide the toolchain for D6200, however D6200 shares the same CPU with DGN2200v3, so we use the compiler for DGN2200v3 instead.
Install Docker on host system
Start docker
Command: qaq
Dockerfile:
FROM i686/ubuntu:14.04
RUN apt-get update
RUN apt-get install -y apt-utils
RUN apt-get install -y nano screen wget unzip bzip2
RUN apt install -y make gcc binutils patch build-essential
RUN apt install -y flex bison gawk libncurses5-dev gettext
# Downgrade texinfo https://askubuntu.com/questions/491184/texinfo-downgrade
RUN wget http://ftp.gnu.org/gnu/texinfo/texinfo-4.13.tar.gz && \
gzip -dc < texinfo-4.13.tar.gz | tar -xf - && \
cd texinfo-4.13 && \
./configure && \
make && make install
RUN apt install -y git autoconf libtool
Download the toolchain from Netgear
Compile
mkdir –p /opt/toolchains
unzip xxxxxx.zip
tar -xjf xxxx.tar.bz2
cd uclibc-crosstools-gcc-4.4.2-1-full
tar -xjf xxxx.tar.bz2
cd buildroot-4.4.2-1
make menuconfig
# save the .config
make