Linux下修改主机IP主机名

本文发布时间: 2019-Mar-22
此处:http://blog.csdn.net/huangyanlong/article/details/392149851. 修改网络配置Last login: Sat Sep 6 17:33:02 2014[root@centos ~]# vi/etc/sysconfig/network-scripts/ifcfg-eth0--修改前# Intel Corporation 82540EM GigabitEthernet ControllerDEVICE=eth0BOOTPROTO=dhcpONBOOT=yesHWADDR=08:00:27:80:63:5b~~--修改后# Intel Corporation 82540EM GigabitEthernet ControllerDEVICE=eth0BOOTPROTO=staticIPADDR=10.53.105.65NETMASK=255.255.255.0ONBOOT=yesHWADDR=08:00:27:80:63:5b~[root@centos ~]# service network restartShutting down interface eth0: [ OK ]Shutting down loopback interface: [ OK ]Bringing up loopback interface: [ OK ]Bringing up interface eth0: RTNETLINK answers: Invalid argument[ OK ]2. 修改hosts配置[root@centos ~]# vi /etc/hosts# Do not remove the following line, orvarious programs# that require network functionality willfail.127.0.0.1 centos localhost.localdomainlocalhost::1 localhost6.localdomain6 localhost610.53.105.65 hyldb~~3. 修改network配置[root@centos ~]# vi /etc/sysconfig/network--修改前NETWORKING=yesNETWORKING_IPV6=yesHOSTNAME=centosGATEWAY=10.53.105.255~~--修改后NETWORKING=yesNETWORKING_IPV6=noHOSTNAME=hyldbGATEWAY=10.53.105.255~~--重启系统,使配置生效[root@centos ~]# rebootBroadcast message from root (pts/3) (SunSep 7 00:00:08 2014):The system is going down for reboot NOW!重启后效果如下:Last login: Sat Sep 6 23:55:38 2014 from 10.53.105.69[root@hyldb ~]# ifconfigeth0 Link encap:Ethernet HWaddr08:00:27:80:63:5Binet addr:10.53.105.65 Bcast:10.53.105.255 Mask:255.255.255.0inet6 addr: fe80::a00:27ff:fe80:635b/64 Scope:LinkUP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1RX packets:44 errors:0 dropped:0 overruns:0 frame:0TX packets:73 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000RX bytes:5283 (5.1 KiB) TXbytes:10654 (10.4 KiB)lo Link encap:Local Loopbackinet addr:127.0.0.1 Mask:255.0.0.0inet6 addr: ::1/128 Scope:HostUP LOOPBACK RUNNING MTU:16436 Metric:1RX packets:5900 errors:0 dropped:0 overruns:0 frame:0TX packets:5900 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:0RX bytes:10634248 (10.1 MiB) TXbytes:10634248 (10.1 MiB)[root@hyldb ~]# hostnamehyldb[root@hyldb ~]#


(以上内容不代表本站观点。)
---------------------------------
本网站以及域名有仲裁协议。
本網站以及域名有仲裁協議。

2024-Mar-04 02:10pm
栏目列表