Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have Ubuntu 12.04 Server installed in VMWare Workstation 10.0 on host Windows 8.1

/etc/network/interfaces

configuration is as follows.

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
    address 192.168.171.132
    netmask 255.255.255.0
    gateway 192.168.171.1

and Network Adapter is set to Custom: VMnet 8 (NAT)

From Windows, my host, I can see that VMNet 8 has IPv4 : 192.168.171.1 that should be the gateway in /etc/network/interfaces and that is.

If I set it to DHCP, I can connect to internet from VM and get assigned an IP of 192.168.171.131

But the problem is that I cannot connect to internet when I set it static.

Please tell me where I am getting wrong?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

If you set a static IP address in /etc/network/interfaces, you are also responsible to set up DNS nameservers. I suggest you try:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.171.132
netmask 255.255.255.0
gateway 192.168.171.1
dns-nameservers 8.8.8.8 192.168.171.1

Then get the system to re-read the file and use the changes:

sudo ifdown eth0 && sudo ifup eth0

Check:

ping -c3 www.google.com
share|improve this answer
    
Why you added 192.168.171.1 to dns-nameservers? What else we can use? –  Umair Ayub May 5 at 9:01
    
I added the gateway address because the router or other access point gets DNS nameservers from your internet service provider and is therefor a reliable fallback. You can use any DNS you wish. You might look into the package namebench. It tests and recommends fast DNS nameservers. code.google.com/p/namebench –  chili555 May 5 at 12:19

Instead of using 192.168.171.1, use 192.168.171.2. In VM 10, if you click on Edit, Virtual Network Editor, select VM8, under VMnet Information, select NAT, click on NAT Settings and there you'll find what your GW IP address is set to. When you find it, adjust your "eth0" gateway IP to that IP address.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.