1:安装linux
2:修改机器名
hostname 显示主机名
[jifeng@localhost bin]$ hostname localhost.sohudo 编辑主机名配置文件
[jifeng@localhost bin]$ vi /etc/sysconfig/network NETWORKING=yes HOSTNAME=localhost.sohudo
用root登录 [jifeng@localhost bin]$ su - 密码: [root@localhost ~]# vi /etc/sysconfig/network NETWORKING=yes HOSTNAME=localhost.sohudo ~
把HOSTNAME修改为jifeng01
[jifeng@jifeng01 ~]$ hostname jifeng01
3: 配置hosts文件
[jifeng@jifeng01 ~]$ su - 密码: [root@jifeng01 ~]# vi /etc/hosts 127.0.0.1 localhost localhost.sohudo ::1 localhost localhost.sohudo后面加2行
10.3.7.212 jifeng01
10.3.7.214 jifeng02
"/etc/hosts" 4L, 120C written [root@jifeng01 ~]#
[root@jifeng01 ~]# ping jifeng02 PING jifeng02 (10.3.7.214) 56(84) bytes of data. 64 bytes from jifeng02 (10.3.7.214): icmp_seq=1 ttl=64 time=0.577 ms 64 bytes from jifeng02 (10.3.7.214): icmp_seq=2 ttl=64 time=0.219 ms 64 bytes from jifeng02 (10.3.7.214): icmp_seq=3 ttl=64 time=0.419 ms ^C --- jifeng02 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2740ms rtt min/avg/max/mdev = 0.219/0.405/0.577/0.146 ms测试OK
准备了3台虚拟机:
第一台:
[jifeng@jifeng01 ~]$ uname -a Linux jifeng01 2.6.18-238.el5 #1 SMP Sun Dec 19 14:22:44 EST 2010 x86_64 x86_64 x86_64 GNU/Linux [jifeng@jifeng01 ~]$ head -n 1 /etc/issue Red Hat Enterprise Linux Server release 5.6 (Tikanga) [jifeng@jifeng01 ~]$
[jifeng@jifeng02 ~]$ uname -a Linux jifeng02 2.6.32-358.el6.i686 #1 SMP Thu Feb 21 21:50:49 UTC 2013 i686 i686 i386 GNU/Linux [jifeng@jifeng02 ~]$ cat /proc/version Linux version 2.6.32-358.el6.i686 ([email protected]) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) ) #1 SMP Thu Feb 21 21:50:49 UTC 2013 [jifeng@jifeng02 ~]$ head -n 1 /etc/issue CentOS release 6.4 (Final) [jifeng@jifeng02 ~]$
[jifeng@jifeng03 ~]$ uname -a Linux jifeng03 2.6.18-238.el5xen #1 SMP Sun Dec 19 14:42:02 EST 2010 x86_64 x86_64 x86_64 GNU/Linux [jifeng@jifeng03 ~]$ cat /proc/version Linux version 2.6.18-238.el5xen ([email protected]) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-50)) #1 SMP Sun Dec 19 14:42:02 EST 2010 [jifeng@jifeng03 ~]$ head -n 1 /etc/issue Red Hat Enterprise Linux Server release 5.6 (Tikanga) [jifeng@jifeng03 ~]$