Raspberry Pi3 具有以下网络接口:
~ $ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.4.5 netmask 255.255.255.0 broadcast 192.168.4.255
inet6 fe80::ba27:ebff:fe6c:46b6 prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:6c:46:b6 txqueuelen 1000 (Ethernet)
RX packets 4877 bytes 425607 (415.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 6278 bytes 1276564 (1.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 4980 bytes 462816 (451.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4980 bytes 462816 (451.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
inet 10.46.154.155 netmask 255.255.255.255 destination 10.64.64.64
ppp txqueuelen 3 (Point-to-Point Protocol)
RX packets 973 bytes 161883 (158.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1125 bytes 466589 (455.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
inet 10.10.14.6 netmask 255.255.255.255 destination 10.10.14.5
inet6 fe80::1a48:3d1b:26e9:af82 prefixlen 64 scopeid 0x20<link>
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 500 (UNSPEC)
RX packets 269 bytes 14687 (14.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 270 bytes 333665 (325.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether b8:27:eb:39:13:e3 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
树莓通过 3G 调制解调器接收互联网,这是一个 ppp0 连接。然后打开 OpenVPN 连接 (tun0)。Raspberry 始终接收相同的 IP 地址。在eth0接口上,只手动配置了IP地址192.168.4.5。(无网关)一台静态IP为192.168.4.200的DVR连接到eth0,监听85端口。任务:配置tun0接口的端口转发(例如8585)到eth0接口的85端口,这样我就可以拨打http了: //10.10.14.6:8585在远程设备上得到了 192.168.4.200:85 iptables 尝试了以下设置:
sudo iptables -A FORWARD -i tun0 -o eth0 -j ACCEPT
sudo iptables -t nat -A PREROUTING -p tcp -d 10.10.14.6 --dport 8585 -j DNAT --to-destination 192.168.4.200:85
sudo iptables -t nat -A POSTROUTING -p tcp --sport 85 --dst 192.168.4.200 -j SNAT --to-source 10.10.14.6:8585
iptables -t nat -A PREROUTING -i tun0 -p tcp --dport 8585 -j DNAT --to 192.168.4.200:85
iptables -t nat -A PREROUTING -p tcp --dport 8585 -i tun0 -j DNAT --to 192.168.4.200:85
都是徒劳的,请帮助。
所有设置后的 iptables -L 输出:(据我所知没有规则......)
~ $ sudo iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
~ $ uname -a
Linux raspberrypi 5.15.68-v8+ #1587 SMP PREEMPT Tue Sep 20 11:18:43 BST 2022 aarch64 GNU/Linux
就在这里
你不需要更进一步,合约会生效,远期已经开放,但不包括在内。添加到 /etc/sysctl.conf 文件
或脚本
但是您需要伪装,因为尚不清楚视频将如何被播放。