Search code examples
javalinuxnetwork-programmingjmf

Localhost address in the Virtual Machine


I am using a virtual machine on a server. My local IP of the VM is 192.168.1.10

I am trying to achieve something which requires me to edit my /etc/hosts as provided in this link

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

I am having similar problems, My console reads

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)

And some more.

The answer to the problem given is

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.

Unfortunately, I cant make out what He is trying to state. My /etc/hosts read

127.0.0.1    localhost
127.0.1.1       SparkVM104

So am I supposed to change 127.0.0.1 with my 192.168.1.10

or am I supposed to create an alias like 127.0.0.1/192.168.1.10

or Shall I just paste 192.168.1.10 in the top as

192.168.1.10
127.0.0.1    localhost
127.0.1.1       SparkVM104

Any help is appreciated.

Regards.


Solution

  • The format for /etc/hosts is

    IP_address canonical_hostname [aliases...]
    

    (see http://linux.die.net/man/5/hosts), so to list 192.168.1.10 first, the /etc/hosts file would have to look like this:

    192.168.1.10    SomeHostName    SomeOtherHostName
    127.0.0.1       localhost