Linux常用指令03网络相关

20次阅读

共计 479 个字符,预计需要花费 2 分钟才能阅读完成。

网络相关指令

1. ifconfig

老版本的 linux 发行版支持此命令,centos7 之后的版本需要下载 net-tools 来支持此命令

  1. yum search ifconfig 查询
  2. yum install net-tools.x86_64 根据提示信息安装软件
  3. ifconfig 使用指令

2. ping

测试网络连通性

3. ip

ip 是新的 linux 发行版支持的 command;

  • man ip 查看 ip 的详细使用手册;
  • ip addr 获取 ip 地址

4. firewall-cmd

配置防火墙

  • firewall-cmd --query-port=6379/tcp 查询 6379 是否对外开放
  • firewall-cmd --add-port=6379/tcp --permanent 永久对外开放 6379 端口
  • firewall-cmd --reload 重新加载,使其生效
  • firewall-cmd --remove-port=6379/tcp 去除端口

关闭防火墙

  • systemctl stop firewalld.service 停止 firewall
  • systemctl disable firewalld.service 禁止 firewall 开机启动
正文完
 0