虚拟机中的本地主机地址

问题描述:

我正在服务器上使用虚拟机。 我的本地虚拟机的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) 

而且更多一些。

答案给定的问题是

我解决了这个一个。问题是JMF似乎不管用 InetAddress.getAllByName()返回(至少在我的情况)只 单个IP地址我有多少地址在我的 接口定义。通过将会话管理器想要使用的IP地址放在/ etc/hosts中解决了问题。它必须是/ etc/hosts中的第一个 行,否则将使用匹配的其他行。

不幸的是,我不能做什么,他正试图状态。我/etc/hosts阅读

127.0.0.1 localhost 
127.0.1.1  SparkVM104 

所以我应该改变127.0.0.1192.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  
+0

您的推荐与您的引用不符。 – EJP

+0

@EJP你想介绍一下吗? – aha

+0

引用中的示例显示'localhost'映射到'127.0.0.1',并将外部主机名映射到外部IP地址。这是可以工作的配置。你的不会。 – EJP

在/ etc /主机,本地主机应该映射到127.0.0.1,没有别的,你的外部主机名到你的外部IP地址,没有别的。据称一些Linux发行版违反了这一规则,并破坏了一切。