gpt4 book ai didi

java - 虚拟机中的本地主机地址

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:38:52 24 4
gpt4 key购买 nike

我在服务器上使用虚拟机。我的虚拟机本地 IP 是 192.168.1.10

我正在尝试实现一些需要我按照此链接中提供的方式编辑我的 /etc/hosts

http://www.thatisjava.com/java-tech/55200/

我有类似的问题,我的控制台显示

RTP--- :DataAddress: /192.168.1.10
ControlAddress: /192.168.1.10
DataPort: 42050
ControlPort: 42051
java.io.IOException: Local Data AddressDoes not belong to any of this hosts local interfaces
java.io.IOException: Local Data AddressDoes not belong to any of this hosts local interfaces
at org.speechforge.cairo.rtp.RTPConsumer.init(RTPConsumer.java:181)
at org.speechforge.cairo.rtp.RTPConsumer.<init>(RTPConsumer.java:95)
at org.speechforge.cairo.rtp.server.RTPStreamReplicator.<init> (RTPStreamReplicator.java:69)

还有一些。

给出的问题的答案是

I solved this one. The problem is JMF seems to use InetAddress.getAllByName() which returns (at least in my case) only single IP address no matter how many addresses I have defined on my interfaces. The problem was solved by placing my IP address that I wanted to use by session manager into /etc/hosts. It must be the first line in /etc/hosts otherwise the other row that matches is used.

不幸的是,我听不懂他想表达什么。我的 /etc/hosts 读取

127.0.0.1    localhost
127.0.1.1 SparkVM104

那么我是否应该将 127.0.0.1 更改为我的 192.168.1.10

或者我应该创建一个像 127.0.0.1/192.168.1.10

这样的别名

或者我可以将 192.168.1.10 粘贴到顶部作为

192.168.1.10
127.0.0.1 localhost
127.0.1.1 SparkVM104

感谢任何帮助。

问候。

最佳答案

/etc/hosts 的格式是

IP_address canonical_hostname [aliases...]

(参见 http://linux.die.net/man/5/hosts ),因此要首先列出 192.168.1.10,/etc/hosts 文件必须如下所示:

192.168.1.10    SomeHostName    SomeOtherHostName
127.0.0.1 localhost

关于java - 虚拟机中的本地主机地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10894955/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com