前端之家收集整理的这篇文章主要介绍了
克隆centos虚拟机 的IP HostName HWaddr,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
[root@cdh1 Desktop]# ls
down
[root@cdh1 Desktop]# ifcongfig
bash: ifcongfig: command not found
[root@cdh1 Desktop]# ifconfig
eth4 Link encap:Ethernet HWaddr 00:0C:29:DF:7B:2A
inet addr:192.168.0.102 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fedf:7b2a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:24 errors:0 dropped:0 overruns:0 frame:0
TX packets:21 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:11264 (11.0 KiB) TX bytes:2163 (2.1 KiB)
Interrupt:19 Base address:0x2024
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:16 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:960 (960.0 b) TX bytes:960 (960.0 b)
[root@cdh1 Desktop]# df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 5.7G 4.2G 1.2G 79% /
tmpfs 504M 76K 504M 1% /dev/shm
/dev/sda4 7.9G 743M 6.8G 10% /user
/dev/sda1 291M 32M 245M 12% /boot
[root@cdh1 Desktop]# cat /etc/sysconfig/network
#NETWORKING=yes
#HOSTNAME=data02
NETWORKING=yes
HOSTNAME=cdh1
NETWORKING_IPV6=no
PEERNTP=no
[root@cdh1 Desktop]# cat /etc/sysconfig/network
#NETWORKING=yes
#HOSTNAME=data02
NETWORKING=yes
HOSTNAME=cdh1
NETWORKING_IPV6=no
PEERNTP=no
[root@cdh1 Desktop]# vi /etc/sysconfig/network
[root@cdh1 Desktop]# cat /etc/sysconfig/network
#NETWORKING=yes
#HOSTNAME=data02
NETWORKING=yes
HOSTNAME=cdh3
NETWORKING_IPV6=no
PEERNTP=no
[root@cdh1 Desktop]# cat /etc/hosts
#127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 name01
#::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 cdh1
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
#127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
#::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
#10.99.174.85 hadoop.example.com hadoop
#192.168.0.101 name01
#192.168.0.102 data01
#192.168.0.103 data02
192.168.0.103 cdh1
#192.168.111.126 cdh1
#192.168.111.127 cdh2
#192.168.111.128 cdh3
[root@cdh1 Desktop]# cat /etc/hosts
#127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 name01
#::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 cdh1
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
#127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
#::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
#10.99.174.85 hadoop.example.com hadoop
#192.168.0.101 name01
#192.168.0.102 data01
#192.168.0.103 data02
192.168.0.103 cdh1
#192.168.111.126 cdh1
#192.168.111.127 cdh2
#192.168.111.128 cdh3
[root@cdh1 Desktop]# vi /etc/hosts
[root@cdh1 Desktop]# cat /etc/hosts
#127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 name01
#::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 cdh3
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
#127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
#::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
#10.99.174.85 hadoop.example.com hadoop
#192.168.0.101 name01
#192.168.0.102 data01
#192.168.0.103 data02
192.168.0.104 cdh3
#192.168.111.126 cdh1
#192.168.111.127 cdh2
#192.168.111.128 cdh3
[root@cdh1 Desktop]# ifconfig
eth4 Link encap:Ethernet HWaddr 00:0C:29:DF:7B:2A
inet addr:192.168.0.102 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fedf:7b2a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1038 errors:0 dropped:0 overruns:0 frame:0
TX packets:62 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:83932 (81.9 KiB) TX bytes:4918 (4.8 KiB)
Interrupt:19 Base address:0x2024
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:16 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:960 (960.0 b) TX bytes:960 (960.0 b)
[root@cdh1 Desktop]# vi /etc/hosts
[root@cdh1 Desktop]# ifconfig
eth4 Link encap:Ethernet HWaddr 00:0C:29:DF:7B:2A
inet addr:192.168.0.102 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fedf:7b2a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1038 errors:0 dropped:0 overruns:0 frame:0
TX packets:62 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:83932 (81.9 KiB) TX bytes:4918 (4.8 KiB)
Interrupt:19 Base address:0x2024
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:16 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:960 (960.0 b) TX bytes:960 (960.0 b)
[root@cdh1 Desktop]# ls -l /etc/sysconfig/network-scripts/
total 208
-rw-r--r--. 3 root root 260 Jul 4 2015 ifcfg-eth2.bak
-rw-r--r-- 1 root root 260 Jun 16 16:36 ifcfg-eth3
-rw-r--r--. 1 root root 254 Jan 9 2013 ifcfg-lo
lrwxrwxrwx. 1 root root 20 Sep 9 2013 ifdown -> ../../../sbin/ifdown
-rwxr-xr-x. 1 root root 627 Jan 9 2013 ifdown-bnep
-rwxr-xr-x. 1 root root 5397 Jan 9 2013 ifdown-eth
-rwxr-xr-x. 1 root root 781 Jan 9 2013 ifdown-ippp
-rwxr-xr-x. 1 root root 4168 Jan 9 2013 ifdown-ipv6
lrwxrwxrwx. 1 root root 11 Sep 9 2013 ifdown-isdn -> ifdown-ippp
-rwxr-xr-x. 1 root root 1481 Jan 9 2013 ifdown-post
-rwxr-xr-x. 1 root root 1064 Jan 9 2013 ifdown-ppp
-rwxr-xr-x. 1 root root 835 Jan 9 2013 ifdown-routes
-rwxr-xr-x. 1 root root 1370 Jan 9 2013 ifdown-sit
-rwxr-xr-x. 1 root root 1434 Jan 9 2013 ifdown-tunnel
lrwxrwxrwx. 1 root root 18 Sep 9 2013 ifup -> ../../../sbin/ifup
-rwxr-xr-x. 1 root root 12365 Jan 9 2013 ifup-aliases
-rwxr-xr-x. 1 root root 859 Jan 9 2013 ifup-bnep
-rwxr-xr-x. 1 root root 10157 Jan 9 2013 ifup-eth
-rwxr-xr-x. 1 root root 11971 Jan 9 2013 ifup-ippp
-rwxr-xr-x. 1 root root 10401 Jan 9 2013 ifup-ipv6
[root@cdh1 Desktop]# mv /etc/sysconfig/network-scripts/ifcfg-eth3 /etc/sysconfig/network-scripts/ifcfg-eth2
[root@cdh1 Desktop]# ls -l /etc/sysconfig/network-scripts/
total 208
-rw-r--r-- 1 root root 260 Jun 17 07:53 ifcfg-eth2
-rw-r--r--. 3 root root 260 Jul 4 2015 ifcfg-eth2.bak
-rw-r--r--. 1 root root 254 Jan 9 2013 ifcfg-lo
lrwxrwxrwx. 1 root root 20 Sep 9 2013 ifdown -> ../../../sbin/ifdown
-rwxr-xr-x. 1 root root 627 Jan 9 2013 ifdown-bnep
-rwxr-xr-x. 1 root root 5397 Jan 9 2013 ifdown-eth
-rwxr-xr-x. 1 root root 781 Jan 9 2013 ifdown-ippp
-rwxr-xr-x. 1 root root 4168 Jan 9 2013 ifdown-ipv6
lrwxrwxrwx. 1 root root 11 Sep 9 2013 ifdown-isdn -> ifdown-ippp
-rwxr-xr-x. 1 root root 1481 Jan 9 2013 ifdown-post
-rwxr-xr-x. 1 root root 1064 Jan 9 2013 ifdown-ppp
-rwxr-xr-x. 1 root root 835 Jan 9 2013 ifdown-routes
-rwxr-xr-x. 1 root root 1370 Jan 9 2013 ifdown-sit
-rwxr-xr-x. 1 root root 1434 Jan 9 2013 ifdown-tunnel
lrwxrwxrwx. 1 root root 18 Sep 9 2013 ifup -> ../../../sbin/ifup
-rwxr-xr-x. 1 root root 12365 Jan 9 2013 ifup-aliases
-rwxr-xr-x. 1 root root 859 Jan 9 2013 ifup-bnep
-rwxr-xr-x. 1 root root 10157 Jan 9 2013 ifup-eth
-rwxr-xr-x. 1 root root 11971 Jan 9 2013 ifup-ippp
-rwxr-xr-x. 1 root root 10401 Jan 9 2013 ifup-ipv6
lrwxrwxrwx. 1 root root 9 Sep 9 2013 ifup-isdn -> ifup-ippp
-rwxr-xr-x. 1 root root 727 Jan 9 2013 ifup-plip
-rwxr-xr-x. 1 root root 954 Jan 9 2013 ifup-plusb
-rwxr-xr-x. 1 root root 2364 Jan 9 2013 ifup-post
-rwxr-xr-x. 1 root root 4154 Jan 9 2013 ifup-ppp
-rwxr-xr-x. 1 root root 1925 Jan 9 2013 ifup-routes
-rwxr-xr-x. 1 root root 3499 Jan 9 2013 ifup-sit
-rwxr-xr-x. 1 root root 2488 Jan 9 2013 ifup-tunnel
-rwxr-xr-x. 1 root root 3770 Jan 9 2013 ifup-wireless
-rwxr-xr-x. 1 root root 4623 Jan 9 2013 init.ipv6-global
-rwxr-xr-x. 1 root root 1125 Jan 9 2013 net.hotplug
-rw-r--r--. 1 root root 13079 Jan 9 2013 network-functions
-rw-r--r--. 1 root root 29853 Jan 9 2013 network-functions-ipv6
[root@cdh1 Desktop]# /etc/init.d/network restart
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth2: Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/1
state: activated
Connection activated
[ OK ]
[root@cdh1 Desktop]# ls -l /etc/sysconfig/network-scripts/
原文链接:https://www.f2er.com/centos/381933.html