Static IP Adress for WiFi and Cable....is DONE

Hello dear Team.
I need for Octoprint a Static IP Adress by cable and WiFi.

I have searched all over the internet for a guide to assign a fixed IP address.
I need a short guide to reach my two printers over a fixed IP.
Thanks in advance for your help.

Volker

Can we assume that you have installed OctoPrint on a Raspberry Pi 3B using the OctoPi image? If not, then we would need to know what kind of computer this is running on.

Assuming "yes" to that question...

Raspbian now uses the wpa_supplicant and dhcpcd deamons. More

sudo nano /etc/dhcpcd.conf

For example:

       interface eth0
       static ip_address=10.1.1.30/24
       static routers=10.1.1.1
       static domain_name_servers=10.1.1.1

       interface wlan0
       static ip_address=10.1.1.31/24
       static routers=10.1.1.1
       static domain_name_servers=10.1.1.1
2 Likes

Are you referring to a static IP address you can use within your home network?

Or a static IP you can use to access OctoPrint over the internet from outside your home network?

Regardless of the above scenario, it will also be helpful to know what kind of router/gateway you are using on your home network.

It may be easier to just set up a DHCP reservation in your router rather than having you edit the Debian configuration files. Of course, that's up to you. If you're comfortable editing the configuration file, either method will work to establish a static IP within your local area home network.

IF you are trying to get a static Public IP address, things will be a little different especially if you are using a consumer level ISP (Non Business Class). Most consumer ISP's use DHCP to assign dynamic addresses to their cable modems / DSL modems, etc. If this is what you're wanting to do and you do not have a known static IP block issued by your ISP, youwill need to research something called Dynamic DNS providers. These will allow you to register a hostname with a DDNS provider and the service will update your DNS Host Record entry every time your dynamic IP changes, so all you need to remember is the hostname rather than an IP address. Depending on the type of router you have, this can be set on the router, or if your router doesn't support DDNS synchronization, you can install a service on your Pi that will handle the DDNS synchronization.

Sorry, that was long winded, just want to be clear on your intentions so we can guide you in the right direction!

1 Like

I use DHCP IP reservation from my router. Is very simple to configure. Just add the MAC Address from your PI, set the IP it has to get when connect to the network and reboot the Pi, so next time it gets an IP, it will get the assigned one.

2 Likes

Hallo David,

thanks for the fast answer.

I need the fixed IP in the local network.
Since I always have problems with a DHCP server in this network segment.

I switched everything to fixed IP. Problem is that in this segment different machines are the cause of these problems.

But that's another long story. :wink:

I had already tried different instructions from the net but nothing brought a solution.
Only a new installation :frowning:

Thanks in advance for your help

Mit freundlichen Grüßen / With best regards

Volker

Hallo Johnnie Walker,

thanks for the fast answer.

I need the fixed IP in the local network.
Since I always have problems with a DHCP server in this network segment.

I switched everything to fixed IP. Problem is that in this segment different machines are the cause of these problems.

But that's another long story. :wink:

I had already tried different instructions from the net but nothing brought a solution.
Only a new installation :frowning:

Thanks in advance for your help

Mit freundlichen Grüßen / With best regards

Volker

Hello,
First of all, thank you for your answer. Unfortunately,
I could not answer sooner because I was on a business trip.
Yes, my Raspberry has a current image.
The problem in this network segment what I have,
I need fixed IPs otherwise I have trouble with other devices.

regards
Volker

Okay, so follow the advice I gave.

Special thanks to you.
The explanation is simple and works.
Will not the other files be used for the network configuration ??
octopi-wpa-supplicant.txt (only password and SSID ??)
octopi-network.txt (! ??!)

Works great, thanks Volker

Raspbian can be configured to stop using wpa_supplicant and go back to the earlier service. This was discussed on the official Raspberry Pi Foundation forum right after Stretch came out. (All this broke a lot of existing documentation when they abruptly changed Raspbian and people were mad about it.) I wouldn't, though.

Yes, just editing octopi-wpa-supplicant.txt will—upon bootup—make changes to the /etc/wpa_supplicant/wpa_supplicant.conf file behind the scenes.

I've never used octopi-network.txt, honestly. Here's a closed issue on Guy's repository for OctoPi, however. From the final comment, it looks like that file is no longer read.

Hi,
Thanks for the info and the background,
regards
Volker

1 Like

worked like a charm, thanks.

Hello, sorry but I'm new about Raspy.. How to make those changes? I need static ip address too.

Thanks!

Hello, sorry but I'm new about Raspy.. How to make those changes? I need static ip address too.

Thanks!

Download and install PuTTY, then type in the IP address of your Raspberry Pi and click 'open'. It will ask for a username and password, note that this is your Pi username and password and not your octoprint one. The default username is 'pi' and default password is 'raspberry'. Once you're in, type
sudo nano /etc/dhcpcd.conf
and it will open a file. Scroll down to the bottom and type:

interface eth0
static ip_address=(the IP address you want here)/24
static routers=(your router IP address)
static domain_name_servers=(your router IP address)

interface wlan0
static ip_address=(the IP address you want here)/24
static routers=(your router IP address)
static domain_name_servers=(your router IP address)

replacing '(the IP address you want here)' with the IP address you want the Pi using and '(your router IP address)' with the IP address of your router, which usually ends in 0.1
then press ctrl+x, press y, and hit enter.
Back in the command line, type
sudo shutdown -r now
to restart the Pi. It should now be at your set IP address!
I also installed this plugin to let me know what IP address the printer is on without checking my router!