networking - Firewalld 端口转发报告连接被拒绝
问题描述
我要转发到9876
的,配置如下:192.168.9.111
192.168.9.112:3333
# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: eth0
sources:
services: dhcpv6-client ssh
ports: 9876/tcp
protocols:
masquerade: yes
forward-ports: port=9876:proto=tcp:toport=3333:toaddr=192.168.9.112
source-ports:
icmp-blocks:
rich rules:
# sysctl -a |grep forward |grep 4
net.ipv4.conf.all.forwarding = 1
net.ipv4.conf.all.mc_forwarding = 0
net.ipv4.conf.default.forwarding = 1
net.ipv4.conf.default.mc_forwarding = 0
net.ipv4.conf.docker0.forwarding = 1
net.ipv4.conf.docker0.mc_forwarding = 0
net.ipv4.conf.eth0.forwarding = 1
net.ipv4.conf.eth0.mc_forwarding = 0
net.ipv4.conf.lo.forwarding = 1
net.ipv4.conf.lo.mc_forwarding = 0
net.ipv4.ip_forward = 1
net.ipv4.ip_forward_use_pmtu = 0
# the destination is listening:
# telnet 192.168.9.112 3333
Trying 192.168.9.112...
Connected to 192.168.9.112.
Escape character is '^]'.
# but the forward does not work
# telnet 192.168.9.111 9876
Trying 192.168.9.111...
telnet: connect to address 192.168.9.111: Connection refused
任何想法?
解决方案
原来你还需要编辑/etc/sysctl.conf
包括:
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.ip_forward=1
推荐阅读
- vue-router - 如何自动将路径映射到组件
- node.js - 从 azure 存储表中检索超过 1000 条记录 - js
- python - PRAW:你能在同一条消息中从两个单独的关键字列表中接收数据吗?
- c# - 带有 C# 驱动程序的 MongoDB 游标快照
- javascript - 如何使用文本框作为数据集在传单中设置多个标记?
- javascript - 如何在 Laravel 5.7 中将多个数据库数据传递到 jQuery 的自动完成(AJAX)中
- python - 当输入未分隔python时创建字符串列表
- graph-theory - 广度优先搜索计数器示例
- mocha.js - 如何使用 mocha/chai 测试引用 html 文件
- node.js - 在本机反应中处理的加密