5

This question already has an answer here:

Ok so I have followed many tutorials and when I get to the point

"sudo nano /etc/network/interfaces

Remove the line that reads

iface eth0 inet dhcp"

I do not get the above line the only similar line is

iface eth0 inet manual

I end up just going along and deleting and replaceing the above line but when I try to ping gateways ip address it fails.... any suggestions?

marked as duplicate by goldilocks Nov 5 '15 at 8:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • @goldilocks Not really a duplicate, as the other was posted later, admittedly partly inspired by this question. – Milliways Nov 5 '15 at 8:44
  • Duplicates don't have lead into the past. Ideally, the closed questions work as sign posts leading to a canonical answer, potentially in chains, and these can be rearranged (although it takes either a mod hammer, or a sufficiently large group of users working in concert via chat to do so; unfortunately the "one size fits all" system makes the latter unlikely to happen here). – goldilocks Nov 5 '15 at 8:58
7

All of these "tutorials" are obsolete. (Note they can still be used if you want to use the older style of manual configuration, but this requires detailed knowledge.)

If you are running a recent Raspbian /etc/network/interfaces should be as below. If you have changed it PUT IT BACK.

auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet manual

auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

auto wlan1
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Edit /etc/dhcpcd.conf as follows (extract from man dhcpcd.conf):-

 Configures a static value.  If you set ip_address then dhcpcd will not attempt to obtain a lease
 and just use the value for the address with an infinite lease time.

 Here is an example which configures a static address, routes and dns.
       interface eth0
       static ip_address=192.168.0.10/24
       static routers=192.168.0.1
       static domain_name_servers=192.168.0.1

PS I still think setting up a static address is almost always the wrong thing to do. If possible set a static reservation in your router (if possible) or use a zero-conf such as avahi

  • Well the reason I want my pi's to have a static ip is because I am trying to get them to communicate to each other. I kept hitting hiccups and thought that it might be because the ip address was changing. I appreciate the advice and I will try it out – Don Whittington Nov 5 '15 at 13:34
  • Can I still use cmdline.txt? – Rendicahya Feb 27 '16 at 2:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.