I set up a Ubuntu server in VirtualBox following these guides:

The connection worked, including SSH. I signed up at dyndns.com and configured the router to use DynDNS.

My ports were open and accepting connections but I didn't have connections from the server in VirtualBox any more. My port forwarding settings in VirtualBox are:

  • Host IP: 127.0.0.1
  • Host port: 2222
  • Guest port: 22
  • Guest IP: 192.168.0.2

I'm not sure if I'm using the correct address in /etc/network/interfaces; I'm using 192.168.0.2 for this as well as for the firewall rules in the router and the host machine address. I also added this address in the server's /etc/resolv.conf and /etc/mysql/my.cnf.

After resetting the router the open port result was "refused" and from troubleshooting I found:

"The IP address of your hostname does not match the IP address of your server, that’s very likely the entire problem."

(I must mention that I have used and configured ddclient)

Do I have to change the address from the server? If so, how can I do that, and which address?

EDIT:

I changed the contents of /etc/network/interfaces to:

auto lo iface lo inet loopback
auto etho iface eth0 inet dhcp

I restarted and can now ping from the virtual server! The port is now open (from DynDNS).

I edited the file again and put:

auto lo   
iface lo inet loopback

auto eth0    iface eth0 inet static  
address 10.0.2.15
netmask 255.255.255.0
network 192.168.0.0
broadcast 10.0.2.255
gateway 192.168.0.1

However the connection doesn't work again now from the virtual server.

I don't know what to put in /etc/resolv.conf.

In /etc/mysql/my.cnf I put:

bind-address  10.0.2.15

And in /etc/hosts I put:

10.0.2.15

Is that right?

In the router at the inbound services what address should I put? I currently have 192.168.0.2 which is the address from the host machine.

EDIT 2:

I tried bridged networking and have some results:

  1. I can ping from host to guest(server) and vice-versa
  2. I can ping addresses from the guest(server) but when I try apt-get update doesn't work
  3. I put from the router's firewall rules -> inbound services:

    service http:80, allow always, LAN server IP address:192.168.0.2
    

    and now the port is open.

What should I do now?

link|improve this question
1  
Gareth cleaned up your post but it's still very hard to understand what your real problem is. You might consider removing all that is not necessary anymore -- I guess it's just a little too much information. – slhck Aug 21 '11 at 13:24
feedback

migrated from stackoverflow.com Aug 21 '11 at 12:15

This question came from our site for professional and enthusiast programmers.

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown