Hamachi binary not works as expected

Marvell Kirkwood based
User avatar
MrDini
Posts: 651
Joined: Mon Dec 21, 2015 7:21 pm
Contact:

Hamachi binary not works as expected

Post by MrDini » Wed Jan 11, 2017 2:25 pm

Hi,

I am working on a hamachi arm port for my NAS. It is done, but when I try to login, it says just Logging in .. for a long time... My RPi with the same binary Can connect to the server withoutany issues. :?

At the debugger log of the hamachid, I Can only see the following lines:

Code: Select all

01.11 15:20:19.939 ses: resolving  <removed IP address> ..
01.11 15:19:13.283 ipc: <id of the NAS> add client 1
01.11 15:19:13.284 cfg: save()
01.11 15:19:13.288 cfg: hks: [0] [2048]
01.11 15:19:13.288 cfg: hkc: [0] [2048] [2048]
01.11 15:19:13.289 sys: connmgr_go_online, reconnect 0
------------------
Mod: compare this output with the RPi's output, I think the problem is related with the first line, with the resolving... But why the hamachi daemon wants to resolve a simple IP address?
------------------

A new interface appears, just the login not works:

Code: Select all

ham0      Link encap:Ethernet  HWaddr <removed>  
          UP BROADCAST RUNNING MULTICAST  MTU:1404  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
Maybe, something is missing? :roll: Like I saw, the lsb and lsb-core packages are required to run this package correctly. But I Couldn't find any source, that I Can compile for the FFp.

Has anybody here have some experience with hamachi? If yes, Can You please help me?

Many thanks!
Thanks nas-central the lot of help! :)

barmalej2
Posts: 2387
Joined: Sun Apr 29, 2012 5:24 pm

Re: Hamachi binary not works as expected

Post by barmalej2 » Wed Jan 11, 2017 6:24 pm

Imo, this is relevant part from mine openvpn-server start script:

Code: Select all

# Create device node for tun
if      [ ! -c /dev/net/tun ]
then
		mkdir -p /dev/net
		mknod /dev/net/tun c 10 200
		chown "$runas_user":"$runas_user" /dev/net/tun
		chmod 600 /dev/net/tun
else
		if      [ "$(stat -c '%U' /dev/net/tun)" != "$runas_user" ]
		then
				chown "$runas_user":"$runas_user" /dev/net/tun
				chmod 600 /dev/net/tun
		fi
fi

# Load tun.ko driver module
# If there is firmware tun.ko, assume, that kernel will autoload it on openVPN server start
if      [ ! -r /lib/modules/"$(uname -r)"/kernel/drivers/net/tun.ko ]
then
		grep -qw '^tun' /proc/modules
		if      [ $? != 0 ]
		then
				insmod "$tun_module" >/dev/null 2>&1
		fi
fi
# Enable IP forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward

User avatar
MrDini
Posts: 651
Joined: Mon Dec 21, 2015 7:21 pm
Contact:

Re: Hamachi binary not works as expected

Post by MrDini » Wed Jan 11, 2017 7:07 pm

Hi,

Thanks a lot for Your quick reply!

I have already done something similar, except the last line, which does the forwarding. I tried it, but unfortunately not helped. I think, there is another error. Otherwise (if the issue is module related) the interface ham0 Cannot be created. So there is another error I think... :roll:
Thanks nas-central the lot of help! :)

barmalej2
Posts: 2387
Joined: Sun Apr 29, 2012 5:24 pm

Re: Hamachi binary not works as expected

Post by barmalej2 » Wed Jan 11, 2017 8:23 pm

Was device nodes created?

User avatar
MrDini
Posts: 651
Joined: Mon Dec 21, 2015 7:21 pm
Contact:

Re: Hamachi binary not works as expected

Post by MrDini » Wed Jan 11, 2017 9:12 pm

Yes.

BTW: here is the commands, that I used for create the device node:

Code: Select all

	mkdir -p /dev/net
	mknod /dev/net/tun c 10 200
	chmod 0666 /dev/net/tun
