0

I'm trying to set a Static IP for my Raspberry Pi 3 Model B+ and I have been referring to the following documentation:

https://www.raspberrypi.org/learning/networking-lessons/rpi-static-ip-address/

I want to have a static IP for my Pi when I connect it via a WiFi or a LAN cable. I basically want both the options to have the same Static IP. What I do not understand is the following:

In my /etc/dhcpcd.conf, I see some IPV6 configurations like this:

#interface eth0
#static ip_address=192.168.0.10/24
#static ip6_address=bc62:31d6:abzu:b92a::ee/53
#static routers=192.168.0.1
#static domain_name_servers=192.168.0.1 8.8.8.8 bc62:31d6:abzu:b92a::1

Can I completely remove the ip6_address? In the documentation link that I posted above, there is something related to wlan0 - Is this the setting related to WiFi?

joesan
  • 159
  • 2
  • 2
  • 7

1 Answers1

1

If you really MUST How to set up Static IP Address shows how to do it.

You CAN NOT set 2 interfaces to have the same address. Again if you REALLY want to use the same static IP address for interfaces if only 1 is connected you can use a fallback See How to set up networking/WiFi but this is not a great idea - you would NEED to stop WiFi from connecting.

I feel obliged to point out that there is no NEED to set static IP addresses - I haven't done this since 1980, unless configuring a DHCP server. I don't know what the IP of my 7 Pi or 3 Macs or other devices are, and don't care - I access them by name, and make the routers do their job!

You can remove ip6 if you aren't using them - there is even less need for static ip6 addresses

Milliways
  • 54,718
  • 26
  • 92
  • 182
  • 1
    The plan is for me to set up a Kubernetes cluster on my RasPi's. I will be having 7 of them booted up and I think from an operation point of view, I thought it might make sense to have a static ip for all of them. Could you please justify why there is no need for a static ip? I appreciate your comments! – joesan Apr 21 '18 at 07:33
  • There are several reasons. 1. the most important if you ever need to use a different network (at a different place - I take my Pi to friends houses, or just change ISP) you have to change everything. 2. I have a fist full of SD Cards - I can plug any one into any Pi, copy them etc, which is difficult if each is set to a static IP. If you are running a cluster that is never going to move this may be one of the few valid exceptions. – Milliways Apr 21 '18 at 07:46
  • I have just worked on too many networks over the years, and people who try to pick an IP just create problems - virtually all networks have a DHCP server, and this can be configured to always give the same IP to specified MAC. – Milliways Apr 21 '18 at 07:47
  • Is there a way to ssh using the host name? I don't want to set a static ip, but I would like to ssh using the hostname? I guess I could do this or? – joesan Apr 21 '18 at 07:57
  • I did just change the hostname and I can now ssh into my pi using pi@myhostname.local – joesan Apr 21 '18 at 08:03
  • To me this way of logging into the pi via ssh is more than enough. I can now configure 7 of them and give them names accordingly such that I don't have to care about the ip addresses anymore! Hence I do not need to assign a static ip address anymore! – joesan Apr 21 '18 at 08:04
  • Bravo! @Milliways is correct; DHCP is a time-saver, and makes more sense on **MOST** networks. And wrt your other question: "Could you please justify why there is no need for a static ip?", the short answer is **MAC address**; that's what's used to communicate in your Kubernetes cluster, and in fact on any IP network. – Seamus Apr 21 '18 at 12:34
  • @Milliways - You are categorically wrong in stating that "there is no NEED to set static IP addresses". If you are running in environments where there is no DHCP server, then a static IP is required. – John Percival Hackworth Jan 03 '19 at 19:45