Solved

networking between real and virtual hosts

Posted on 2010-08-30
10
827 Views
Last Modified: 2013-12-06
I have LAN connecting 2 linux ( fedora and ubuntu)  machines via a DSL router/switch combo. I am able to connect to internet on both machines.

I have a local web application running in fedora:
http://localhost:8282/myproj and works fine and shows me program results when opening browser
with that address in fedora.

But when I enter the address:
.
http://192.168.1.34:8282/myproj in a browser in ubuntu host I get no connection error. 192.168.1.34 is ip address of fedora machine.  From ubuntu I can do ping 192.168.1.34 and works fine no packet loss.


Please tell me how do I make this connection to work in ubuntu?

In fedora I have setup virtual windows vista os (VM) as guest os using virtualbox and it works fine and I can connect to internet in windows vista vm. I used bridged networking option for network type setting for windows vista vm.

In windows vista VM I have the same problem with
http://192.168.1.34:8282/myproj  as i get not connection error in browser.
Also even ping 192.168.1.34 does not work in vista VM ( 100% packet loss).

How do I make above connection to work in VM ?  I know this is more advanced question than the first one.





0
Comment
Question by:zenguru
  • 5
  • 5
10 Comments
 
LVL 5

Expert Comment

by:stermeau
ID: 33557168
Could you post the output of the following commands ran on your fedora server:
   netstat -anpA inet | grep 8282
   iptables -L -n
0
 

Author Comment

by:zenguru
ID: 33557280

netstat -anpA inet | grep 8282  does not generate any output but
netstat -anpA inet  gives lot of output but dont see 8282 in it.


 iptables -L -n  gives this:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination        
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED
ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0          
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0          
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0           state NEW udp dpt:631
ACCEPT     udp  --  0.0.0.0/0            224.0.0.251         state NEW udp dpt:5353
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:631
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0           state NEW udp dpt:631
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0           state NEW udp dpt:161
REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination        
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           PHYSDEV match --physdev-is-bridged
REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination        




I hope this helps.
0
 
LVL 5

Expert Comment

by:stermeau
ID: 33557303
ok, could you try with "netstat -anp | grep 8282" ?

Also your firewall is not accepting connections on port 8282.
Run the following to allow conections to port 8282:
iptables -I INPUT -p tcp --dport 8282 -m state --state NEW -j ACCEPT
0
 

Author Comment

by:zenguru
ID: 33557480

netstat -anp | grep 8282 gives me:
tcp        0      0 ::ffff:127.0.0.1:8282       :::*                        LISTEN      5586/java

I will wait your reply before typing the firewall related command in your post so that I dont mess something.
0
 
LVL 5

Accepted Solution

by:
stermeau earned 500 total points
ID: 33557517
Well, the netstat output tells you that your application is listening on 127.0.0.1 ( or localhost ).
In this case you application can only accept connections for the PC/server where it is instaleld.
You have to listen ( or bind ) to 192.168.1.34.
You should also allow the connection in the firewall with the command I gave you before.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:zenguru
ID: 33557674
Thanks. How do I bind 192.168.1.34 so that my application can accept connection from any host on LAN or from guest os VM host ?
0
 
LVL 5

Expert Comment

by:stermeau
ID: 33557769
It depends on you application...
If it is a standalone application you must have a call to a function like 'accept' or "listen".
You can also serach for "127.0.0.1" or "localhost" in the source code.
What programming language do you use?
Maybe you should post the code of your application.
0
 

Author Comment

by:zenguru
ID: 33558040
Sorry I should have made this clear before. The application is a java application running in tomcat webserver. It can be any simple JavaEE application based on Java servlet. For example it can be just  java servrlet doGet (handle http get request) method display message 'Hello World" when going to:
localhost:8282/myproj

Within my java application there is no reference to localhost or 127.0.0.1. I am using Intellij Idea IDE which allows me launch configuration of my java web application such as port number 8282 when I click Run or Debug. Intellij IDEA then passes this info to embedded tomcat server.

So still I am clueless. I thought there would be some linux commands that I enter to do the ip address binding instead of configuring locally running tomcat webserver in which I don have much background.
I execute the firewall related command but still same issue. In fedora I get the message hello world but any other host on LAN or VM host I get the no connection error.




0
 
LVL 5

Expert Comment

by:stermeau
ID: 33558160
I don't know Intellij IDEA so I can't tell for sure maybe their is a parameter to tell tomcat to listen to a specific IP.
0
 

Author Comment

by:zenguru
ID: 33559000
When I change localhost to 192.168.1.34 in the tomcat  launch configuration for hostname in intellij IDEA and after using the command you gave:
iptables -I INPUT -p tcp --dport 8282 -m state --state NEW -j ACCEPT

then I am able to access the address :
http://192.168.1.34:8282/myproj  from ubuntu , VM and of course from fedora as well.
But now I cant access  http://localhost:8282/myproj from fedora because tomcat is now serving content on the ip address of fedora machine.

But I cant understand why localhost does not work. Some one has done this from googling but the intstructions were specific to IIS on Win XP and incomplete.

Also I dont know what is the implication of using the ip address of fedora machine as the address on which tomcat now serves the content. Does that mean I could use any local area network address for tomcat or for any locally running web server for that matter?








0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
PRTG Network Monitor lets you monitor your bandwidth usage, so you know who is using up your bandwidth, and what they're using it for.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now