How to add an ip address or network card in linux

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.