[root@svr7 ~]# vim /etc/hostname //配置主机名
svr7.tedu.cn
[root@svr7 ~]# nmcli connection modify eth0 ipv4.method manual ipv4.addresses 192.168.4.7/24 connection.autoconnect yes //配置IP地址
[root@svr7 ~]# nmcli connection up eth0 //激活连接
成功激活的连接(D-Bus 激活路径:/org/freedesktop/NetworkManager/ActiveConnection/8)
[root@svr7 ~]# ifconfig eth0 //确认配置结果
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.4.7 netmask 255.255.255.0 broadcast 192.168.4.255
inet6 fe80::20c:29ff:fe5e:f686 prefixlen 64 scopeid 0x20<link>
ether 52:54:00:11:00:07 txqueuelen 1000 (Ethernet)
RX packets 112143 bytes 9388455 (8.9 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 507844 bytes 771354289 (735.6 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
步骤三:快建虚拟机pc207
操作与步骤二类似,此处略。
步骤四:快建虚拟机的运行测试
1)启动两台虚拟机svr7、pc207,均可正常运行
2)从svr7可ping通pc207
[root@svr7 ~]# ping 192.168.4.207
PING 192.168.4.207 (192.168.4.207) 56(84) bytes of data.
64 bytes from 192.168.4.207: icmp_seq=1 ttl=64 time=0.392 ms
64 bytes from 192.168.4.207: icmp_seq=2 ttl=64 time=0.369 ms
.. ..
3)从CentOS真机可ssh远程访问这两台虚拟机
[root@room9pc00 ~]# ssh -X root@192.168.4.7
root@192.168.4.7's password: //验证svr7的root密码
Last login: Sun Mar 26 11:30:35 2017 from 192.168.4.254
[root@svr7 ~]# exit
[root@room9pc00 ~]# ssh -X root@192.168.4.207
root@192.168.4.207's password: //验证pc207的root密码
Last login: Sun Mar 26 11:32:35 2017 from 192.168.4.254
[root@pc207 ~]# exit
[root@room9pc00 ~]#
Linux公社的RSS地址:https://www.linuxidc.com/rssFeed.aspx