英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论