1:安装Linux 2:修改机器名 hostname 显示主机名 [it@localhost bin]$ hostname localhost.sohudo 编辑主机名配置文件 [it@localhost bin]$ vi /etc/sysconfig/network NETWORKING=yes HOSTNAME=localhost.sohudo 用root登录 [it@localhost bin]$ su - 密码: [root@localhost ~]# vi /etc/sysconfig/network NETWORKING=yes HOSTNAME=localhost.sohudo ~ 把HOSTNAME修改为it.net.cn [html] view plain copy 在CODE上查看代码片派生到我的代码片 [it@it.net.cn ~]$ hostname it.net.cn 3: 配置hosts文件 [it@it.net.cn ~]$ su - 密码: [root@it.net.cn ~]# vi /etc/hosts 127.0.0.1 localhost localhost.sohudo ::1 localhost localhost.sohudo 后面加2行 10.3.7.212 it.net.cn 10.3.7.214 it02 [html] view plain copy 在CODE上查看代码片派生到我的代码片 "/etc/hosts" 4L, 120C written [root@it.net.cn ~]# [html] view plain copy 在CODE上查看代码片派生到我的代码片 [root@it.net.cn ~]# ping it02 PING it02 (10.3.7.214) 56(84) bytes of data. 64 bytes from it02 (10.3.7.214): icmp_seq=1 ttl=64 time=0.577 ms 64 bytes from it02 (10.3.7.214): icmp_seq=2 ttl=64 time=0.219 ms 64 bytes from it02 (10.3.7.214): icmp_seq=3 ttl=64 time=0.419 ms ^C --- it02 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台虚拟机: 第一台: [it@it.net.cn ~]$ uname -a Linux it.net.cn 2.6.18-238.el5 #1 SMP Sun Dec 19 14:22:44 EST 2010 x86_64 x86_64 x86_64 GNU/Linux [it@it.net.cn ~]$ head -n 1 /etc/issue Red Hat Enterprise Linux Server release 5.6 (Tikanga) [it@it.net.cn ~]$ 第二台: [it@it02 ~]$ uname -a Linux it02 2.6.32-358.el6.i686 #1 SMP Thu Feb 21 21:50:49 UTC 2013 i686 i686 i386 GNU/Linux [it@it02 ~]$ cat /proc/version Linux version 2.6.32-358.el6.i686 (mockbuild@c6b8.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) ) #1 SMP Thu Feb 21 21:50:49 UTC 2013 [it@it02 ~]$ head -n 1 /etc/issue CentOS release 6.4 (Final) [it@it02 ~]$ 第三台: [it@it03 ~]$ uname -a Linux it03 2.6.18-238.el5xen #1 SMP Sun Dec 19 14:42:02 EST 2010 x86_64 x86_64 x86_64 GNU/Linux [it@it03 ~]$ cat /proc/version Linux version 2.6.18-238.el5xen (mockbuild@x86-012.build.bos.redhat.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-50)) #1 SMP Sun Dec 19 14:42:02 EST 2010 [it@it03 ~]$ head -n 1 /etc/issue Red Hat Enterprise Linux Server release 5.6 (Tikanga) [it@it03 ~]$ (责任编辑:IT) |