mnh
is a tool that makes exposing a port behind NAT possible.
mnh
will produce an ip:port
pair for your NATed server which can be used for public access.
--------------------------------
| Help Server (NOT behind NAT) | <------(query for ip:port pair)-------------
-------------------------------- |
^ |
| |
| ---------(Use some way to send ip:port pair)------------- |
| | | or |
| | ↓ |
------------------------ ~~~~~~~~~~~~ ----------
| Service (behind NAT) | <-------- { Internet } <---------- | Guests |
------------------------ ~~~~~~~~~~~~ ----------
-
Your server's network type should be Full-cone NAT.
If you don't known what it means, no worries, just continue.
-
If your server is behind a firewall or a household router, you probably need to enable UPnP or do a port forwarding to your server on your router since they may block all incoming traffics.
Please check mnh_server.
Only
mnhv1
protocol is currently supported, more protocols will be added in the future, such as STUN.
Usage:
mnh --server <server> [flags]
Flags:
-s, --server string Help server address (Example "server.com:12345")
-i, --id string A unique id to identify your machine
-m, --mode string Run mode. Available value: demoWeb proxy (default "demoWeb")
-p, --port int The local hole port which incoming traffics access to
-t, --service string Target service address. Only need in proxy mode (default "127.0.0.1:80")
-u, --disable-upnp Disable UPnP
-h, --help help for mnh
Example:
./mnh --server server.com:12345 --id test
Expose a local web server:
./mnh --server server.com:12345 --id web --mode proxy --service 127.0.0.1:80
mnh
will attempt to request UPnP port forwarding by default.
You can disable it by adding --disable-upnp
, make sure you have set up port forwarding correctly.
(See Pre-requests)
./mnh --server server.com:12345 --id web --mode proxy --service 127.0.0.1:80 --port 8888 --disable-upnp