本教程操作环境:linux7.3系统、dell g3电脑。
linux中ifcfg-eth0是什么linux中eth0往往是网卡的接口名称,0是阿拉伯数字零,表示接口的编号,因为可能有多个网卡;数字0前面的eth是ethernet这个单词的简写(计算机技术领域大量使用单词的简写、缩写),ethernet是以太网的意思,所以eth就表示这个网卡接口是一个以太网卡的接口。
ifcfg命令是一个bash脚本程序,用来设置linux中的网络接口参数。
语法格式:
ifcfg [device] [cmd] [address]
device就是网卡设备,它可能有别名。cmd可以是add、delete、stop。address就是ip地址。
示例如下:
停止指定网络接口上的ip地址:
[root@linux265 ~]# ifcfg eth0 stop
为网络接口配置ip地址:
[root@linux265 ~]# ifcfg eth1 add 192.168.60.11/24
添加ip地址
[root@localhost ~]# ifcfg eth0 add 192.168.0.250/24 //添加地址250forwarding 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)
删除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)
推荐学习:linux视频教程
以上就是linux中ifcfg-eth0是什么的详细内容。
