当前位置:网站首页>VM虚拟机配置动态ip和静态ip访问
VM虚拟机配置动态ip和静态ip访问
2022-07-01 12:39:00 【51CTO】
VM虚拟机配置动态ip和静态ip访问
动态ip静态ip配置网络适配器都设置成NAT模式
动态ip配置
这个比较简单。
设置/etc/sysconfig/network-scripts/目录下的文件 ifcfg-ens33
配置文件如下即可
然后虚拟网络编辑器下设置NAT网络勾选这项就可以使用动态IP了
设置动态ip范围:
🥭静态ip配置
查看我们的PC无线网的默认网关(查看方式:设置-》查看网络属性)是多少,虚拟机的IP以及网关设置必须与PC无线网网关在同一个网段内才能实现通信
实际使用中一般使用静态IP,如果采用DHCP来自动获取IP的话 只要一断网 WM就会重新获取当前IP的下一个IP,所以必须改成静态的来防止这种尴尬的情况0.0
静态ip配置文件 ifcfg-ens33 如下
跟动态ip所不同的是设置了
BOOTPROTO=static为静态IP方式,
DNS1设置成 114.114.114.114 通用DNS
IPADDR 静态ip地址
NETMASK 子网掩码
GATEWAY 网关
注意ip要设置成与网关和子网同一段,同时子网掩码配置文件也要和配置保持一致。
网关如果设置成宿主机一样的还是ping不通外网和宿主机,就把网关最后一位设置成.2,如:192.168.2.2

然后虚拟网络编辑器下设置NAT网络切记不要勾选
配置完毕记得重启网卡配置systemctl restart network.service
设置域名解析
设置了静态ip,能访问外网,但是执行ping www.baidu.com不通,这时需要配置域名解析vi /etc/resolv.conf
本文内容到此结束了,
如有收获欢迎点赞收藏关注️,您的鼓励是我最大的动力。
如有错误疑问欢迎各位大佬指出。
主页: 共饮一杯无的博客汇总保持热爱,奔赴下一场山海。

边栏推荐
- Chain storage of binary tree
- 基于.NetCore开发博客项目 StarBlog - (13) 加入友情链接功能
- 【邂逅Django】——(二)数据库配置
- Ansi/ul 94 VTM vertical burning test for thin materials
- 【历史上的今天】7 月 1 日:分时系统之父诞生;支付宝推出条码支付;世界上第一支电视广告
- 高薪程序员&面试题精讲系列118之Session共享有哪些方案?
- Quickly understand what the compressed list in redis is
- 腾讯总考epoll, 很烦
- 有人碰到过这种情况吗,oracle logminer 同步的时候,clob字段的值丢失
- "Analysis of 43 cases of MATLAB neural network": Chapter 40 research on prediction of dynamic neural network time series -- implementation of NARX based on MATLAB
猜你喜欢

Manage nodejs with NVM (downgrade the high version to the low version)

基于开源流批一体数据同步引擎 ChunJun 数据还原 —DDL 解析模块的实战分享

【脑洞大开】《西潮》及《走向世界丛书》
![[datawhale202206] pytorch recommendation system: multi task learning esmm & MMOE](/img/8f/64fea641730795a2b5252cc2c8cdd2.png)
[datawhale202206] pytorch recommendation system: multi task learning esmm & MMOE

Operations related to sequence table

IOS interview

Arm GIC (V) how arm TrustZone supports security interrupt analysis notes.

Ipv6-6to4 experiment

79. 单词搜索【dfs + 回溯visit + 遍历起点】

How to install php7 and perform performance test using yum
随机推荐
工具箱之 IKVM.NET 项目新进展
Using burpsuite to capture app packages
MySQL common functions
[brain opening] west tide and going to the world series
Switch basic experiment
Tencent Li Wei: deeply cultivate "regulatory technology" to escort the steady and long-term development of the digital economy
"Analysis of 43 cases of MATLAB neural network": Chapter 40 research on prediction of dynamic neural network time series -- implementation of NARX based on MATLAB
Stack-------
腾讯安全联合毕马威发布监管科技白皮书,解析“3+3”热点应用场景
Nc100 converts strings to integers (ATOI)
Question d'entrevue de Huawei: recrutement
[today in history] July 1: the father of time sharing system was born; Alipay launched barcode payment; The first TV advertisement in the world
使用BurpSuite对app抓包教程
Ansible Playbook
天青色等烟雨
System test UI test summary and questions (interview)
手机便签应用
Chain storage of binary tree
localtime居然不可重入,踩坑了
Common chart usage of Bi tools