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

DEFAULTLISTENPORT under NETWORK DETAILS seems not working. #231

Closed thelittlerocket closed 3 years ago

thelittlerocket commented 3 years ago

Hi, thanks for the project, it is really nice. I do have an issue when I am playing around with the UI. We have some firewall in place and only allowed TCP/UDP ports will be able to pass through (both in and out), so I created a network, edit the default listen port, add access key, run the client script on the client, when the client is up, the default will always be 51821, would like to know what exactly the option for? BTW, when the client joins the network, I always got WARNING: Error encountered setting domain on dns. Aborted setting dns. , I am using Debian 10, any help will be appreciated. Distributor ID: Debian Description: Debian GNU/Linux 10 (buster) Release: 10 Codename: buster

thelittlerocket commented 3 years ago

I found that systemctl enable systemd-resolved.service solved the dns problem.

0xdcarns commented 3 years ago

Hi, it should be updating on your clients, we will investigate and let you know if we run into the same. Thanks for the report and glad you figured out the DNS thing at least!

thelittlerocket commented 3 years ago

Hi @0xdcarns, Thanks for the reply, I thought that the defaultlistenport will be the default port for all the clients when they join the network, or maybe that is not how it works.

Also, I found an interesting thing when I following the Quick Start Guide to install the netmaker server via docker on both Ubuntu 20.4 and Debian 10, when the UI is up and running after a network has been created, there will be a default node called "netmaker" if the os is Ubuntu 20.4, but not if the server's os is Debian 10. Would like to know if I miss something? Thanks. Image 2021-08-15 at 11 02 40 AM

0xdcarns commented 3 years ago

@thelittlerocket ah okay thank you. If that doesn't work, maybe try copying the netclient-amd64 or just the regular netclient binary into your /etc/netclient and see if that helps. Found at https://github.com/gravitl/netmaker/releases/tag/v0.7.1.

Then, this could be an issue with docker on debian. Make sure you're running the community version if you can.

Every network should spin up a netmaker node. So it's definitely a netclient issue, so try those two different binaries in the latest release and if that doesn't work, then I may need to investigate further

thelittlerocket commented 3 years ago

Hi @0xdcarns I tried both netclient and netclient-amd64, but it makes no difference on Debian. I can not found the log file so I enabled VERBOSITY=3, but the output looks the same to me. The only difference between the two systems is the wg's version. I really loved this project, how simplicity to join a network, and looks easy to maintain the peers when it grows, and the WebUI too. But I am clueless now.

Debian 10 root@debian:/etc/netclient# wg -v wireguard-tools v1.0.20210223 - https://git.zx2c4.com/wireguard-tools/

The docker logs output when I adding a new network

netmaker       | 2021/08/15 09:16:00 netmaker executing network join: /etc/netclient/netclient join -t <TOKEN> -name netmaker -endpoint <SERVER_IP>
netmaker       | 2021/08/15 09:16:00 Waiting for join command to finish...
netmaker       | 2021/08/15 09:16:00 netmaker could not set peers on network kkkkkkkok
netmaker       | 2021/08/15 09:16:00 netmaker file does not exist
netmaker       | 2021/08/15 09:16:00 netmaker adding to peer list:  <SERVER_IP>
netmaker       | 2021/08/15 09:16:01 Server added to network kkkkkkkok
netmaker       | 2021/08/15 09:16:01 admin created network kkkkkkkok

Ubuntu 20.4 root@ubuntu:~# wg -v wireguard-tools v1.0.20200513 - https://git.zx2c4.com/wireguard-tools/

The docker logs output when I adding a new network

netmaker       | 2021/08/15 09:01:01 netmaker executing network join: /etc/netclient/netclient join -t <TOKEN> -name netmaker -endpoint <SERVER_IP>
netmaker       | 2021/08/15 09:01:01 Waiting for join command to finish...
netmaker       | 2021/08/15 09:01:01 netmaker could not set peers on network kkkkk
netmaker       | 2021/08/15 09:01:01 netmaker file does not exist
netmaker       | 2021/08/15 09:01:01 netmaker adding to peer list:  <SERVER_IP>
netmaker       | 2021/08/15 09:01:01 netmaker adding to peer list:  <SERVER_IP>
netmaker       | 2021/08/15 09:01:02 netmaker adding to peer list:  <SERVER_IP>
netmaker       | 2021/08/15 09:01:03 Server added to network kkkkk
netmaker       | 2021/08/15 09:01:03 admin created network kkkkk
netmaker       | 2021/08/15 09:01:03 netmaker adding to peer list:  <SERVER_IP>
afeiszli commented 3 years ago

Hi @thelittlerocket, did you turn off udp hole punching for the network? If UDP Hole Punching is turned on, the nodes will ignore the Default Listen Port and instead use a randomly selected port.

thelittlerocket commented 3 years ago

Hi @afeiszli, the UDP Hole Punching default is on, so I did not change it. Side question, will UDP Hole Punching randomly select a port that is connectable? Our environment blocks most of the TCP/UDP ports, only a few are left open, we do have a specific range of UDP ports that is available for us to use, so if netclient choosing a UDP that is not connectable to the netmaker server, then it may not establish the connection?

Also when a network has been created before any nodes are added, I change the default listen port, the adding nodes, but the nodes are still using the 51821 as default, I have to edit every node to update the port setting, is this expected behavior?

afeiszli commented 3 years ago

Edit: There is definitely a bug in the netclient. Even with UDP Hole Punching off, the default port is not used. We have fixed this in a new branch but have not merged yet. Will close once merged.

@thelittlerocket Once this is merged, when creating a new network, you will have to switch off udp hole punching off in order to use.

afeiszli commented 3 years ago

Fixed in latest release: Fixed in https://github.com/gravitl/netmaker/releases/tag/latest