Modify host IP, host name under Linux

Source: Internet
Author: User

*********************************************** Declaration ********************************************* * 

original works, from the "Deep Blue Blog" blog, Welcome Reprint, please be sure to indicate the source when reproduced , otherwise be held responsible for copyright law.

Please leave a message or email ([email protected]) to indicate the error.

This reprint must be kept here: http://blog.csdn.net/huangyanlong/article/details/39214985

Deep Blue Blog:http://blog.csdn.net/huangyanlong

***************************************************************************************************

1. Modify the network configuration

Last Login:sat Sep 6 17:33:02 2014

[Email protected] ~]# vi/etc/sysconfig/network-scripts/ifcfg-eth0

--Pre-modification

# Intel Corporation 82540EM gigabitethernet Controller

Device=eth0

Bootproto=dhcp

Onboot=yes

hwaddr=08:00:27:80:63:5b

~

~

--After modification

# Intel Corporation 82540EM gigabitethernet Controller

Device=eth0

Bootproto=static

ipaddr=10.53.105.65

netmask=255.255.255.0

Onboot=yes

hwaddr=08:00:27:80:63:5b

~

[Email protected] ~]# service Network Restart

Shutting down interface eth0: [OK]

Shutting down loopback interface: [OK]

Bringing up loopback interface: [OK]

Bringing up interface Eth0:rtnetlink answers:invalid argument

[OK]

2. Modify the hosts configuration

[Email protected] ~]# vi/etc/hosts

# don't remove the following line, orvarious programs

# that require network functionality Willfail.

127.0.0.1 CentOS Localhost.localdomainlocalhost

:: 1 localhost6.localdomain6 Localhost6

10.53.105.65 Hyldb

~

~

3. Modify the network configuration

[Email protected] ~]# vi/etc/sysconfig/network

--Pre-modification

Networking=yes

Networking_ipv6=yes

Hostname=centos

gateway=10.53.105.255

~

~

--After modification

Networking=yes

Networking_ipv6=no

Hostname=hyldb

gateway=10.53.105.255

~

~

--Restart the system for the configuration to take effect

[Email protected] ~]# reboot

Broadcast message from root (PTS/3) (Sunsep 7 00:00:08 2014):

The system is going down for reboot now!

After the restart, the effect is as follows:

Last Login:sat Sep 6 23:55:38 from 10.53.105.69

[Email protected] ~]# ifconfig

Eth0 Link encap:ethernet hwaddr08:00:27:80:63:5b

inet addr:10.53.105.65 bcast:10.53.105.255 mask:255.255.255.0

Inet6 ADDR:FE80::A00:27FF:FE80:635B/64 Scope:link

Up broadcast RUNNING multicast mtu:1500 metric:1

RX packets:44 errors:0 dropped:0 overruns:0 frame:0

TX packets:73 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:5283 (5.1 KiB) txbytes:10654 (10.4 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:5900 errors:0 dropped:0 overruns:0 frame:0

TX packets:5900 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:10634248 (10.1 MiB) txbytes:10634248 (10.1 MiB)

[Email protected] ~]# hostname

Hyldb

[Email protected] ~]#

*********************************************** Declaration ********************************************* * 

original works, from the "Deep Blue Blog" blog, Welcome Reprint, please be sure to indicate the source when reproduced , otherwise be held responsible for copyright law.

Please leave a message or email ([email protected]) to indicate the error.

This reprint must be kept here: http://blog.csdn.net/huangyanlong/article/details/39214985

Deep Blue Blog:http://blog.csdn.net/huangyanlong

***************************************************************************************************

Modify host IP, host name under Linux

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.