如何在 Linux 上查看和编辑临时端口范围? [英] How to view and edit the ephemeral port range on Linux?

查看:27
本文介绍了如何在 Linux 上查看和编辑临时端口范围?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 Linux 系统中,临时端口范围显示不同的范围,如下所示

In my Linux system ephemeral port range is showing different ranges as follows

$ cat /proc/sys/net/ipv4/ip_local_port_range 
32768  61000 

cat /etc/sysctl.conf | grep net.ipv4.ip_local_port_range
net.ipv4.ip_local_port_range = 9000 65500

我的系统中哪个是有效的临时端口范围?

Which will be the effective ephemeral port range in my system?

推荐答案

下面的命令会列出Linux系统中的临时端口范围

Following command will list the ephemeral port range in Linux system

sysctl net.ipv4.ip_local_port_range 

如果不想重启,编辑/etc/sysctl.conf文件后执行以下命令即可生效.

If we don't want to reboot, after editing /etc/sysctl.conf file if we execute following command it will be effective.

sysctl -p /etc/sysctl.conf .

有效范围的事情的真相是输出

The truth of the matter of effective range is output of

sysctl net.ipv4.ip_local_port_range 

正如 eckes 在评论中提到的那样.

as mentioned by eckes in comment.

这篇关于如何在 Linux 上查看和编辑临时端口范围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