1

My raspberrypi is not connecting to internet.

I am trying to connect it to laptop internet through ethernet but its not working.

It shows following configuratoion error.

sudo ifdown eth0 && sudo ifup eth0

ifdown: interface eth0 not configured

SIOCADDRT: File exists

Failed to bring up eth0.


I have made following changes in interface and ifconfig output is also attached.

enter image description here enter image description here

alia
  • 11
  • 1
  • 4
  • The `ifconfig` output shows an IP address of `192.168.0.1`. In what sense are you not connected? – goldilocks Mar 30 '18 at 13:01
  • I can't browse anything. – alia Mar 30 '18 at 13:17
  • sudo ifdown eth0 && sudo ifup eth0 ifdown: interface eth0 not configured SIOCADDRT: File exists Failed to bring up eth0. – alia Mar 30 '18 at 13:21
  • 1
    *"I can't browse anything..."* -> You need to be more explicit about the errors you receive. It does not say, "Sorry you can't browse anything", it says, (e.g.) "Connection refused" or "Network is unreachable". Those messages mean different things. – goldilocks Mar 30 '18 at 14:43
  • The ifconfig output contradicts the ifup/down output. I presume they are from two different points in time; when that picture was taken, you were online. If you changed anything after that you might want to undo it. – goldilocks Mar 30 '18 at 14:45
  • And fix the nameserver statement. it should be "resolv.conf" not "resol.conf". I'd also guess that you have dhcpcd running. Reboot the Pi and dhcpcd won't start and then what's in /etc/network/interfaces will work – mkomarinski Mar 30 '18 at 17:00
  • @mkomarinski, I have corrected "resol.conf" to "resolv.conf" and rebooted the Pi. Still, does not work: _ping -c 1.8.8.8.8 connect:network is unreachable ping www.google.com ping:www.google.com:Temporary failure in name resolution_ – alia Mar 30 '18 at 19:12
  • @goldilocks, _ping -c 1.8.8.8.8 connect:network is unreachable ping www.google.com ping:www.google.com:Temporary failure in name resolution_ – alia Mar 30 '18 at 19:18
  • @goldilocks: yeah, my bad. I was offline when I checked ifup/down. eth0 is configured but still problem is the same. – alia Mar 30 '18 at 19:20
  • I presume that's supposed to be `-c 1 8.8.8.8`, not `-c 1.8.8.8.8`. Anyway, if eth0 is up and has an address, the problem is more likely to be with the laptop configuration. Unless you've really put an `echo` in there, which might just invalidate the whole thing: https://manpages.debian.org/jessie/ifupdown/interfaces.5.en.html Unfortunately I have my own system for configuring networking so I am not much help with the conventional one. – goldilocks Mar 31 '18 at 12:40

1 Answers1

1

You obviously didn't read the contents of the interfaces file, before modifying it.

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf

See How to set up networking/WiFi which contains default files for Jessie and Stretch, although in Stretch the interfaces file does nothing and can be deleted.

The following describes How to set up Static IP Address

In addition there is NO POINT in including bash commands in interfaces

Milliways
  • 54,718
  • 26
  • 92
  • 182
  • I am a very much beginner at using Pi. I was just going through some online asked questions/ tutorials and trying to connect internet. I don't want to give a static IP(It was just like try everything. Something will work at last). Can you please guide me in simple words?? Thing I want is: **Connect an ethernet to pi and laptop** **Whatever wifi signals laptop is catching, connect pi to them**. What changes should I do for it??? – alia Mar 31 '18 at 07:33
  • If you read the linked tutorial this outlines step by step how to setup. I keep this updated as the OS changes. If you have any specific question ask. I don't know what " Connect an ethernet to pi and laptop" means. The Pi, like most computers, is designed to **connect to a router** – Milliways Mar 31 '18 at 07:46
  • I want to share my laptop internet with pi. – alia Mar 31 '18 at 08:03
  • or I want to make a wifi connection. I can't connect pi to router through ethernet as it is not feasible for me. – alia Mar 31 '18 at 08:21