0

I am unable to connect to internet. All configuration are correct. whenever I start my system I need to do the following configuration.

Log in to root,

cd /etc
nano resolve.conf

then I write the following things.'

name server 127.0.0.1
name server 8.8.8.8
name server 198.168.1.1

Then internet is working I don't know why this is happening may be DNS problem. So how can I solve this issue.and why this is happening.

smali
  • 574
  • 1
  • 7
  • 17
  • 2
    Hi! TBH, I don't know what you meant by network.config but I certainly know that you will need to edit resolv.conf file to assign DNS. BTW, could you please tell me whether you've assigned a static IP by assigning manually or is it taking through DHCP? – AzkerM Jun 17 '14 at 05:02
  • before it is taking from DHCP but now i changed it to static. – smali Jun 17 '14 at 05:04
  • I see.. Could you also say whether you added it via terminal or GUI (graphical interface)?? I mean the network manager applet on top. – AzkerM Jun 17 '14 at 05:06
  • no from terminal actually thats why by mistake i written network.conf i changed the interfaces file and kept it static. – smali Jun 17 '14 at 05:10

2 Answers2

2

By looking at your comment you've said that you changed it to static via terminal. Assuming that; you've two ways where you can achieve which will be permanent even when you reboot the system.

  1. First is via terminal by adding an additional line to specify DNS
  2. Assigning manual IP's via GUI whilst setting the interface to default (reverting back network config)

Since you've used terminal, you may add below line to your /etc/network/interfaces file. Add it to the end of the file

dns-nameservers 127.0.0.1 8.8.8.8

You don't need to add your gateway as a DNS. You may add above two DNS with a space between the two. Also, below seen is a sample configuration of an interface.

auto eth0                                      # add this to auto up on boot
iface eth0 inet static
    address 192.x.x.x
    netmask 255.255.255.0
    gateway 192.x.x.x
    dns-search example.com                     # This is for windows AD environment
    dns-nameservers 127.0.0.1 8.8.8.8

As you can see, the attribute dns-search example.com is for Windows Active directory environment. You can remove that line.

Once done. Please restart you network interface using below command.

sudo /etc/init.d/networking restart

and then view the resolv.conf file with cat /etc/resolv.conf which should show the DNS configuration. You may also reboot and have a look through.

Hope this helps! :)

AzkerM
  • 10,270
  • 6
  • 32
  • 51
0

For Quick Solution Just type the following command in the terminal.

sudo /sbin/dhclient

smali
  • 574
  • 1
  • 7
  • 17