在 Ubuntu 上打开一个端口

编程入门 行业动态 更新时间:2024-10-24 12:27:38
本文介绍了在 Ubuntu 上打开一个端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试在我的 Ubuntu 机器上打开端口,以允许我使用外部程序连接 Mongo.我运行了这个命令行来打开一个新端口:

I am trying to open up port on my Ubuntu machine to allow me to connect the Mongo using an external program. I ran this which is the command line to open a new port:

sudo iptables -A INPUT -p tcp --dport 27017 -j ACCEPT

但是当我运行它来检查新规则是否存在时...

but when I ran this to check if the new rule was there...

sudo netstat -ntlp | grep LISTEN

...新端口不在列表中 - 有什么想法吗?

...the new port wasn't in the list - any ideas?

推荐答案

我认为 mangodb 实例没有启动,除此之外,sudo netstat -ntlp |grep LISTEN 给出正在使用的活动端口列表,首先启动你的 Mango 实例 sudo service mongodb start ,然后运行这个命令 sudo netstat -ntlp |grep LISTEN 如果您在列表中找到 27017,则 sudo iptables -L 查一下您的 iptable 规则是否添加.如果它在该列表中还不错,sudo iptables -A INPUT -p tcp --dport 27017 -j ACCEPT你可以在@docs.mongodb/manual/tutorial/configure-linux-iptables-firewall/

I think the mangodb instance was not started, apart from that ,sudo netstat -ntlp | grep LISTEN gives the list ports that are active are being used now, first start your Mango instance sudo service mongodb start , then run this command sudo netstat -ntlp | grep LISTEN if you find 27017 in the list, then sudo iptables -L chack your iptable rule is added or not. If it is in that list good else, sudo iptables -A INPUT -p tcp --dport 27017 -j ACCEPT you can get more details on mangodb port and traffic @ docs.mongodb/manual/tutorial/configure-linux-iptables-firewall/

更多推荐

在 Ubuntu 上打开一个端口

本文发布于:2023-08-07 18:17:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1320838.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:端口   Ubuntu

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!