Certainly, the tun module already loaded, and I also tried the echo 1 to ip port forward enable...
Thanks nas-central the lot of help! :)

User avatar
MrDini
Posts: 651
Joined: Mon Dec 21, 2015 7:21 pm
Contact:

Re: Hamachi binary not works as expected

Post by MrDini » Wed Jan 11, 2017 10:09 pm

Interesting! I decided to start the process from the scratch and secondly start the hamachid by hands.

So, firstly, I rebooted the box. After it, I loaded the /ffp/lib/modules/2.6.31.8/kernel/drivers/net/tun.ko module with the insmod command and created the device node with the correct permissions. And finally, tried to start the daemon with debugger console. When I executed it at the first time, it returned blank and exited. No idea, why... But secondly, it started, with a successful handshake with the server. So looked like perfect, but while, I tried to intercept the debugged daemon, and start the normal one, every time, when I pressed Ctrl+C, the console only gave me a ^C.... And I Can't kill it of course. Like in case of the new openvpn... Barmalej, Do You remember, what was Your solution at the past? If I clearly remember, it caused, because the NSA320S kernel has auto module loading function... :roll:
Thanks nas-central the lot of help! :)

barmalej2
Posts: 2387
Joined: Sun Apr 29, 2012 5:24 pm

Re: Hamachi binary not works as expected

Post by barmalej2 » Thu Jan 12, 2017 6:17 am

Openvpn start script loads /ffp/lib/modules/"$(uname -r)"/kernel/drivers/net/tun.ko module only if /lib/modules/"$(uname -r)"/kernel/drivers/net/tun.ko doesn't exist. You need to load firmware tun.ko:

Code: Select all

insmod /lib/modules/"$(uname -r)"/kernel/drivers/net/tun.ko
Might be, that kernel will autoload it after creating device node for tun and starting hamachi. At least it is true for openvpn.

User avatar
MrDini
Posts: 651
Joined: Mon Dec 21, 2015 7:21 pm
Contact:

Re: Hamachi binary not works as expected

Post by MrDini » Thu Jan 12, 2017 5:47 pm

Okay, will try that. But yes, the module loads automatically, while I create the device node. And one more interesting thing! I Could remove the fw tun.ko module without any problems. :)

PS: why the 3rd party module causes this unkillable processes?
Thanks nas-central the lot of help! :)

User avatar
MrDini
Posts: 651
Joined: Mon Dec 21, 2015 7:21 pm
Contact:

Re: Hamachi binary not works as expected

Post by MrDini » Thu Jan 12, 2017 9:11 pm

I have done some testing now after a clear reboot...

Firstly, I simply created the device node, fixed the permissions, etc. After that, I tried to start the hamachid. As expected, it gives exactly the same output, than at my past tries. But after the devnode creation, I Could't see the tun module at the lsmod output. So, I tried to load the fw tun.ko with insmod. Now, I saw the tun module at the lsmod. So test round two! :) But unfortunately it gives me exactly the same output as the first try did... :(

However if I load the 'with FFp comes' tun.ko, I Can see the daemon Can start up correctly, the only one problem is, it always freezes at this statement. So I Can't use it.

Barmalej, if I send You a testing hamachi package, would You mind testing it on Your NSA310?

PS: I tried to execute the openvpn start script first with debug suffix and intercept that (So the script loads the module, but the oVPN kills) and after that run hamachid, but stuck on logging in....

Mod: Where Can I get a working tap module?
Thanks nas-central the lot of help! :)

barmalej2
Posts: 2387
Joined: Sun Apr 29, 2012 5:24 pm

Re: Hamachi binary not works as expected

Post by barmalej2 » Fri Jan 13, 2017 8:16 am

MrDini wrote: Barmalej, if I send You a testing hamachi package, would You mind testing it on Your NSA310?
Sure. Just give me a link.
MrDini wrote: Mod: Where Can I get a working tap module?
I am not sure at 100%, but I think there is no such separate tap module. It is the same tun.ko. Below is example how openvpn creates virtual tap0 network interface.

Code: Select all

