Linux基础命令---配置网络ifcfg

简介: ifcfg        ifcfg是一个简单的脚本替换iconfig命令,它可以设置网络接口的ip地址。        此命令的适用范围:RedHat、RHEL、Ubuntu、CentOS、SUSE、openSUSE、Fedora。
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)
相关文章
|
5天前
|
SQL 缓存 监控
|
5天前
|
前端开发 Linux Shell
|
17小时前
|
数据可视化 搜索推荐 Linux
|
2天前
|
Linux Shell 网络安全
网络安全中Dos和linux常用命令总结
本篇是对网安学习中,常用的命令做一个图文与命令示例,并对一些比较重要的dos和shell命令进行总结,方便自己后续学习进行查询,并希望能够给更多人有一个总结命令和了解命令的地方.
25 5
|
5天前
|
Ubuntu 网络协议 Linux
|
5天前
|
Linux
Linux系统ps命令
这些是一些常见的 `ps`命令选项和用法,用于查看系统中运行的进程及其相关信息。您可以根据需要选择合适的选项以满足您的任务要求。
15 0
|
5天前
|
存储 Linux Shell
linux课程第二课------命令的简单的介绍2
linux课程第二课------命令的简单的介绍2
|
5天前
|
Linux C语言 数据安全/隐私保护
linux课程第二课------命令的简单的介绍3
linux课程第二课------命令的简单的介绍3
|
5天前
|
监控 Unix Linux
如何使用 Linux less 命令?
【4月更文挑战第25天】
18 1
如何使用 Linux less 命令?
|
5天前
|
JSON 网络协议 Linux
Linux ip命令:网络的瑞士军刀
【4月更文挑战第25天】
10 1