Need help setting up a static ip on my Raspberry Pi 3

I feel like I’ve tried every tutorial out there and I still cannot make this work.

Can anyone shed some light on this topic?

Modify /etc/network/interfaces

auto eth0
iface eth0 inet static

restart your network.

I’d like to do it for wifi. Do I just substitute eth0 with wlan0?

No … modify /etc/dhcpcd.conf

interface wlan0
static routers=
static domain_name_servers=

if you changed /etc/network/interfaces, bring it back to the original configuration.

Thanks for your help, but that doesn’t seem to work.

Using ifconfig, the ip address hasn’t changed at all.

I’d probably do this on the router (or whatever dhcp server you’re using) by MAC address.

1 Like

So I’m in student housing at my university. I don’t own the router or have any permission to modify things. Is it still possible to do this?

If you cannot control the IP addresses given out by the dhcp, how will you know you’re not assigning yourself an IP address that is used by something else?

1 Like

Why do you need a static ip?

In a University, any ip is good so you can do your work. The same applies in the student housing.

But consider this…

Typically you only need a static ip address in a server application. This all works well in a home network where you have a router and access to the router settings. It becomes more difficult on a public network.

I’m building a robot that uses a RPi3. A dynamic ip makes it really hard to continually SSH into it to work on the robot. It’d be nice to have a static one so that I can leave the pi inside the robot while I work on it over the next month.

Does your Pi have to have internet access, or could you use it as a access point?

It does not have to have internet access. I just need to be able to execute a python program remotely.

Sounds like setting it up as a access point would be perfect for you then. Maybe even preferable. Doing so would allow you to SSH into the Pi using it’s static IP address.

If you're using Ubuntu 18.04, then modifying /etc/network/interfaces or dhcpcd.conf won't work.
Because netplan is the new network manager. You need to add a yaml file.
I recommend you read this article:

hope it helps. worked for me