如何确保我的虚拟机在连接不同网络时不更改其IP地址?

huangapple go评论78阅读模式
英文:

How to make sure that my virtual machine does not change its IP address when connecting to different networks?

问题

我有两个虚拟机。第一个有Apache服务器,以及虚拟主机上的WordPress。第二个有为第一个虚拟机中的WordPress运行的MySQL服务器。MySQL配置使用第一个虚拟机的IP地址。但是当我离开家,也就是离开家里的Wi-Fi时,当我从手机连接到互联网时,第一个虚拟机的IP地址会改变,导致我的网站崩溃。

英文:

I have two virtual machines. First has apache server, and wordpress on virtualhost. Second has mysql server for my wordpress in first vm. Mysql configuration use ip adress of first vm. But when i leave my home and in result leave my home wi-fi, ip adress of first vm is changing when i connect to internet from my phone and my web-site crashes.

答案1

得分: 0

IP地址默认情况下是动态分配的,因此如果您连接到不同的网络(即通过移动数据而不是家庭WiFi访问互联网时),IP地址会更改。您可以在您的虚拟机中分配静态IP地址。这是在虚拟机内部完成的。

英文:

It is said that by default IP addresses are assigned dynamically, so the IP changes if you are in different network (that is, when you access the Internet through mobile data instead of home wifi). You may assign static IP address to your VM. This is done from inside of your VM.

huangapple
  • 本文由 发表于 2023年6月2日 01:06:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/76384192.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定