gravitl / netmaker

Netmaker makes networks with WireGuard. Netmaker automates fast, secure, and distributed virtual networks.
https://netmaker.io
Other
9.4k stars 547 forks source link

netclient binary not running in openwrt x86 version #270

Closed changchichung closed 2 years ago

changchichung commented 3 years ago

Desktop: Acer VX2630G , add one more NIC OS: openwrt 19.07 x86 verseion

root@OpenWrt:/tmp# cat /etc/os-release 
NAME="OpenWrt"
VERSION="19.07.8"
ID="openwrt"
ID_LIKE="lede openwrt"
PRETTY_NAME="OpenWrt 19.07.8"
VERSION_ID="19.07.8"
HOME_URL="https://openwrt.org/"
BUG_URL="https://bugs.openwrt.org/"
SUPPORT_URL="https://forum.openwrt.org/"
BUILD_ID="r11364-ef56c85848"
OPENWRT_BOARD="x86/generic"
OPENWRT_ARCH="i386_pentium4"
OPENWRT_TAINTS=""
OPENWRT_DEVICE_MANUFACTURER="OpenWrt"
OPENWRT_DEVICE_MANUFACTURER_URL="https://openwrt.org/"
OPENWRT_DEVICE_PRODUCT="Generic"
OPENWRT_DEVICE_REVISION="v0"
OPENWRT_RELEASE="OpenWrt 19.07.8 r11364-ef56c85848"

so when I run netclient-install.sh ( with a little modification ) there's some error messages

root@OpenWrt:~# ./netclient-install.sh 
sh: 0: unknown operand
--2021-08-30 23:28:15--  https://github.com/gravitl/netmaker/releases/download/v0.5-beta/netclient
Resolving github.com... 52.192.72.89
Connecting to github.com|52.192.72.89|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github-releases.githubusercontent.com/351486934/2946a480-c42d-11eb-9dc4-3f1a4110b193?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210831%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210831T072815Z&X-Amz-Expires=300&X-Amz-Signature=c88d1767161acfd1cc8b00498ec55c13037e9d6b7af2f632407514f2c6d7c46b&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=351486934&response-content-disposition=attachment%3B%20filename%3Dnetclient&response-content-type=application%2Foctet-stream [following]
--2021-08-30 23:28:15--  https://github-releases.githubusercontent.com/351486934/2946a480-c42d-11eb-9dc4-3f1a4110b193?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210831%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210831T072815Z&X-Amz-Expires=300&X-Amz-Signature=c88d1767161acfd1cc8b00498ec55c13037e9d6b7af2f632407514f2c6d7c46b&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=351486934&response-content-disposition=attachment%3B%20filename%3Dnetclient&response-content-type=application%2Foctet-stream
Resolving github-releases.githubusercontent.com... 185.199.108.154, 185.199.111.154, 185.199.110.154, ...
Connecting to github-releases.githubusercontent.com|185.199.108.154|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 20354104 (19M) [application/octet-stream]
Saving to: 'netclient'

netclient                            100%[====================================================================>]  19.41M  10.2MB/s    in 1.9s    

2021-08-30 23:28:17 (10.2 MB/s) - 'netclient' saved [20354104/20354104]

