自从会用centos 配置多台虚拟机,妈妈再也不用担心我的学习啦
作者:互联网
Vmware 配置多台centos
配置虚拟网络编辑器
配置ip
- 第一台centos
vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=5edbdebe-c8a2-4b32-8e63-fd75d03f6a2c
DEVICE=ens33
ONBOOT=yes
IPV6_PRIVACY=no
IPADDR=192.168.20.128
GATEWAY=192.168.20.2
NETMASK=255.255.255.0
DNS1=223.5.5.5
DNS2=223.6.6.6
- 第二台centos
vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=5edbdebe-c8a2-4b32-8e63-fd75d03f6a2c
DEVICE=ens33
ONBOOT=yes
IPV6_PRIVACY=no
IPADDR=192.168.20.130
GATEWAY=192.168.20.2
NETMASK=255.255.255.0
DNS1=223.5.5.5
DNS2=223.6.6.6
注意: 依次类推第三台,第四台....只需修改ip即可.
查看并重启网卡
# 有的linux版本没有ifconfig指令,那么我们可以使用ip addr
ifconfig
# 重启网卡
service network restart
测试
# 使用第一台centos 去ping 第二台centos
[root@localhost etc]# ping 192.168.20.130
PING 192.168.20.130 (192.168.20.130) 56(84) bytes of data.
64 bytes from 192.168.20.130: icmp_seq=1 ttl=64 time=0.325 ms
64 bytes from 192.168.20.130: icmp_seq=2 ttl=64 time=0.214 ms
64 bytes from 192.168.20.130: icmp_seq=3 ttl=64 time=0.246 ms
64 bytes from 192.168.20.130: icmp_seq=4 ttl=64 time=0.220 ms
64 bytes from 192.168.20.130: icmp_seq=5 ttl=64 time=0.231 ms
^C
--- 192.168.20.130 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4000ms
# 使用centos 去ping 外网
[root@localhost etc]# ping baidu.com
PING baidu.com (220.181.38.148) 56(84) bytes of data.
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=1 ttl=128 time=109 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=2 ttl=128 time=29.5 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=3 ttl=128 time=29.7 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=4 ttl=128 time=30.5 ms
结语: 到这里我们的配置就成功了, 有了多台虚拟机我们可以模拟跨主机应用.thanks!
标签:20.130,centos,虚拟机,bytes,192.168,64,IPV6,yes,多台 来源: https://www.cnblogs.com/best7l/p/15675309.html