ifconfig 网络设备配置查看命令

ifconfig是linux中用于显示或配置网络设备(网络接口卡)的命令,英文全称是network interfaces configuring

命令安装

1
yum install -y net-tools
  • 配置网卡的IP地址

    1
    ifconfig eth0 192.168.0.1 netmask 255.255.255.0
  • 若想再在eth0上在配置一个192.168.1.1/24 的IP地址用下面的命令,配置网卡子接口。

    1
    2
    3
    ifconfig eth0:0 192.168.1.1 netmask 255.255.255.0
    # 另一种掩码的写法
    ifconfig eth0:0 10.0.2.16/24

    这时再用ifconifg命令查看,就可以看到两个网卡的信息了,分别为:eth0eth0:0。若还想再增加IP,那网卡的命名就接着是:eth0:1eth0:2……想要几个就填几个。

  • 配置网卡的硬件地址

    1
    ifconfig eth0 hw ether 00:0c:29:97:ef:11
  • 将网卡禁用

    1
    ifconfig eth0 down
  • 将网卡启用

    1
    ifconfig eth0 up
打赏
  • 版权声明: 本博客所有文章除特别声明外,著作权归作者所有。转载请注明出处!
  • Copyrights © 2018-2024 Outsrkem
  • 访问人数: | 浏览次数:

      请我喝杯咖啡吧~

      支付宝
      微信