среда, 3 декабря 2025 г.

upnpc клиент проброса портов

 Вероятно когда давно ставили трансмишн, то сталкивались с проблемой что раздача не идет пока не открыть порт на роутере, который будет всетить в мир тачку с торент клиентом... решалось это либо установкой галки на роутере "использовать upnp" или жестким указанием порта в клиенте и ручной проброс натом в роутере. 

Мне всегда было интересно как это делается и хотелось динамику прикрутить скажем к ssh порту ноута - мол сменил роутер - ноут сам прокинул какой нибудь порт 2222 на себя (не важно какой он там адрес в локалке получил ) и нинадо идти в список клиентов, гадать на макадресах кто ноут - какой айпи - прописывать правило ната 

Ставим 

sudo apt install miniupnpc

Собственно сама команда 

upnpc -a 192.168.89.50 2222 2222 TCP 37.235.10.11

ну и хелп в помощь 

upnpc --help

upnpc : miniupnpc library test client, version 2.2.3.

 (c) 2005-2021 Thomas Bernard.

Go to http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/

for more information.

Usage : upnpc [options] -a ip port external_port protocol [duration] [remote host]

Add port redirection

        upnpc [options] -d external_port protocol [remote host]

Delete port redirection

        upnpc [options] -s

Get Connection status

        upnpc [options] -l

List redirections

        upnpc [options] -L

List redirections (using GetListOfPortMappings (for IGD:2 only)

        upnpc [options] -n ip port external_port protocol [duration] [remote host]

Add (any) port redirection allowing IGD to use alternative external_port (for IGD:2 only)

        upnpc [options] -N external_port_start external_port_end protocol [manage]

Delete range of port redirections (for IGD:2 only)

        upnpc [options] -r port1 [external_port1] protocol1 [port2 [external_port2] protocol2] [...]

Add all redirections to the current host

        upnpc [options] -A remote_ip remote_port internal_ip internal_port protocol lease_time

Add Pinhole (for IGD:2 only)

        upnpc [options] -U uniqueID new_lease_time

Update Pinhole (for IGD:2 only)

        upnpc [options] -C uniqueID

Check if Pinhole is Working (for IGD:2 only)

        upnpc [options] -K uniqueID

Get Number of packets going through the rule (for IGD:2 only)

        upnpc [options] -D uniqueID

Delete Pinhole (for IGD:2 only)

        upnpc [options] -S

Get Firewall status (for IGD:2 only)

        upnpc [options] -G remote_ip remote_port internal_ip internal_port protocol

Get Outbound Pinhole Timeout (for IGD:2 only)

        upnpc [options] -P

Get Presentation url


protocol is UDP or TCP

Options:

  -e description : set description for port mapping.

  -6 : use ip v6 instead of ip v4.

  -u url : bypass discovery process by providing the XML root description url.

  -m address/interface : provide ip address (ip v4) or interface name (ip v4 or v6) to use for sending SSDP multicast packets.

  -z localport : SSDP packets local (source) port (1024-65535).

  -p path : use this path for MiniSSDPd socket.

  -t ttl : set multicast TTL. Default value is 2.

  -i : ignore errors and try to use also disconnected IGD or non-IGD device.

Комментариев нет:

Отправить комментарий