linux下增、删、查本地端口映射
source link: https://www.zoucz.com/blog/2020/07/22/b19e87a0-cc2e-11ea-90b5-eb40e9720ed0/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
linux下增、删、查本地端口映射
鹅厂呆久了难免给各种网络策略坑。之前遇到用了很久的端口突然被封掉,只开放部分安全端口的问题,后来只好自己一个个做端口映射,来规避这个问题。 我要说话
增加端口映射
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080
我要说话
service iptables save
我要说话
service iptables restart
我要说话
将本机的80端口映射到8080端口。 我要说话
这个例子有个神坑是如果有其它机器的网络代理到本机80端口,那么这个代理也会被映射掉。我刚好因为可用安全端口不多而踩过这个神坑,记忆犹新难以忘怀,特此记录。 我要说话
同理,此坑适用于443端口。80和443是比较常见的,映射其它常用软件/协议端口时,也要一定要考虑清楚后果,例如把ssh使用的端口给代理走了。。。 我还没试过,应该有解吧。我要说话
参考文章 我要说话
查找端口映射
iptables -t nat -L -n | grep 8080
我要说话
删除端口映射
iptables -t nat -D PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
我要说话
service iptables save
我要说话
service iptables restart
我要说话
参考文章 我要说话
本文链接:https://www.zoucz.com/blog/2020/07/22/b19e87a0-cc2e-11ea-90b5-eb40e9720ed0/我要说话
☞ 参与评论我要说话
Recommend
-
14
V2EX › NAS 请教一个 ROS 系统端口映射的问题 apiman · 1 小时 37 分钟前 · 116 次点击
-
5
Docker 端口映射理解错误导致的 mysqli::real_connect(): (HY000/2002) 问题 2021-06-29 这些天在做服务器的容器化,说起来没什么特殊的,就是日常折腾,docker 也玩了很久了,本来想着一切迁移正常,但凡事都有例外。为了方便说明,这...
-
7
iptables nat 端口映射转发 作者: dreamfly 分类: 未分类 发布时间: 2018-07-21 23:35 iptables -t nat -A POSTROUTING -o ppp0 -j MASQ...
-
2
MD880R端口映射设置 MD880R是一款带路由功能的ADSL Modem,当MD880R工作在路由模式时,可在MD880R上设置端口映射,实现从外网访问内网的服务器,如WEB服务器、FTP服务器等。本文将以MD880R使用PPPoE拨号上网方式,内网...
-
4
TD-8820是一款带路由功能的ADSL Modem,当TD-8820工作在路由模式时,可在8820上设置端口映射,实现从外网访问内网的服务器,如WEB服务器、FTP服务器等。本文将以TD-8820使用PPPoE拨号上网方式,内网搭建WEB服务器为例,详细说明TD-8820端口映射的设置方法。
-
4
尊敬的用户! 我司不同路由器的界面风格可能不同,对应的设置方法有所差异,为了针对性的指导您设置,请登录路由器管理界面,确认并选择正确风格的界面进行参考: ...
-
5
路由器上设置端口映射和远程WEB管理后,需要在Internet上访问路由器或服务器,那么就访问的目的IP地址和端口需要有以下注意事项。 一、...
-
2
判断方法:设置好端口映射规则后,在内网电脑上使用“路由器的WAN口地址+外部端口(服务端口)”尝试访问服务器,...
-
7
网络交换机端口映射工具帮助网络工程师识别设备连接的交换机端口,从而消除了手动跟踪网络的需要。交换机端口映射工具可以发现插入到指定交换机每个端口的设备。
-
4
V2EX › 宽带症候群 拒绝迷茫---推荐一款远程端口映射工具,支持 tcp 点对点穿透
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK