0

I have switched Internet Providers recently and for some reason I now get no internet connection on my Ubuntu server 12.04.2 LTS VM running within VirtualBox. My host machine is Win7 64b.

I do get an Internet connection if I set interfaces to DHCP but if I set it to static I only get the LAN connection. I can connect to the VM via SSH, I can share folders but there is no Internet connection (no response from nslookup google.com).

/etc/network/interfaces

# The loopback network interface    
auto lo

iface lo inet loopback

# The primary network interface
auto eth0

iface eth0 inet static    
#iface eth0 inet dhcp     
address 192.168.1.4    
netmask 255.255.255.0    
network 192.168.1.0    
gateway 192.168.1.255

ifconfig

> eth0      Link encap:Ethernet  HWaddr 08:00:27:a1:3a:37
>           inet addr:192.168.1.4  Bcast:192.168.1.255  Mask:255.255.255.0
>           inet6 addr: fe80::a00:27ff:fea1:3a37/64 Scope:Link
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:320 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:100 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:1000
>           RX bytes:30767 (30.7 KB)  TX bytes:16032 (16.0 KB)
> 
> 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:12 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:0
>           RX bytes:720 (720.0 B)  TX bytes:720 (720.0 B)

The internet can be accessed from the VM once the name servers have been changed within as follows:

/etc/resolv.conf

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 194.168.4.100
nameserver 194.168.8.100

and the machine has been rebooted.

The question is how to configure a name server within /etc/resolv.conf so it persists within this file after a reboot.

0

1 Answer 1

2

Add:

dns-nameservers 194.168.4.100
dns-nameservers 194.168.8.100

to your /etc/network/interfaces file under the eth0 settings.

1
  • I added dns-nameservers 192.168.1.254 which is the gateway ip. Thanks
    – AntonioCS
    Sep 14, 2014 at 9:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .