Netclient OpenVZ Error
# client
b
Is there no way to join a network from an OpenVZ server? I'm having errors thrown by netclient.
Copy code
OS Version: Ubuntu 20.04
Netclient Version: v0.20.0
Virtualization: OpenVZ
Trying to join a network or running a netclient command from a OpenVZ VPS yields the following error:
Copy code
[netclient] 2023-05-19 06:02:20 setting OS 
[netclient] 2023-05-19 06:02:20 setting version 
[netclient] 2023-05-19 06:02:20 setting netclient hostid 
[netclient] 2023-05-19 06:02:20 setting name 
[netclient] 2023-05-19 06:02:20 setting macAddress 
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/gravitl/netclient/config.CheckConfig()
        /home/mkasun/netclient/config/config.go:489 +0x10ff
github.com/gravitl/netclient/config.InitConfig(0xc0000d21a0?)
        /home/mkasun/netclient/config/config.go:437 +0x70
github.com/gravitl/netclient/cmd.initConfig()
        /home/mkasun/netclient/cmd/root.go:53 +0x4f
github.com/spf13/cobra.(*Command).preRun(...)
        /home/mkasun/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:970
github.com/spf13/cobra.(*Command).execute(0x13de620, {0x141eee0, 0x0, 0x0})
        /home/mkasun/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:900 +0x563
github.com/spf13/cobra.(*Command).ExecuteC(0x13ddd80)
        /home/mkasun/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
        /home/mkasun/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992
github.com/gravitl/netclient/cmd.Execute()
        /home/mkasun/netclient/cmd/root.go:31 +0x25
main.main()
        /home/mkasun/netclient/main.go:18 +0x4a
Primary network interface:
Copy code
venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default 
    link/void 
    inet 127.0.0.1/32 scope host venet0
       valid_lft forever preferred_lft forever
    inet 10.X.X.X/32 brd 10.X.X.X scope global venet0:0
       valid_lft forever preferred_lft forever
    inet6 2001:X:X:X:X:X/128 scope global 
       valid_lft forever preferred_lft forever
b
It looks like netclient cannot find your macaddress
b
OpenVZ server venet interface does not have a mac address
b
can you assign it one? netclient will not work otherwise
b
No, OpenVZ venet does not support mac address assignment
b
would have to build a patched version of netclient for openvz then
Is there a way to tell that you are running in openvz?
b
running
Copy code
hostnamectl status or systemd-detect-virt
returns the virtualization type of the server
b
can you try that
b
I'll try
I'm able to register the host using the new netclient, but no interface were detected on the dashboard.
b
probably because your primary interface is also a loopback
taking a quick peek at the openvz docs: I think you need to switch to bridged networking mode vice host-routing mode
b
I don't think it's possible to do that from inside the OpenVZ container
b
Yes, done at server level
b
Is there a change from netclient 0.16.3?
OpenVZ connectivity used to work without problem on older version
b
16.3-->20.0, lots of changes
b
As of right now, only register works. Joining a network doesn't connect the OpenVZ host to other hosts on the network.
So there is no way to fix this without having access to the openvz virtualization host?
b
I don't believe so. From my quick read of the OpenVZ docs, you have to use bridged networking
b
is there no way to set the interface for netclient?
b
No
b
i see
b
netclient will not use an interface that is : down loopback point-to-point
b
Is there a way for me to reverse this behavior myself?
b
you would have make changes to the netclient source and re-compile the executable
b
i see
What changes did you make to build this binary?
I believe i should change the function getInterfaces() on /functions/localport.go
b
If you change that function it will have other impacts, eg endpoint detect7
b
Alright, will openvz point-to-point venet be considered to be supported on future releases?
b
it will be looked at but I cannot guarantee it will have high priority
b
I have build a custom netclient version which fixed the interface detection problem, but there is no hosts detected on the netmaker wireguard interface.
Netclient successfully pulled the hosts data on /etc/netclient/netmaker.conf
b
Is the daemon running
b
It is running
b
any errors from daemon? What is output of
netclient list
b
Copy code
root@01-bhs:~# sudo netclient list
[
 {
  "network": "hyperspace",
  "node_id": "aa6affaa-95d1-460a-a409-95889708b578",
  "connected": true,
  "ipv4_addr": "10.34.0.1/24",
  "ipv6_addr": ""
 },
 {
  "network": "vpn",
  "node_id": "2324820a-5cc7-4c2e-aecd-38054a708d5e",
  "connected": true,
  "ipv4_addr": "10.69.0.1/24",
  "ipv6_addr": "fd69::1/16"
 }
]
b
wg show
?
b
Copy code
root@01-bhs:~# wg
interface: netmaker
  public key: [key]
  private key: (hidden)
  listening port: 510
