|
本帖最后由 duolly 于 2020-5-14 10:52 编辑
昨天看到某个大佬 @zhbone 发了一个流量转发的工具,想起来前一段自己用socat折腾能在外网看家里内网IPTV的事情,最终没有折腾成功,趁着这波把问题发来,请各位MJJ帮忙分析下。
首先是家里的网络图
主路由双wan,一路internet(有公网ip,ddns域名),一路IPTV(DHCP,内网ip),
用ip分流的方式,所有 10.1.1.0/8的都走wan2,这样就实现了lan下所有的设备都能看IPTV直播。
比如CCTV1: rtsp://10.254.209.130/PLTV/88888888/224/3221225621/10000100000000060000000000009742_0.smil
在电视上装一个友窝直播就可以直接看了,不必非用联通的tvbox。
基本情况都说完了,下面说想通过socat流量转发实现的,
在主路由上运行socat
- socat -d -d -lf /root/socat_TCP.log TCP4-LISTEN:554,reuseaddr,fork TCP4:10.254.209.130:554&
复制代码
相当于监听554端口,并转发到IPTV的10.254.209.130:554,在外网用
rtsp://home.xxxxxx.cn/PLTV/88888888/224/3221225621/10000100000000060000000000009742_0.smil
看IPTV,但是。。连不上。
要是 V @P# N进home的wan,
用 rtsp://home.xxxxxx.cn/PLTV/88888888/224/3221225621/10000100000000060000000000009742_0.smil
却能看。。。
不知道有大佬知道是什么问题不?
更新socat log
这是外联通过ddns直接连上的log,看不成iptv
- 2020/05/14 10:35:13 socat[21112] N listening on AF=2 0.0.0.0:554
- 2020/05/14 10:37:26 socat[21112] N accepting connection from AF=2 171.8.201.51:55494 on AF=2 192.168.10.2:554
- 2020/05/14 10:37:26 socat[21112] N forked off child process 21615
- 2020/05/14 10:37:26 socat[21112] N listening on AF=2 0.0.0.0:554
- 2020/05/14 10:37:26 socat[21615] N opening connection to AF=2 10.254.209.130:554
- 2020/05/14 10:37:26 socat[21615] N successfully connected from local address AF=2 192.168.10.2:46082
- 2020/05/14 10:37:26 socat[21615] N starting data transfer loop with FDs [7,7] and [6,6]
- 2020/05/14 10:37:26 socat[21615] N socket 2 (fd 6) is at EOF
- 2020/05/14 10:37:27 socat[21615] N exiting with status 0
- 2020/05/14 10:37:27 socat[21112] N childdied(): handling signal 17
复制代码
这是v#p@n 连上主路由,一样通过 ddns的连上的log ,这就看的成IPTV
- 2020/05/14 10:38:52 socat[21112] N accepting connection from AF=2 171.8.201.51:56423 on AF=2 192.168.10.2:554
- 2020/05/14 10:38:52 socat[21112] N forked off child process 21959
- 2020/05/14 10:38:52 socat[21112] N listening on AF=2 0.0.0.0:554
- 2020/05/14 10:38:52 socat[21959] N opening connection to AF=2 10.254.209.130:554
- 2020/05/14 10:38:52 socat[21959] N successfully connected from local address AF=2 192.168.10.2:46386
- 2020/05/14 10:38:52 socat[21959] N starting data transfer loop with FDs [7,7] and [6,6]
- 2020/05/14 10:38:52 socat[21959] N socket 1 (fd 7) is at EOF
- 2020/05/14 10:38:52 socat[21959] N socket 2 (fd 6) is at EOF
- 2020/05/14 10:38:52 socat[21959] N exiting with status 0
- 2020/05/14 10:38:52 socat[21112] N childdied(): handling signal 17
复制代码
好像没啥区别。
另外udp也在监听。。没有log |
|