• Linux基础命令---ifcfg


    ifcfg

          ifcfg是一个简单的脚本替换iconfig命令,它可以设置网络接口的ip地址。

          此命令的适用范围:RedHat、RHEL、Ubuntu、CentOS、SUSE、openSUSE、Fedora。

     

    1、语法

          ifcfg [device] [cmd]  [address]

          device就是网卡设备,它可能有别名。cmd可以是add、delete、stop。address就是ip地址。

     

    2、选项列表

     

    3、实例

    1)添加ip地址 

    [root@localhost ~]# ifcfg eth0 add 192.168.0.250/24                     //添加地址250

    Forwarding is ON or its state is unknown (4). OK, No RDISC.

    [root@localhost ~]#ifconfig                                               //查看网络信息

    eth0      Link encap:Ethernet  HWaddr 08:00:27:14:33:57  

              inet addr:192.168.0.250  Bcast:192.168.0.255 Mask:255.255.255.0

              inet6 addr: fe80::a00:27ff:fe14:3357/64 Scope:Link

              UP BROADCAST RUNNING MULTICAST  MTU:1500 Metric:1

              RX packets:107276 errors:0 dropped:0 overruns:0 frame:0

              TX packets:72250 errors:0 dropped:0 overruns:0 carrier:0

              collisions:0 txqueuelen:1000 

              RX bytes:83580745 (79.7 MiB)  TX bytes:5842176 (5.5 MiB)

    2)删除ip地址 

    [root@localhost ~]# ifcfg eth0 delete 192.168.0.250/24                   //删除网卡地址

    Forwarding is ON or its state is unknown (4). OK, No RDISC.

    [root@localhost ~]# ifconfig                                                 //查看网卡信息,ip地址已经删除

    eth0      Link encap:Ethernet  HWaddr 08:00:27:14:33:57  

              inet6 addr: fe80::a00:27ff:fe14:3357/64 Scope:Link

              UP BROADCAST RUNNING MULTICAST  MTU:1500 Metric:1

              RX packets:107276 errors:0 dropped:0 overruns:0 frame:0

              TX packets:72251 errors:0 dropped:0 overruns:0 carrier:0

              collisions:0 txqueuelen:1000 

              RX bytes:83580745 (79.7 MiB)  TX bytes:5842218 (5.5 MiB)

  • 相关阅读:
    距离的总和
    [leetcode] 397. Integer Replacement
    [leetcode] 396. Rotate Function
    [leetcode] 398. Random Pick Index
    [leetcode] 399. Evaluate Division
    [算法] get_lucky_price price
    Geoserver(一) Geoserver2.15.4配置发布arcgis切片
    Geoserver(二) geoserver配置mysql插件
    OpenLayers4地图实例-功能齐全
    OpenLayers Node环境安装运行构建-支持Vue集成OpenLayers
  • 原文地址:https://www.cnblogs.com/wj78080458/p/10357976.html
Copyright © 2020-2023  润新知