b
ip a
and
netclient list -l
b
Copy code
root@01-bhs:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default 
    link/void 
    inet 127.0.0.1/32 scope host venet0
       valid_lft forever preferred_lft forever
    inet 10.X.X.X/32 brd 10.X.X.X scope global venet0:0
       valid_lft forever preferred_lft forever
    inet6 2607:X:X:X::X/128 scope global 
       valid_lft forever preferred_lft forever
37: netmaker: <POINTOPOINT,MULTICAST,NOARP> mtu 1420 qdisc noop state DOWN group default qlen 500
    link/none 
    inet 10.34.0.1/24 brd 10.34.0.255 scope global netmaker
       valid_lft forever preferred_lft forever
    inet 10.69.0.1/24 brd 10.69.0.255 scope global netmaker
       valid_lft forever preferred_lft forever
    inet6 fd69::1/16 scope global 
       valid_lft forever preferred_lft forever
Copy code
root@01-bhs:~# sudo netclient list -l
[netclient] 2023-05-26 12:17:47 [list.go-62] List(): no peers present on network vpn 
[
 {
  "network": "hyperspace",
  "node_id": "aa6affaa-95d1-460a-a409-95889708b578",
  "connected": true,
  "ipv4_addr": "10.34.0.1/24",
  "ipv6_addr": "",
  "peers": [
   {
    "public_key": "[key]",
    "endpoint": "152.X.X.X:51888",
    "allowed_ips": [
     "10.34.0.170/32"
    ]
   },
   {
    "public_key": "[key]",
    "endpoint": "45.X.X.X:51821",
    "allowed_ips": [
     "10.34.0.155/32"
    ]
   },
   {
    "public_key": "[key]",
    "endpoint": "15.X.X.X:51821",
    "allowed_ips": [
     "10.34.0.195/32",
     "10.34.0.254/32",
     "10.34.0.253/32"
    ]
   },
   {
    "public_key": "[key]",
    "endpoint": "182.X.X.X:51821",
    "allowed_ips": [
     "10.34.0.140/32"
    ]
   }
  ]
 }
]
b
does restarting the daemon help
systemctl restart netclient
b
restarting daemon results in missing netmaker interface
subsequently preventing the start of the netclient daemon
b
errors from log?
b
Copy code
[netclient] 2023-05-26 12:26:50 [mqpublish.go-241] UpdateHostSettings(): checkin with server(s) 
[netclient] 2023-05-26 12:26:50 [localport.go-24] GetLocalListenPort(): failed to parse interface netmaker 
[netclient] 2023-05-26 12:26:50 [mqpublish.go-287] UpdateHostSettings(): error encountered checking local listen port:  netmaker dial unix /var/run/wireguard/netmaker.sock: connect: connection refused 
[netclient] 2023-05-26 12:26:52 [turn_helper.go-157] WatchPeerConnections(): failed to get iface:  dial unix /var/run/wireguard/netmaker.sock: connect: connection refused
b
that looks like the wireguard kernel module is not installed
b
I am using the userspace implementation of wireguard
BoringTun
ah it suddenly worked
not sure what happened there
b
that is going to be very slow with userspace wireguard
b
yeah i know
unfortunately most openvz vps does not come with wireguard kernel module
Problems i encountered so far:
Other hosts not immediately detected upon joining the network
OpenVZ hosts losing netmaker interface when a new host joined the network. Can be remedied by restarting the daemon
More problems i encountered:
Fully broken connectivity with openvz hosts (Handshake with no traffic between hosts even after adding iptable rules)
Relevant logs: [Beauharnois Host Joining network "vpn"]
Copy code
May 28 10:23:13 01bhsca netclient[12630]: [netclient] 2023-05-28 10:23:13 received reset
May 28 10:23:13 01bhsca netclient[12630]: [netclient] 2023-05-28 10:23:13 checkin routine closed
May 28 10:23:13 01bhsca netclient[12630]: [netclient] 2023-05-28 10:23:13 closed endpoint detection
May 28 10:23:13 01bhsca netclient[12630]: [netclient] 2023-05-28 10:23:13 closing netmaker interface
May 28 10:23:13 01bhsca netclient[12630]: [netclient] 2023-05-28 10:23:13 restarting daemon
May 28 10:23:13 01bhsca netclient[12630]: [netclient] 2023-05-28 10:23:13 error reading node map from disk open /etc/netclient/nodes.yml: no such file or directory
May 28 10:23:13 01bhsca netclient[12630]: [netclient] 2023-05-28 10:23:13 adding addresses to netmaker interface
May 28 10:23:14 01bhsca netclient[12630]: [netclient] 2023-05-28 10:23:14 netclient message queue started for server: nm.domain.xyz
May 28 10:23:14 01bhsca netclient[12630]: [netclient] 2023-05-28 10:23:14 Starting Proxy...
May 28 10:23:14 01bhsca netclient[12630]: [netclient] 2023-05-28 10:23:14 set nat info: &{144.X.X.X 10.X.X.X 51722 51722 false symmetric}
May 28 10:23:14 01bhsca netclient[12630]: [netclient] 2023-05-28 10:23:14 initialized endpoint detection on port 51722
May 28 10:23:14 01bhsca netclient[12630]: [netclient] 2023-05-28 10:23:14 mqtt connect handler
May 28 10:23:14 01bhsca netclient[12630]: [netclient] 2023-05-28 10:23:14 published host turn register signal to server: nm.domain.xyz
Copy code
May 28 10:23:14 01bhsca netclient[12630]: [netclient] 2023-05-28 10:23:14 received reset
May 28 10:23:14 01bhsca netclient[12630]: [netclient] 2023-05-28 10:23:14 shutting down message queue for server nm.domain.xyz
May 28 10:23:14 01bhsca netclient[12630]: [netclient] 2023-05-28 10:23:14 closed endpoint detection
May 28 10:23:14 01bhsca netclient[12630]: [netclient] 2023-05-28 10:23:14 checkin routine closed
May 28 10:23:14 01bhsca netclient[12630]: [netclient] 2023-05-28 10:23:14 shutting down proxy manager...
May 28 10:23:14 01bhsca netclient[12630]: [netclient] 2023-05-28 10:23:14 Exiting Peer Signals Watcher...
May 28 10:23:14 01bhsca netclient[12630]: [netclient] 2023-05-28 10:23:14 MQ host sub:  be06a285-b3d1-480b-82f4-60b9f27950fd connection lost before Subscribe completed
May 28 10:23:16 01bhsca netclient[12630]: [netclient] 2023-05-28 10:23:16 Shutting down Proxy.....
May 28 10:23:23 01bhsca netclient[12630]: [netclient] 2023-05-28 10:23:23 Failed to allocate:  all retransmissions failed for VJAERv0Q9tbhM9t0
May 28 10:23:23 01bhsca netclient[12630]: [netclient] 2023-05-28 10:23:23 failed to allocate addr on turn:  all retransmissions failed for VJAERv0Q9tbhM9t0
May 28 10:23:23 01bhsca netclient[12630]: [netclient] 2023-05-28 10:23:23 Closing turn conn:  nm.domain.xyz
May 28 10:23:23 01bhsca netclient[12630]: [netclient] 2023-05-28 10:23:23 Dissolving TURN Peer Connections...
[Netmaker]
Copy code
[netmaker] 2023-05-28 10:23:13 01bhsca be06a285-b3d1-480b-82f4-60b9f27950fd registered with Netmaker 
[netmaker] 2023-05-28 10:23:13 added new node 150c555b-9d8a-4d02-9159-90223fa8be9d to host 01bhsca 
[netmaker] 2023-05-28 10:23:13 peer update for host 3961ea9d-2b93-4b78-99c2-f8a7699ec738 
[netmaker] 2023-05-28 10:23:13 peer update for host 51a88167-cd59-4031-bf8c-13be82b4c7a9 
[netmaker] 2023-05-28 10:23:13 peer update for host 5ec8e249-a989-4641-8c19-4a86b041296c 
[netmaker] 2023-05-28 10:23:13 peer update for host 9172028a-9cd0-4f42-8140-55be1eecd2ac 
[netmaker] 2023-05-28 10:23:13 peer update for host be06a285-b3d1-480b-82f4-60b9f27950fd 
[netmaker] 2023-05-28 10:23:14 peer update for host be06a285-b3d1-480b-82f4-60b9f27950fd 
[netmaker] 2023-05-28 10:23:14 error retrieving custom dns entries could not find any records 
[netmaker] 2023-05-28 10:23:17 failed to register host with turn server:  httpclient: json error 
[netmaker] 2023-05-28 10:23:27 failed to register host with turn server:  httpclient: json error 
[netmaker] 2023-05-28 10:23:43  failed to get node info [3cb8ea0b-29c4-489b-b323-afe5a2253467]: could not find any records 
[netmaker] 2023-05-28 10:23:43 processed request error: could not find any records
7 Views