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

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
  • 62,573
  • 32
  • 113
  • 225
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,373
  • 1
  • 12
  • 18