RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-333428

lened's questions

Martin Hope
lened
Asked: 2022-09-30 01:12:26 +0000 UTC

Raspberry Pi 3 上的端口转发

  • 1

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
linux маршрутизация
  • 1 个回答
  • 18 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5