Friday, July 3, 2015

DNS problem after static ip (solved) (updated)

After i changed my ip from dynamic to static
i had found that the Rpi is connected well with local network
but cant connect to internet

the solution of this problem is in these few lines


One last thing that needs to be modified is the /etc/resolv.conf file.  This file contains information of DNS name resolvers that allow your raspberry pi to resolve names to IP addresses.  For example, if you ping www.suntimebox.com the raspberry pi will have to determine the IP address of www.suntimebox.com.
Enter the following command to edit the resolv.conf file.
sudo nano /etc/resolv.conf
Enter the follow Google public dns server IP address.
nameserver 8.8.8.8
name server 8.8.4.4
Press CTRL-X to exit but remember to save the file by accepting the changes.

since i had found that after restart connection with Rpi these configuration lost
i forced the raspy to add these lines every startup and reboot by adding these two lines to the file rc.local before exit 0

    sudo nano /etc/rc.local

then adding these two lines before exit 0

    echo 'nameserver 8.8.8.8' >> /etc/resolv.conf;

    echo 'name server 8.8.4.4' >> /etc/resolv.conf;

to be the final view of rc.local file 



source of solution is from here
 http://www.suntimebox.com/raspberry-pi-tutorial-course/week-3/day-5/

this site is very wander full for whom are beginners in linux or raspberry pi


No comments:

Post a Comment