Red hat Linux ip configuration

Source: Internet
Author: User

 

When I first came into contact with Linux, I first needed to access the Internet. Configuring IP addresses is the first course to learn how to use Linux.

 

1. Set IP addresses

View your IP Nic

Ifconfig-

 

Find the network card you want to use

Vi/etc/sysconfig/network-scripts/ifcfg-eth0

Www.2cto.com

# Intelconfiguration82801ba/BAM/CA/CAMEthernetController

DEVICE = eth0 (NIC interface name)

BOOTPROTO = static (value: static/none/DHCP)

# BROADCAST = 192.168.120.255

HWADDR = 00: A2: A5: F5: 80: 55

IPADDR = 192.168.120.54 (IP address)

NETMASK = 255.255.255.0 (subnet mask)

# NETWORK = 192.168.120.0

ONBOOT = yes (whether it takes effect automatically yes/no)

 

2. Set the gateway address

Vi/etc/sysconfig/network

 

NETWORKING = yes

HOSTNAME = localhost. localdomain

GATEWAY = 192.168.120.1 (GATEWAY)

 

3. Set the DNS address

Vi/etc/resolv. conf

 

Nameserver 192.168.20.36 (primary DNS)

Nameserver 202.102.24.35 (secondary DNS)

Searchlocaldomain

 

4. The settings are complete.

/Etc/init. d/network restart

 

 

In addition, Linux can configure one network card with two ip addresses or multiple network cards under one IP address.

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.