一、介绍
UPnP全名是Universal Plug and Play,UPnP 最大的愿景就是希望任何设备只要一接上网络,所有在网络上的设备马上就能知道有新设备加入,这些设备彼此之间能互相沟通,更能直接使用或控制它,一切都不需要设定,完全的Plug and Play
作用
1、UPNP开启后能方便智能监控设备直接透传到因特网,无需做烦琐的映射端口设置。
2、UPNP开启后能方便智能网络存储设备与因特网进行数据传输,节省手动设置时间。
3、UPNP开启后能方便在因特网使用ERP、CRM、第三方远程桌面等软件。
4、UPNP开启后能提高AnyChat系统的P2P成功率,节省服务器的带宽。
二、openwrt upnp开启
1、sdk包含源码的方式安装
进入openwrt目录,make menuconfig
在luci/application/unpnd
然后重新编译生成镜像就可以了
export FORCE_UNSAFE_CONFIGURE=1
./mk_ap.sh -t evb6890v1_64_cpe_nand -f fibocom -m eau_00 -j 6
2、ipk文件安装
设备连上网络
更新软件包,安装upnp
opkg update
opkg install miniupnpd
三、配置使用
1、配置
配置 UPnP 参数
UPnP 的配置参数在 /etc/config/upnp 中。
config upnp 的配置参数表
config perm_rule 许可设置配置参数表:
cat /var/etc/miniupnpd.conf
#https://www.haiyun.me
ext_ifname=pppoe-wan
listening_ip=192.168.1.1
port=5000
enable_natpmp=yes
enable_upnp=yes
secure_mode=yes
system_uptime=yes
bitrate_down=28672000
bitrate_up=2867200
uuid=a107991c-8b19-4ce4-a525-36bd2c814165
allow 1024-65535 0.0.0.0/0 1024-65535
deny 0-65535 0.0.0.0/0 0-65535
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
2、开启
/etc/init.d/miniupnpd enable
/etc/init.d/miniupnpd start
3、防火墙添加upnp链
#允许特定转发
iptables -N MINIUPNPD
iptables -I FORWARD -i pppoe-wan -o br-lan -j MINIUPNPD
#DNAT端口映射
iptables -t nat -N MINIUPNPD
iptables -t nat -I PREROUTING -i pppoe-wan -j MINIUPNPD
四、测试upnp
1、设备开启upnp,连上网络
2、电脑打开迅雷,开启upnp,
3、查看日志UPNP服务已为迅雷添加端口映射
4、查看防火墙的规则是否有添加upnp