I'm trying to set a Static IP for my Raspberry Pi 3 Model B+ and I have been referring to the following documentation:
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:
Jul 27, 2015 - This page is may need to be merged with other page(s) including RPi Setting up a static IP in Debian. Please help to merge the articles,. Having a static IP address is particularly helpful if you want to run your Raspberry Pi as a headless server (with no screen or keyboard). It is also needed if you run it as a DNS server, because your other devices need to be given a single IP address that they will hit for DNS requests.
In my /etc/dhcpcd.conf, I see some IPV6 configurations like this:
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?
sparkrsparkr
1 Answer
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
MilliwaysMilliways
protected by Community♦Mar 26 at 8:51
Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count). Would you like to answer one of these unanswered questions instead?
Not the answer you're looking for? Browse other questions tagged pi-3wifi or ask your own question.
≡ PagesFavoritedFavorite11
Ethernet with Static IP Address
If you do not want to use the serial terminal or want to be able to log in to your Raspberry Pi over a network connection, you can give your Pi a static IP address, connect it to your network (or to your computer via a crossover/Ethernet cable), and log in via SSH.
Note: Windows and Mac cannot access the filesystem partition of the Raspberry Pi image on the SD card. As a result, you will need access to a computer with a Linux operating system. If you don't have a Linux computer nearby, you can make a Live CD (or bootable USB drive) to temporarily boot into Linux to make the necessary file changes on the SD card. Once you have edited the necessary files, you can switch to another operating system.
Set Up Static IP Address
Plug the micro SD card (with the flashed Raspbian image) into your Linux computer. Most modern versions of Linux should automatically mount both partitions (boot and rootfs). You will need superuser privileges to edit the files on rootfs. Open a command prompt and edit /etc/dhcpcd.conf in rootfs.
Navigate to the rootfs directory (wherever your Linux distro has mounted it):
Edit the dhcpcd.conf file:
Scroll down to the bottom of the file and add the following lines:
Save and exit by pressing ctrl + x and y when asked if you would like to save.
Enable SSH
In 2016, much of the Internet slowed to a crawl as a result of the IoT DDoS attack brought about by the Mirai botnet. In response to vulnerable IoT systems with default username and password logins, the Raspberry Pi Foundation decided to disable the SSH connection by default on all future releases of Raspbian. As a result, we now need to enable SSH so we can log in over a network connection. You can read more about the reasonings for this here.
Luckily, this is easy to do. With the SD card still plugged in, navigate to the boot partition and create a blank file named 'ssh' in that directory.
Still in the console, enter the following commands:
You should see an empty file named 'ssh' appear in the root boot partition.
Unmount the SD card from your host computer and insert it into the Raspberry Pi.
Configure Your Host Computer's IP Address
Plug an Ethernet cable into the Raspberry Pi and the other end into your computer. Technically, we should be using a crossover cable, but since the late 1990s, most computers are capable of automatically detecting and configuring for crossover.
Configure your host computer to have an Ethernet static IP address with the following properties:
Instructions to set up a static IP address for the following operating systems: Windows, Mac, Linux (Ubuntu).
Connect Over SSH
Secure Shell (SSH) gives us a terminal into an operating system over a network and encrypts the traffic, giving us a level of security. Depending on your host operating system, you have a number of options available to you.
Windows
PuTTY is an easy-to-use SSH, Telnet, and Serial terminal client. Open PuTTY, and set the Host Name to 192.168.4.2 and Port to 22.
Click Open. If asked about chaching a host key, click Yes.
Mac and Linux
The easiest way to connect to another computer over SSH is to use the ssh command line tool built into most distributions of Linux and Mac OS. Simply open up a terminal and type:
Log In
Once SSH connects, enter the default login credentials:
Username: pi
Password: raspberry
You should be presented with a command prompt, if all goes well.