mkdir /dev/net
mknod /dev/net/tun c 10 200
modprobe tun
openvpn --mktun --dev tap0
Fri Jan 13 08:19:53 2017 TUN/TAP device tap0 opened
Fri Jan 13 08:19:53 2017 Persist state set to: ON

User avatar
MrDini
Posts: 651
Joined: Mon Dec 21, 2015 7:21 pm
Contact:

Re: Hamachi binary not works as expected

Post by MrDini » Fri Jan 13, 2017 3:01 pm

Many thanks, I sent the package link, and some additional informations by pm.

Fingers crossed!
Thanks nas-central the lot of help! :)

barmalej2
Posts: 2387
Joined: Sun Apr 29, 2012 5:24 pm

Re: Hamachi binary not works as expected

Post by barmalej2 » Fri Jan 13, 2017 4:44 pm

Getting this output, when running hamachid in debug mode:
01.13 18:32:58.609 cfg: load()
01.13 18:32:58.611 dbg: deploy_id '' parse failed
01.13 18:32:58.611 cfg: hkc set: [2048] [2048]
01.13 18:32:58.611 cfg: save()
01.13 18:32:58.612 cfg: hks: [0] [2048]
01.13 18:32:58.612 cfg: hkc: [0] [2048] [2048]
01.13 18:32:58.613 starting up ..
01.13 18:32:58.613 sys: version armv5tel-2.1.0.174
01.13 18:32:58.613 sys: os Linux 2.6.31.8 #2 Fri Aug 2 11:21:44 CST 2013 armv5tel
01.13 18:32:58.614 vpn: IPv6 support is: 3
01.13 18:32:58.615 ipc: 5 listening at /var/run/logmein-hamachi/ipc.sock
01.13 18:32:58.616 sys: initializing vpn domains, vpn-reinstall = 0 ..
01.13 18:32:58.617 vpn: added [Hamachi] domain (not roaming)
01.13 18:32:58.617 dbg: setup_vpn_domain [Hamachi]
01.13 18:32:58.617 dbg: vpn_domain::config - [Hamachi]
01.13 18:32:58.617 vpn: switched [Hamachi] domain into L3 mode, 0.0.0.0/0.0.0.0
01.13 18:32:58.618 dbg: enable(Hamachi), locked: 0
01.13 18:32:58.618 vpn: domain [Hamachi] -> 'VPN_opening'
01.13 18:32:58.618 vpn: enabling [Hamachi] domain ..
01.13 18:32:58.618 vpn: on_set_tapdev(, 1) -> ok
01.13 18:32:58.624 tap: device ham0 opened
01.13 18:32:58.624 vpn: domain [Hamachi] -> 'VPN_up'
01.13 18:32:58.625 dbg: setup_vpn_domain [Hamachi]
01.13 18:32:58.625 dbg: vpn_domain::config - [Hamachi]
01.13 18:32:58.625 vpn: domain [Hamachi] -> 'VPN_setting_up'
01.13 18:32:58.625 tap: config(ham0, 0.0.0.0, 0.0.0.0, [/0])
01.13 18:32:58.627 tap: if_config() -> 1
01.13 18:32:58.627 vpn: tap config done, [ok]
01.13 18:32:58.627 vpn: domain [Hamachi] -> 'VPN_up'
01.13 18:32:58.627 vpn: added [Null] domain (not roaming)
01.13 18:32:58.628 dbg: setup_vpn_domain [Null]
01.13 18:32:58.628 dbg: vpn_domain::config - [Null]
01.13 18:32:58.640 sys: connmgr_go_online, reconnect 1
01.13 18:32:59.007 ses: on_conn_state(connected, 0x0)
01.13 18:32:59.009 ses: select conn mode 'dns lb'
01.13 18:32:59.009 ses: go_offline, keep_tunnels 1, login_on_relaunch 0, actual state 4 ..
01.13 18:32:59.011 sys: go_online, reconnect 1
01.13 18:32:59.011 ses: resolving hamachi-dc.logmein-gateway.com ..
01.13 18:32:59.015 ses: resolving hamachi-list.10.logmein-gateway.com ..
01.13 18:32:59.018 ses: selected (95.172.70.130, 5364)
01.13 18:32:59.019 ses: selected 01 connection type
01.13 18:32:59.019 ses: resolving 95.172.70.130 ..
01.13 18:40:20.636 ipc: 0039aed8 add client 1
01.13 18:40:20.637 cfg: save()
01.13 18:40:20.638 cfg: hks: [0] [2048]
01.13 18:40:20.639 cfg: hkc: [0] [2048] [2048]
01.13 18:40:20.641 ipc: 0039aed8 del client
version : 2.1.0.174
pid : 9073
status : logging in
client id :
address :
nickname :
lmi account:
How to get client id and configure login credentials in Hamachi config?

