Page 1 of 1

How to remove NAT static IP

Posted: 11. Feb 2015, 00:04
by SK121231231231231
Hello,

I have a Linux Guest from Oracle training, on my Win7 laptop. Whenever I start it up, it gets some static IP assigned to it like 10.0.2.15. This is causing the guest to not able to reach internet.

Wondering if there is a way to remove the static IP, and let it use the IP address from the host OS.

Thanks

Re: How to remove NAT static IP

Posted: 11. Feb 2015, 00:24
by dlharper
That is the standard NAT address. NAT works by the host translating (that is what the "T" stands for) between that address and another address for the Internet. It doesn't prevent Internet usage at all.

What makes you think this is causing your problem?

Re: How to remove NAT static IP

Posted: 11. Feb 2015, 02:11
by SK121231231231231
The problem is, as I said, I cannot ping anything outside. I cannot reach out to any website on the internet from the VM.
My host laptop is connected to my home network, I can reach everything from host laptop but nothing from guest VM.

Here is the output from ifconfig and and ping commands. I just tried getting the IP address of www.yahoo.com using ping from host laptop, and then tried ping that IP address from VM and it worked. So, the problem is it is not able to resolve the IP address using the name. So, is it possible it is not able to reach the DNS server? If so, how to start or point to it?

$ ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:A9:7F:DE
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fea9:7fde/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:34 errors:0 dropped:0 overruns:0 frame:0
TX packets:107 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6711 (6.5 KiB) TX bytes:8643 (8.4 KiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:5453 errors:0 dropped:0 overruns:0 frame:0
TX packets:5453 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:8603860 (8.2 MiB) TX bytes:8603860 (8.2 MiB)

$ ping www.yahoo.com
ping: unknown host www.yahoo.com
$ ping 98.139.183.24
PING 98.139.183.24 (98.139.183.24) 56(84) bytes of data.
64 bytes from 98.139.183.24: icmp_seq=1 ttl=53 time=22.3 ms
64 bytes from 98.139.183.24: icmp_seq=2 ttl=53 time=22.6 ms
64 bytes from 98.139.183.24: icmp_seq=3 ttl=53 time=26.4 ms


I also tried doing this, but it didn't work:
VBoxManage modifyvm "VM name" --natdnsproxy1 on
VBoxManage modifyvm "VM name" --natdnshostresolver1 on

Re: How to remove NAT static IP

Posted: 11. Feb 2015, 06:35
by BillG
I don't know what is wrong with your particular installation, but normally NAT, which is the default setup, "just works"! If it doesn't, I doubt that any of the things you tried will make it work.

My first step would be to reinstall VirtualBox. Perhaps something went amiss when it was setting up networking. You will not need to reinstall the vm.

Re: How to remove NAT static IP

Posted: 12. Feb 2015, 00:48
by SK121231231231231
I tried re-installing the VM and Virtual box. No difference.
It couldn't be a problem with the VirtualBox because, I am able to use the NAT network fine in another VM.

What else can we do, to fix this issue? Is there no way to point to the host DNS server?

Re: How to remove NAT static IP

Posted: 12. Feb 2015, 01:46
by Perryg
I would like to see the guests log file, *.vbox file and the contents of the guests /etc/resolv.config file

Re: How to remove NAT static IP

Posted: 17. Feb 2015, 14:48
by SK121231231231231
RESOLVED!!

The problem is in /etc/nsswitch.conf

There is an entry in there like this: "hosts files"
this should be changed to: "hosts files dns"

after this, my VM can ping and access internet.