New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notes for installing on a Ubiquiti Edgerouter 4 #19

Open
stephenjamieson opened this Issue Apr 13, 2018 · 5 comments

Comments

4 participants
@stephenjamieson

stephenjamieson commented Apr 13, 2018

First, download and build cloudflared with mips64 (not covering go environment setup here)

Note: mips64 is used for the ER-4, other routers may use different architectures

# download src
go get -d github.com/cloudflare/cloudflared/cmd/cloudflared
# cross compile for linux and mips64
GOOS=linux GOARCH=mips64 go build github.com/cloudflare/cloudflared/cmd/cloudflared
# copy the binary to your router
scp <gobindir>/cloudflared <user>@<router>:

ssh to your router

# need root
sudo -i
# change ownersship of the binary
chown root:root cloudflared
# change permissions to allow execution
chmod +x cloudflared
# mv the binary to /usr/local/bin
mv cloudflared /usr/local/bin/
# create the cloudflared config directory
mkdir /etc/cloudflared

add config.yml to /etc/cloudflared (setting the proxy-dns-port to an available port on your router you know you won't use for anything else)

proxy-dns: true
proxy-dns-upstream:
 - https://1.1.1.1/dns-query
 - https://1.0.0.1/dns-query
proxy-dns-port: 8853

install the default init script

/usr/local/bin/cloudflared service install

Since we are using mips64, you'll want to disable auto update by replacing the cmd line with

cmd="/usr/local/bin/cloudflared --config /etc/cloudflared/config.yml --origincert /etc/cloudflared/cert.pem --pidfile /var/run/$name.pid --no-autoupdate"

Start the cloudflared service

/etc/init.d/cloudflared start

Finally for your router configuration,

# use dnsmasq (see https://help.ubnt.com/hc/en-us/articles/115002673188-EdgeRouter-Using-dnsmasq-for-DHCP-Server)
# enable the dnsmasq dhcp server
set service dhcp-server use-dnsmasq enable 
# set the router's name server
set system name-server 127.0.0.1
# set the default listen device
set service dns forwarding listen-on eth1
# set a default dns name for your local network
set system domain-name home.local 
# set your forwarding dns to the cloudflared port
set service dns forwarding options server=127.0.0.1#8853
commit
save
exit

Test if it works!

@stephenjamieson

This comment has been minimized.

Show comment
Hide comment
@stephenjamieson

stephenjamieson Apr 13, 2018

Just some notes, someone else should test!

stephenjamieson commented Apr 13, 2018

Just some notes, someone else should test!

@NixM0nk3y

This comment has been minimized.

Show comment
Hide comment
@NixM0nk3y

NixM0nk3y Apr 22, 2018

Hi,

thanks for these notes. It worked for me on a ER-3. One minor note commit and save need to be swapped to get the same configuration on boot i.e.

me@home-edge# save
Warning: you have uncommitted changes that will not be saved.

Saving configuration to '/config/config.boot'...
Done
[edit]


commit
save
exit

NixM0nk3y commented Apr 22, 2018

Hi,

thanks for these notes. It worked for me on a ER-3. One minor note commit and save need to be swapped to get the same configuration on boot i.e.

me@home-edge# save
Warning: you have uncommitted changes that will not be saved.

Saving configuration to '/config/config.boot'...
Done
[edit]


commit
save
exit
@stephenjamieson

This comment has been minimized.

Show comment
Hide comment
@stephenjamieson

stephenjamieson Apr 22, 2018

Thanks @NixM0nk3y, fixed it in the first comment.

stephenjamieson commented Apr 22, 2018

Thanks @NixM0nk3y, fixed it in the first comment.

@gedw99

This comment has been minimized.

Show comment
Hide comment
@gedw99

gedw99 Apr 30, 2018

Can someone help me out ?

If your main adsl is untouched and you plugin your own router with the cloudflare code running, does it serve the local webserver on that router ?

No messing with port forwarding on the adsl router ?

gedw99 commented Apr 30, 2018

Can someone help me out ?

If your main adsl is untouched and you plugin your own router with the cloudflare code running, does it serve the local webserver on that router ?

No messing with port forwarding on the adsl router ?

@rufoa

This comment has been minimized.

Show comment
Hide comment
@rufoa

rufoa Aug 8, 2018

@stephenjamieson works great on er-x (mipsle), thank you!

rufoa commented Aug 8, 2018

@stephenjamieson works great on er-x (mipsle), thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment