Home>Article>Operation and Maintenance> What is ifcfg-eth0 in linux

What is ifcfg-eth0 in linux

WBOY
WBOY Original
2022-05-24 10:50:04 3975browse

In Linux, "ifcfg-eth0" is the command to set the network card interface parameters; ifcfg is the command to set the network interface parameters, eth0 is the interface name of the network card, 0 represents the number of the interface; you can use this The command adds, deletes or stops the network card interface. The syntax is "ifcfg-eth0 parameter ip address".

What is ifcfg-eth0 in linux

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

What is ifcfg-eth0 in Linux

In Linux, eth0 is often the interface name of the network card. 0 is the Arabic numeral zero, indicating the number of the interface, because there may be multiple network cards; the number 0 precedes eth is the abbreviation of the word Ethernet (abbreviations and abbreviations of words widely used in the field of computer technology). Ethernet means Ethernet, so eth means that the network card interface is an Ethernet card interface.

The ifcfg command is a Bash script program used to set network interface parameters in Linux.

Syntax format:

ifcfg [device] [cmd] [address]

device is the network card device, it may have aliases. cmd can be add, delete, stop. address is the ip address.

Examples are as follows:

Stop specifying an IP address on a network interface:

[root@linux265 ~]# ifcfg eth0 stop

Configure an IP address for a network interface:

[root@linux265 ~]# ifcfg eth1 add 192.168.60.11/24

Add ip Address

[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)

Delete ip address

[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)

Recommended learning:Linux video tutorial

The above is the detailed content of What is ifcfg-eth0 in linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn