After the centos system is installed, it must be changed in two places.

Source: Internet
Author: User

In fact, after the system is installed, you need to change two places. One is the computer name and the other is the IP address.

Where can I change the computer name?

The configuration file of the centos computer name is network VI/etc/sysconfig/network under the/etc/sysconfig/directory.

Networking = Yes
Hostname = linux123 [change my computer name to linux123]

 

Change computer OS IP Address

Centos network configuration file is/etc/sysconfig/network-scripts directory under the ifcfg-eth0 [if you have multiple NICs, ifcfg-eth 0 ifcfg-eth1, etc]

Edit this configuration file VI/etc/sysconfig/network-scripts/ifcfg-eth0

This is my configuration file

 

Device = eth0
Bootproto = static

Onboot = Yes
Type = Ethernet
Userctl = No
# Gateway = Yes
Dns1 = 8.8.8.8
Dns2 = 114.114.114.114

Ipv6init = No
Hwaddr = 00: 0C: 29: Ea: 7f: DF
Ipaddr = 192.168.1.240
Netmask = 255.255.255.0
Gateway = 192.168.1.1

 

Device = eth0 [Nic alias]
Bootproto = static [You can set it to a static IP address or set it to DHCP for Automatic Retrieval]
Onboot = Yes [start with system]
Type = Ethernet [type Ethernet]
Userctl = No [This is unknown. I only know that this configuration file is available when I compile it]
# Gateway = Yes
Dns1 = 8.8.8.8 [preferred DNS]
Dns2 = 114.114.114.114 [Backup dns]

Ipv6init = No [whether IPv6 is supported]
Hwaddr = 00: 0C: 29: Ea: 7f: DF [physical address]
Ipaddr = 192.168.1.240 [set the IP address of this computer to 192.168.1.240]
Netmask = 255.255.255.0 [mask]
Gateway = 192.168.1.1 [gateway]

 

Save and exit the restart Test

[[Email protected] ~] # Hostname
Linux123

[[Email protected] ~] #

 

[[Email protected] ~] # Ifconfig
Eth0 link encap: Ethernet hwaddr 00: 0C: 29: Ea: 7f: DF
Inet ADDR: 192.168.1.240 bcast: 192.168.1.255 mask: 255.255.255.0
Inet6 ADDR: fe80: 20c: 29ff: feea: 7fdf/64 scope: Link
Up broadcast running Multicast MTU: 1500 Metric: 1
RX packets: 71 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 96 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 FIG: 1000
RX Bytes: 7452 (7.2 kib) TX Bytes: 11422 (11.1 kib)

Lo link encap: local loopback
Inet ADDR: 127.0.0.1 mask: 255.0.0.0
Inet6 ADDR: 1/128 scope: Host
Up loopback running MTU: 16436 Metric: 1
RX packets: 4 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 4 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 0
RX Bytes: 240 (240.0 B) TX Bytes: 240 (240.0 B)

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.