lnd: NAT=true not working

Background

I just configured nat=true in my lnd.conf and started lnd. I receive the following error message and lnd stops:

2018-10-04 20:58:52.188 [INF] SRVR: Scanning local network for a UPnP enabled device
2018-10-04 20:59:02.194 [ERR] SRVR: Unable to discover a UPnP enabled device on the local network: context canceled
2018-10-04 20:59:02.194 [INF] SRVR: Scanning local network for a NAT-PMP enabled device
2018-10-04 20:59:02.221 [ERR] SRVR: Unable to discover a NAT-PMP enabled device on the local network: fork/exec /usr/bin/ip: no such file or directory
2018-10-04 20:59:02.221 [ERR] SRVR: unable to create server: Unable to discover a NAT-PMP enabled device on the local network: fork/exec /usr/bin/ip: no such file or directory

On my Raspbian 9 the ip binary is located at /sbin/ip.

I created a symlink from /usr/bin/ip to /sbin/ip which only me brings me one step further until it crashes:

2018-10-04 21:08:11.119 [ERR] SRVR: Unable to discover a UPnP enabled device on the local network: context canceled
2018-10-04 21:08:11.119 [INF] SRVR: Scanning local network for a NAT-PMP enabled device
2018-10-04 21:08:11.147 [ERR] SRVR: Unable to discover a NAT-PMP enabled device on the local network: unexpected result size 2, expected 12
2018-10-04 21:08:11.147 [ERR] SRVR: unable to create server: Unable to discover a NAT-PMP enabled device on the local network: unexpected result size 2, expected 12

What can I do to help debug and fix this issue?

Your environment

  • version of lnd
    • Version 0.5.0-beta commit=3b2c807288b1b7f40d609533c1e96a510ac5fa6d
  • which operating system (uname -a on *Nix)
    • Linux foobar 4.14.69-v7+ #1141 SMP Mon Sep 10 15:26:29 BST 2018 armv7l GNU/Linux

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 40 (23 by maintainers)

Most upvoted comments

My Fix

My router supports Upnp I checked that it was working fine using a really nice Windows app Upnp Tester. My raspberry LN was not able to get the upnp working. I made it work by disabling ufw (even though I had 1900 UDP port enabled)

I decided to enable ufw anyways and see why it wasn’t working I checked /var/log/syslog and found several UDP packets from my router to my raspberry with random source and dst ports blocked, those were the ones preventing it to work.

In this link I found the problem: upnp uses random ports (sometimes?): https://github.com/nextcloud/nextcloudpi/issues/400

TL;DR: open all udp ports from my router sudo ufw allow proto udp from 192.168.1.1

@verquepasa Are you sure that the incoming packets have random source ports? I configured my RPi with this line and UPNP is working:

sudo ufw allow proto udp from 192.168.178.1 port 1900 to any comment 'allow local LAN SSDP for UPnP discovery'