./netclient: line 1: ELF: not found
./netclient: line 1: Wv: not found
./netclient: line 1: v: not found
./netclient: line 1: ���m��m�$$: not found
./netclient: line 2: @$: not found
./netclient: line 1: �: not found
./netclient: line 1: {�: not found
./netclient: line 3: @�@$@$0Q�td�e@*Ev: not found
./netclient: line 4: ./netclient: line 4: ����~��~��
                                                             ����: not found
��{��{��
         v�: not found
./netclient: line 6: syntax error: unexpected "("
root@OpenWrt:~# 

I think that's related to compiler or something , so I try to git clone the repository and run netmaker32

root@OpenWrt:/tmp/netmaker# ./netmaker32

    ______     ______     ______     __   __   __     ______   __                        
   /\  ___\   /\  == \   /\  __ \   /\ \ / /  /\ \   /\__  _\ /\ \                       
   \ \ \__ \  \ \  __<   \ \  __ \  \ \ \'/   \ \ \  \/_/\ \/ \ \ \____                  
    \ \_____\  \ \_\ \_\  \ \_\ \_\  \ \__|    \ \_\    \ \_\  \ \_____\                 
     \/_____/   \/_/ /_/   \/_/\/_/   \/_/      \/_/     \/_/   \/_____/                 

 __   __     ______     ______   __    __     ______     __  __     ______     ______    
/\ "-.\ \   /\  ___\   /\__  _\ /\ "-./  \   /\  __ \   /\ \/ /    /\  ___\   /\  == \   
\ \ \-.  \  \ \  __\   \/_/\ \/ \ \ \-./\ \  \ \  __ \  \ \  _"-.  \ \  __\   \ \  __<   
 \ \_\\"\_\  \ \_____\    \ \_\  \ \_\ \ \_\  \ \_\ \_\  \ \_\ \_\  \ \_____\  \ \_\ \_\ 
  \/_/ \/_/   \/_____/     \/_/   \/_/  \/_/   \/_/\/_/   \/_/\/_/   \/_____/   \/_/ /_/ 

2021/08/31 07:30:49 Error connecting to database.
2021/08/31 07:30:49 tried all peers unsuccessfully. here are the results:
   peer #0: http://localhost:4001/status failed due to Get "http://localhost:4001/status": dial tcp [::1]:4001: connect: connection refused
root@OpenWrt:/tmp/netmaker#

so this one is working , but I can not run the netclient download in netclient-install.sh in openwrt

so I use another desktop running ubuntu focal x64 , and download netclient from https://github.com/gravitl/netmaker/releases/download/v0.5-beta/netclient then try manual join to the net

administrator@administrator-ThinkPad-T470:~$ sudo ./netclient join -t NTA1NTV8MTAuMTAxLjAuMTo1MDA1MXwxNzAuMTc4LjIwOC44NDo4MDgxfGVtYXR0ZXJzfGFuVEt5WDNXR3pqWjFRelF8
2021/08/31 15:37:09 attempting to joining ematters at 10.101.0.1:50051
2021/08/31 15:37:10 Error installing:  rpc error: code = Internal desc = Invalid key, and network does not allow no-key signups
2021/08/31 15:37:11 Failed to authenticate: rpc error: code = Unauthenticated desc = Something went wrong with Auto Login: rpc error: code = Unknown desc = mongo: no documents in result
2021/08/31 15:37:11 Removed ematters network locally
2021/08/31 15:37:11 Error stopping netclient-ematters.timer. Please investigate.
2021/08/31 15:37:11 exit status 5
2021/08/31 15:37:11 Error disabling netclient-ematters.timer. Please investigate.
2021/08/31 15:37:11 exit status 1
2021/08/31 15:37:11 Error removing file. Please investigate.
2021/08/31 15:37:11 exit status 1
2021/08/31 15:37:11 Error stopping netclient-ematters.timer. Please investigate.
2021/08/31 15:37:11 exit status 5
2021/08/31 15:37:11 Error disabling netclient-ematters.timer. Please investigate.
2021/08/31 15:37:11 exit status 1
2021/08/31 15:37:11 Error removing file. Please investigate.
2021/08/31 15:37:11 exit status 1

lets just forget the error here ,
in this desktop , the netclient binary download from https://github.com/gravitl/netmaker/releases/download/v0.5-beta/netclient is just worked. but follow the same steps , the binary file download in openwrt IS NOT WORKING !!

Does netmake not support openwrt yet ?? in my last test( couple months ago) , I remember I could run netclient in openwrt. or should I use netmaker with VM instead of an openwrt x86 router ?

afeiszli commented 3 years ago

Hi @changchichung, we do not officially support openwrt. If you would like to try the netclient on openwrt, the best way to do this would be:

  1. Git clone the repo (onto the openwrt machine)
  2. cd netmaker/netclient
  3. go build .

Then run the compiled binary.

It also looks like you are using v0.5-beta, which is pretty outdated now, you should be using 0.7.3.

afeiszli commented 3 years ago

If you set the GOOS and GOARCH settings correctly you should be able to compile the binary for OpenWRT on another machine as well, but I don't know what those settings should be, and unfortunately don't have an OpenWRT router for testing. Some other flags may be needed as well like GOMIPS, CC, and CGO_ENABLED.

pete1019 commented 3 years ago

Any news on official OpenWRT support? You guys could use it in a VM. Or i would sponsor for a router.

afeiszli commented 2 years ago

@changchichung please check this for 0.8.5. It should work now that we have removed glibc dependenceis on the netclient.

afeiszli commented 2 years ago

OpenWRT support added in 0.9.0