ubuntu 下使用 upnp 配置路由器埠對映

2021-08-13 22:43:55 字數 2331 閱讀 1484

make

sudo checkinstall

這樣安裝,以後還可以解除安裝掉。

usage : upnpc [options] -a ip port external_port protocol [duration]

add port redirection

upnpc [options] -d external_port protocol delete port redirection

upnpc [options] -s

get connection status

upnpc [options] -l

list redirections

upnpc [options] -l

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

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:

-6 : use ip v6 instead of ip v4.

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

-m address/inte***ce : provide ip address (ip v4) or inte***ce 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.

例如,要將外網的埠3222對映到內外的192.168.31.134的22埠,可以使用下面的命令:

upnpc -a -e 'ssh' 192.168.31.134 22 3222 tcp
要刪除外網埠 3222 的對映,可以用下面的命令列:

upnpc -d 3222 tcp
從「ubuntu軟體」中搜尋 upnp 即可找到,安裝後按照gui上的提示新增埠對映即可。

Ubuntu 下配置使用Android adb

1 配置環境變數 進入終端,輸入 sudo gedit bashrc 在檔案的最後追加 1 set path for android sdk tools 2exportpath path your android sdk linux path tools 3exportpath path your ...

Ubuntu 下配置使用Android adb

1 配置環境變數 進入終端,輸入 sudo gedit bashrc 在檔案的最後追加 set path for android sdk tools export path pat h y oura ndro id s dk l inux path too ls e xpor tpat h path...

ubuntu下配置和使用ssh

安裝 sudo apt get install openssh server 啟動 停止 重啟ssh server sudo etc init.d ssh start sudo etc init.d ssh stop sudo etc init.d ssh restart 配置ssh server ...