2

i have used "sudo nano /etc/dhcpcd.conf" and added static address, after reboot the raspberry pi shows static address in ifconfig and i can also access it using putty, but it is not able to connect to the internet. i have checked the router and this device does not show up. I am sure there is nothing wrong with the router or cable as i was able to access internet before setting the static ip address.

ifconfig before setting static ipifconfig

lines i have typed..

"interfaces eth0
static ip_address=192.168.1.150
static routers=192.168.1.1
static domain_name_servers=192.168.1.1"
Owaiz Sahreef
  • 41
  • 1
  • 5
  • "no internet" is SUCH a vague expression. What's the output of traceroute -n 23.100.122.175 and ping google.com – Jaromanda X May 19 '16 at 23:59
  • had the same problem. wrote 'domain_name_server' instead of 'domain_name_servers'. typo. – Gilad Oct 03 '17 at 19:29

2 Answers2

1

You have not provided sufficient information to give a definitive answer. You should post what ifconfig shows BEFORE attempting to set static (or get this form another computer).

There is at least one obvious error; an incomplete CIDR address. See How do I set up networking/WiFi/Static IP

Address should be

static ip_address=192.168.1.150/24

The comment about DNS is probably wrong. You may want to use Google's DNS, but you would be far better to use that provided by your ISP. In many cases what you had is correct as the router handles this.

To discover what DNS is in use run cat /etc/resolv.conf and note the nameserver

PS WHY do you want to set a static IP address?

Milliways
  • 59,890
  • 31
  • 101
  • 209
  • i have added ifconfig info before setting static ip pls check – Owaiz Sahreef May 19 '16 at 23:18
  • i am building a cluster of raspberry pi, have to use MPI, so setting a static ip will avoid lot of confusion – Owaiz Sahreef May 20 '16 at 01:00
  • When do ISPs run dns servers on local IP addresses? I've never seen that happen in the consumer world before? – Mohammad Ali May 20 '16 at 12:25
  • @MohammadAli They don't. You need to learn more about routers before offering advice to others. In general the router knows the DNS (from the ISP) and routes requests from clients. – Milliways May 20 '16 at 12:34
  • I've never really seen that happen too often, I guess it varies as to where on the world you are as ISPs where I live never offer free dns services, but I see what you mean – Mohammad Ali May 20 '16 at 12:49
0

It is because you are using an incorrect dns please change the line below to reflect upon a valid dns service.

static domain_name_servers=192.168.1.1

An example of a valid fans would be googles free public fans located at 8.8.8.8, so to use googles fans service you would change that line to the following:

static domain_name_servers=8.8.8.8
Mohammad Ali
  • 2,383
  • 1
  • 11
  • 18