需求:
       从一台公网主机(121.41.43.222)访问内网(有Nat)的一个IP网络摄像头的数据流。摄像头数据流的访问地址为rtsp://192.168.1.14:9000。
实现思路:
     在摄像头里面植入程序,向公网主机上报心跳,在Nat上打洞,然后从这个洞访问摄像头数据。
遇到的问题:
     摄像头上报心跳,在Nat上打洞,服务端如何利用这个洞获取涉嫌头的数据?

解决方案 »

  1.   

    why take the other way around? set up a reverse proxy on the server having the public ip...
      

  2.   

    iptables端口转发,百度
      

  3.   

    第一感觉是在路由器上做映射不过,现在很多可以穿透内网的软件,TeamView等。
      

  4.   

    搞台阿里云,去得公网ip
    配置sshd_config,打开端口映射,网关转发。
    nat内部放一台便宜的openwrt或树莓派机器,做好自动登录(ssh-keygen ssh-copy-id),到阿里云的ssh脚本,含端口映射(ssh -R9000:192.168.1.14:9000   root@aliyun_ip_address )。
    /etc/rc.local中用screen自动启动脚本。
    最后内网的那个端口就跑到阿里云上了。
      

  5.   

    外网访问内网的服务,需要一个固定的公网IP,如果没有公网IP,可以使用开源的holer,配置一个key就可以实现从外网访问了
    参考步骤:
    1. Download software package holer-client.zip;
    下载软件包holer-client.zip;
    https://github.com/Wisdom-Projects/holer2. Install Java 1.7 or higher version;
    使用前请先安装Java 1.7或者更高版本;3. Unzip holer-client.zip, modify configuration file
    解压holer-client.zip,修改配置文件
    holer-client/conf/holer.confOnly need to set HOLER_ACCESS_KEY:
    只需设置HOLER_ACCESS_KEY:HOLER_ACCESS_KEY=HOLER_CLIENT-2F8D8B78B3C2A0AE4. Start holer
    启动Holer服务
    cd holer-client/binWindows:
    Run command startup.bat or double click startup.batLinux:
    Run command sh startup.sh5. Internet and local address mapping
    公网和内网的地址映射关系Holer Access Key Internet Address Local Address
    HOLER_CLIENT-2F8D8B78B3C2A0AE holer.org:65530 127.0.0.1:8080
    HOLER_CLIENT-3C07CDFD1BF99BF2 holer.org:65531 127.0.0.1:8088
    HOLER_CLIENT-2A623FCB6E2A7D1D holer.org:65532 127.0.0.1:80
    HOLER_CLIENT-AF3E6391525F70E4 holer.org:65533 127.0.0.1:3389
    HOLER_CLIENT-822404317F9D8ADD holer.org:65534 127.0.0.1:226. Demo
    使用示例If your tomcat program local URL: 
    如果您本地的tomcat服务地址:
    http://127.0.0.1:8088Exposes to the public internet URL: 
    代理到公网上的服务地址为:
    http://holer.org:65531Only need to modify configuration file to set HOLER_ACCESS_KEY: 
    只需要在配置文件里修改HOLER_ACCESS_KEY即可:
    holer-client/conf/holer.conf
    HOLER_ACCESS_KEY=HOLER_CLIENT-3C07CDFD1BF99BF2Restart holer, then you can visit your web application through URL http://holer.org:65531
    重启Holer,然后就可以通过URL http://holer.org:65531来访问您的Web应用。