[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
<>一、设置虚拟机的IP为静态的
一般情况下,NAT网络连接模式下,DHCP动态分配IP地址的,但这样在每次访问连接Linux虚拟机时,都要先去查询ip地址,很麻烦,干脆就将虚拟机IP地址写死,也就是设置为静态的(static)
<>解决方案:改系统的网络配置文件即可
<>1.进入配置文件
为什么是ens33呢?
我们在查询Linux虚拟机的ip地址时,可以看到VMware虚拟了一个网卡,名字就叫ens33,
此时动态分配的ip地址是 192.168.136.132,那么接下来,我们将ip地址写死,改成
192.168.136.100,最后这个数字100,是自己来定,你可以取1~255
<>2.修改这个网卡的网络配置文件
修改一项
BOOTPROTO=“static”
增加三项
#ip地址
IPADDR=192.168.136.100
#网关
GATEWAY=192.168.136.2
#域名解析器
DNS1=192.168.136.2
注意:网段192.168.136这三个数字必须与Linux虚拟机一致,网关四个数字必须与Linux虚拟机完全一致,DNS与网关相同
查看虚拟机的网络信息
最后修改网络配置如下:
<>3.使用物理机来ping这个修改的虚拟机IP 192.168.136.100,看修改是否正常生效
<>二、设置虚拟机的主机名
ip数字太多,不好记,输入也麻烦,改成好记的域名就方便多了,比如我们改成hadoop100
<>1.查看主机名
hostname
或者详细的主机信息
hostnamectl
<>2.修改主机名
hostnamectl set- hostname hadoop100
<>3.修改hosts文件
设置主机名hadoop100 与 IP地址 192.168.136.100 的映射关系
打开host文件命令
vim /etc/hosts
增加映射关系,如下
<>4.修改windows物理机的主机host文件,添加虚拟机的主机IP映射关系
<>5.物理机直接ping虚拟机的主机名,检查是否正常