RedHat: basic system configuration

Source: Internet
Author: User
1. modify the host name vietcsysconfignetworkNETWORKING = yesHOSTNAME = NEWHOSTNAME to modify this & amp; 20540; as the host name, for example, NEWPC2: modify hostsvietchosts0000001localhost

1. modify the host name

Vi/etc/sysconfig/network

NETWORKING = yes

HOSTNAME = NEWHOSTNAME # modify this value as the host name, for example, NEWPC

2. modify hosts

Vi/etc/hosts

127.0.0.1localhost.localdomain localhost

# This row is strongly recommended to be retained

192.168.0.1rhel.lpwr.net rhel

# Three fields are required: IP, FQDN, and HOSTNAME.

3. modify the ip address

First, check the IP address of the NIC of the current machine.

1) display the currently started network interface commands:

# Ifconfig

2) view all current network interface commands:

# Ifconfig-

3) view the specified network interface command:

# Ifconfig eth0

IP address modification in LINUX is divided into two situations,

A) modify the IP address during debugging. the IP address only takes effect currently and is restored to the original IP address after restart.

# Ifconfig eth0 192.168.63.27 netmask route 255.255.0 route add defaultgw 192.168.63.1 up

B) permanently effective (that is, it can also take effect after restart)

Method 1: configure the Nic configuration file

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

Vi/etc/sysconfig/network-scripts/ifcfg-eth0 # Second Nic: vi/etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE = eth0 # physical DEVICE name

IPADDR = 192.168.1.10 # IP address

NETMASK = 255.255.255.0 # mask value

NETWORK = 192.168.1.0 # NETWORK address (optional)

BROADCAST = 192.168.1.255 # BROADCAST address (optional)

GATEWAY = 192.168.1.1 # GATEWAY address

ONBOOT = yes # [yes | no] (whether to activate the device during boot)

USERCTL = no # [yes | no] (whether non-root users can control the device)

BOOTPROTO = static # [none | static | bootp | dhcp] (no protocol used during boot | static allocation | BOOTP protocol | DHCP protocol)

Method 2:

Save ifconfig eth0 192.168.63.27 netmask 255.255.255.0 route adddefault gw 192.168.63.1 to the/etc/init. d/rc. local file.

4. modify the Gateway

Vim/etc/sysconfig/network

Add a Gateway

GATEWAY = 192.168.1.1

5. modify DNS

Vi/etc/resolv. conf # specifies the DNS server of the current host. up to three

Searchlpwr.net # set the default search domain for the current host

Nameserver192.168.0.100 # specify the preferred DNS server

Nameserver172.16.254.2

6. after the restart, the network will take effect.

/Etc/init. d/network restart

Service network restart

Related Article

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.