User avatar
MrDini
Posts: 651
Joined: Mon Dec 21, 2015 7:21 pm
Contact:

Re: Hamachi binary not works as expected

Post by MrDini » Fri Jan 13, 2017 5:10 pm

What You pasted in red is normal. The daemon has an optional config, where You Can set some things. But if it isn't exist, it shows this. On my RPi, or on my Ubuntu PC, this message also shown up.

2.
01.13 18:32:58.615 ipc: 5 listening at /var/run/logmein-hamachi/ipc.sock
Sorry I forgot to write that. So, there is an included profile.d script, who executes some aliases for the daemon to make it FFp friendly. But the profile.d scripts only have been executed, if You give it execute permission, and at the first time You have to relog, or use the source command to run the script.

Code: Select all

chmod +x /ffp/etc/profile.d/hamachi.sh
source /ffp/etc/profile.d/hamachi.sh
After that, look on the alias output, if You Can see the hamachid and the hamachi at the list, You are done. :)
barmalej2 wrote:How to get client id and configure login credentials in Hamachi config?
If the daemon started, firstly, You have to execute

Code: Select all

hamachi login
. It will tell the daemon to connect to the hamachi server. Well, the login calling is wrong, I think... Because it realy does a hamachi server and NAS opposite handshake and a connection.

And when it successfully established the connection, You will see an online state, but You haven't got a client id and a Username, because You have to create a new network at the hamachi's website (https://vpn.net), or there is another option to join to an exist network. See the help (hamachi -h).

PS: I already know, You are a magician, but I didn't thought, You are a time traveller too. Or it is just the hamachid daemons output? :D
Thanks nas-central the lot of help! :)

barmalej2
Posts: 2387
Joined: Sun Apr 29, 2012 5:24 pm

Re: Hamachi binary not works as expected

Post by barmalej2 » Fri Jan 13, 2017 7:16 pm

Bypass obvious things MrDini. Actually I am using original source, because you didn't included dns setup scripts in your package and intentionally not changing paths. This is not ffp native binary, so they might be hardcoded. What I need to know is how and what I have to configure.
Btw. You can see that server is already logging:
version : 2.1.0.174
pid : 9073
status : logging in
Do you think that I need additionally run login command?

User avatar
MrDini
Posts: 651
Joined: Mon Dec 21, 2015 7:21 pm
Contact:

Re: Hamachi binary not works as expected

Post by MrDini » Fri Jan 13, 2017 8:21 pm

No, if it is showing logging it, that means it stuck connecting to the server. The same as mine output...

What I have done is to create two aliases to change the config dir and the irpc path.

2. If the status is online, You have to set the nick of the box first. Like:

Code: Select all

hamachi set-nick myPrettyAwesomeBox
After that, register a Logmein account here. And run this command:

Code: Select all

hamachi attach <insert your hamachi login e-mail address here>
Finally create a new network at the Logmein page, that I linked (after a login certainly). Make sure, You didn't set a password for the joining! If I set a password, I Cannot connect to it with the Pi. And after that, replace your network ID at this command:

Code: Select all

hamachi do-join <network id>
But You Cannot do anything (except kill) while it is doing the logging in process... :(

Maybe the lsb is missing from the system?

Edit: hardcoded? How? :D
Thanks nas-central the lot of help! :)

Post Reply