1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > Vmware虚拟机集群设置静态ip

Vmware虚拟机集群设置静态ip

时间:2024-04-25 15:08:59

相关推荐

Vmware虚拟机集群设置静态ip

前提准备

1 centos 7系统

2 Vmare为NAT模式

设置静态IP

为方便管理集群,需要为每台机器设置静态ip

vi /etc/sysconfig/network-scripts/ifcfg-ens33

修改内容

其中BOOTPROTO=static表示静态ip,如果改成dhcp就是动态ip了

IPADDR=192.168.21.101表示设置ip地址为这个

GATEWAY=192.168.21.2设置默认网关

网关地址可以通过vmware查询,编辑--虚拟网络编辑器--NAT设置

dns设置常用的即可.

............BOOTPROTO=static #将dhcp改为static............ONBOOT=yes #将no改为yesIPADDR=192.168.10.101 #添加IPADDR属性和ip地址PREFIX=24 #添加NETMASK=255.255.255.0或者PREFIX=24GATEWAY=192.168.10.2 #添加网关GATEWAYDNS1=114.114.114.114 #添加DNS1和备份DNSDNS2=8.8.8.8

要使得设置生效,还需要

service network restart

更改后是否生效可通过ip addr命令查看

[root@mypc01 ~]# ip addr2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000link/ether 29:4d 41 brd ff:ff:ff:ff:ff:ffinet 192.168.10.101/24 brd 192.168.10.255 scope global noprefixroute ens33

ens33 网卡名称.

其中link/ether 00:0c:29:4d 41 brd ff:ff:ff:ff:ff:ff代表mac地址

inet:网卡上绑定的IP地址,通常所说的IPV4,一块网卡可以绑定多个IP地址

LOWER_UP表示插着网线.

关闭以及禁用防火墙

方便集群间通信

systemctl stop firewalld systemctl disable firewalld

防火墙的状态可以如下查看. inactive表示处于关闭状态

[root@mypc01 ~]# systemctl status firewalld● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)Active: inactive (dead)Docs: man:firewalld(1)

或者也可以通过查找firewalld进程来查看

[root@mypc01 ~]# ps -ef |grep firewalldroot 21611 11 16:46 ? 00:00:01 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopidroot 2280 1520 0 16:46 pts/0 00:00:00 grep --color=auto firewalld

关闭及禁用NetworkManager

systemctl stop NetworkManager systemctl disable NetworkManager

修改主机名

设一个好记的名字即可

hostnamectl set-hostname mypc01

修改主机和ip的映射关系

和修改windows下的hosts原理是一样的.

这样的话访问的时候输入主机名mypc01等就可以了,不用输入ip地址,毕竟比较难记.

#vim /etc/hosts192.168.10.111mypc01 192.168.10.112mypc02 192.168.10.113mypc03

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。