Article Title: how to add an ip address or network card to linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
How to add ip addresses in linux:
Cd/etc/sysconfig/network-scripts
Ls ifcfg-eth0 *
You can see that
Ifcfg-eth0
If you have configured other ip addresses before, there may be
Ifcfg-eth0: 0
Ifcfg-eth0: 1
And so on.
If not, edit a ifcfg-eth0: 0 file, and if yes, add one to the maximum. File content:
IPADDR = "192.168.0.10 ″
NETMASK = ""
IPADDR is the new IP address to be added. if multiple consecutive IP addresses exist, you can write them as follows:
IPADDR = "192.168.0.10-11 ″
NETMASK = ""
After the file is edited, run:
/Etc/init. d/network reload
Use ifconfig to check whether the new IP address has been added.
If you are configuring an IP address for the second Nic, edit a ifcfg-eth1 file in the/etc/sysconfig/network-scripts directory:
DEVICE = eth1
ONBOOT = yes
BOOTPROTO = static
IPADDR = 192.168.0.18
NETMASK = 255.255.255.0
GATEWAY = 192.168.0.1
Modify the IPADDR, NETMASK, and GATEWAY parameters.
Run:
/Etc/init. d/network reload
Use ifconfig to check whether the new IP address has been added.