ntop / n2n

Peer-to-peer VPN
GNU General Public License v3.0
6.19k stars 934 forks source link

Is upnp support done? #919

Closed galaxyskyknight closed 2 years ago

galaxyskyknight commented 2 years ago

Hello, I see bunch of codes checked in related to upnp support, is this feature done? how do I check it is properly working or is any configuration needed for compile or running? thanks.

Logan007 commented 2 years ago

Hello, I see bunch of codes checked in related to upnp support, is this feature done?

It is implemented to some usable extent into dev. This feature might still be subject to changes though.

any configuration needed for compile ...

If you use CMake to build, the git submodule init and git submodule update commands are necessary once after the git clone ... (execute inside the freshly cloned repository directory) and before running CMake.

If you use make, configure automatically detects libupnp and libnatpmp if installed on your system. Other than that, no special commands required.

... or running?

If present, this feature is enabled by default. It can be manually disabled by providing the --no-port-forwarding CLI option to the edge.

how do I check it is properly working

You will see log messages related to upnp and/or natpmp.

galaxyskyknight commented 2 years ago

Hello, I see bunch of codes checked in related to upnp support, is this feature done?

It is implemented to some usable extent into dev. This feature might still be subject to changes though.

any configuration needed for compile ...

If you use CMake to build, the git submodule init and git submodule update commands are necessary once after the git clone ... (execute inside the freshly cloned repository directory) and before running CMake.

If you use make, configure automatically detects libupnp and libnatpmp if installed on your system. Other than that, no special commands required.

... or running?

If present, this feature is enabled by default. It can be manually disabled by providing the --no-port-forwarding CLI option to the edge.

how do I check it is properly working

You will see log messages related to upnp and/or natpmp.

Thanks, What the log will be seen? is the log level set to -v OK?

Logan007 commented 2 years ago

Thanks, What the log will be seen? is the log level set to -v OK?

Normal log, no -v required. It will state things like

[n2n_port_mapping.c:372] WARNING: NAT-PMP invalid response type 0
[n2n_port_mapping.c:403] WARNING: NAT-PMP local TCP port 51908 mapping failed
[n2n_port_mapping.c:372] WARNING: NAT-PMP invalid response type 0
[n2n_port_mapping.c:411] WARNING: NAT-PMP local UDP port 51908 mapping failed
[n2n_port_mapping.c:101] WARNING: no IGD UPnP device found on the network

In this case, the router has it all disabled, so errors here.

Also in the end, there will be messages when closing. By the way, closing down will take some two to three seconds longer.

galaxyskyknight commented 2 years ago

Thanks, What the log will be seen? is the log level set to -v OK?

Normal log, no -v required. It will state things like

[n2n_port_mapping.c:372] WARNING: NAT-PMP invalid response type 0
[n2n_port_mapping.c:403] WARNING: NAT-PMP local TCP port 51908 mapping failed
[n2n_port_mapping.c:372] WARNING: NAT-PMP invalid response type 0
[n2n_port_mapping.c:411] WARNING: NAT-PMP local UDP port 51908 mapping failed
[n2n_port_mapping.c:101] WARNING: no IGD UPnP device found on the network

In this case, the router has it all disabled, so errors here.

Also in the end, there will be messages when closing. By the way, closing down will take some two to three seconds longer.

OK, thank you. btw: is there any possible that we can develop a new option to speicify a log file and its location? looks like its default way is to stdout to screen and very inconvinence to see the program output log when it spawn as a daemon program.

fengdaolong commented 2 years ago

develop a new option to speicify a log file and its location?

There are two ways: The first method can be registered as a systemd unit and let journal manage the log, unit configuration file see ./packages/etc/systemd/system/ In the second way, try to use the tee command to save the log.

Logan007 commented 2 years ago

Considered answered. Please re-open if required.