当前位置:首页 > linux > 正文

linux查看网络设置命令

  • linux
  • 2024-05-14 14:29:42
  • 1195

常见的网络设置命令


查看 IP 地址:ifconfig


查看路由表:route -n


查看网卡信息:ip link


网卡配置命令


设置 IP 地址:ifconfig <网卡名> <IP 地址> <子网掩码>


设置网关:route add default gw <网关 IP 地址>


启用网卡:ifconfig <网卡名> up


禁用网卡:ifconfig <网卡名> down


高级网络设置命令


查看网络统计信息:netstat -s


抓取网络数据包:tcpdump


设置防火墙规则:iptables


其他实用命令


更新网络配置:service networking restart


重启网络服务:/etc/init.d/networking restart