公网地址那么少,都是内网的机器,可是有的时候还是需要端口映射的,但是一个一个打开网页去弄还真是有点麻烦,于是想到了upnp。
apt-get install -y miniupnc
upnpc -a 192.168.31.176 9000 9000 TCP
ops@ops-MS-7732:~$ upnpc -a 192.168.31.176 9000 9000 TCP
upnpc : miniupnpc library test client. (c) 2005-2014 Thomas Bernard
Go to http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
for more information.
List of UPNP devices found on the network :
desc: http://192.168.31.1:5351/rootDesc.xml
st: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Found valid IGD : http://192.168.31.1:5351/ctl/IPConn
Local LAN ip address : 192.168.31.176
ExternalIPAddress = xxxxx
InternalIP:Port = 192.168.31.176:9000
external xxxxx:9000 TCP is redirected to internal 192.168.31.176:9000 (duration=0)
之前没有打开,就会报错
我用的是小米的无线无线路由器。