In this article you will learn how to setup a static IP address
INTRODUCTION
Depending on the demands of your work or home network configuration, it may become necessary for you to set up a static IP address for your printer. To do this you will need to SSH (remotely connect to the printer). Please note that some of the modifications that we will make may cause issues. If you can not connect to the printer or notice any other irregularities after this tutorial we recommend a 60 second hard reset of the printer for a M series printer; the always-on AP mode can be used to recover from network issues with the Ultra One.
WARNING: SSH Remote Access is only meant for advanced users. MakerGear is not responsible for any problems or damage created by the use of SSH to modify your printer.
Requirements:
- Time
- 10 - 15 minutes
- Hardware
- MakerGear M3-SE, M3-ID, or Ultra One 3D printer
- Software - A SSH program:
- For Windows - PuTTY (PuTTY website)
- For Linux or OSX - Terminal
- Prerequisites:
What you'll Learn:
- How to set up a static IP address
- How to modify files on the Raspberry PI
Before You begin:
- Follow the instructions for Enabling SSH
- Note: These instructions work with both the M3 Series and the U1. Any commands, settings or directions should use the relevant format ("u1printer1a234" for the U1 hostname, "m3printer12a34" for the M3 hostname, etc.). Please contact Customer Support if you have any questions!
GETTING STARTED
Step 1: Connecting over SSH
SSH into the printer with standard credentials:
- Username: pi
- Password: Printer serial number with all the letters capitalized.
ssh pi@m3printer12a34.local
or
ssh pi@u1printer1a234.local
- Replace the 12a34 with the last 5 characters of your serial number.
- Log into your printer by using the Serial number (all letters capitalized) as the password.
pi@m3printer12a34.local's password:
or
pi@u1printer1a234.local's password:
Note: when entering the password, no characters will be displayed. Once the password has been entered, hit "Enter" to login.
Step 2: Determining your OS version and network information
Enter the command "lsb_release -a" into the terminal to view the operating system version. It should look simailer to this:
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 10 (buster)
Release: 10
Codename: buster
We're looking for the "Release" number, as this will determine which file we need to edit in order to set a static IP address.
Next, enter the command "ifconfig" into the terminal to view the current network settings, note current IP ("inet"), Broadcast and Netmask/Mask values:
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Thu Jul 5 13:41:57 from 10.1.1.98
pi@M3Printer12a34:~ $ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.1.1.121 netmask 255.255.0.0 broadcast 10.1.255.255
inet6 fd51:42f8:caae:d92e::64 prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:a7:dd:41 txqueuelen 1000 (Ethernet)
RX packets 10680866 bytes 2051365134 (1.9 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1012321 bytes 710249629 (677.3 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.16.31.4 netmask 255.255.255.0 broadcast 172.16.31.255
inet6 fe80::290:9eff:fe9a:a680 prefixlen 64 scopeid 0x20<link>
ether 00:90:9e:9a:a6:80 txqueuelen 1000 (Ethernet)
RX packets 1175 bytes 785801 (767.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 111057 bytes 34072896 (32.4 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 2107801 bytes 945379957 (901.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2107801 bytes 945379957 (901.5 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.1.1.96 netmask 255.255.0.0 broadcast 10.1.255.255
inet6 fe80::ba27:ebff:fef2:8814 prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:f2:88:14 txqueuelen 1000 (Ethernet)
RX packets 4582816 bytes 612918045 (584.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 114914 bytes 37494952 (35.7 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Note: a U1 or M3 printer may display other network interfaces in this report. For setting a static IP address for the wired network connection, we only care about the settings for eth0.
Step 3: Assigning the Static IP Address (Debian version 10+)
Skip to the next section if you're running Debian version 9 or lower, or contact Customer Support if you'd like to update your OS version)
Next, in the terminal, enter:
sudo nano -B /etc/dhcpcd.conf
Nano (a Linux command line text editor) should open, displaying the file with text like this:
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.
# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel
# Inform the DHCP server of our hostname for DDNS.
hostname
# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
#duid
# Persist interface configuration when dhcpcd exits.
persistent
# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit
# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu
# Most distributions have NTP support.
#option ntp_servers
# A ServerID is required by RFC2131.
require dhcp_server_identifier
# Generate SLAAC address using the Hardware Address of the interface
#slaac hwaddr
# OR generate Stable Private IPv6 Addresses based from the DUID
slaac private
# Example static IP configuration:
#interface eth0
#static ip_address=192.168.0.10/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
#static routers=192.168.0.1
#static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1
# It is possible to fall back to a static IP if DHCP fails:
# define static profile
#profile static_eth0
#static ip_address=192.168.1.23/24
#static routers=192.168.1.1
#static domain_name_servers=192.168.1.1
# fallback to static profile on eth0
#interface eth0
#fallback static_eth0
Go down to the line that reads "#interface eth0", remove all of comments / number signs (#) from that section, then add your new static IP network configuration:
# Example static IP configuration:
interface eth0
static ip_address=[target.static.ip.address]
static ip6_address=[value.from.ifconfig.inet6]
static routers=10.1.1.1
static domain_name_servers=10.1.1.1 8.8.8.8 fd51:42f8:caae:d92e::1
Note: indentation is only for clarity - it is not required.
An example:
The results for eth0 from "ifconfig":
inet addr:10.1.1.87 Bcast:10.1.255.255 Mask:255.255.0.0
inet6 addr: fd51:42f8:caae:d92e/64 Scope:Link
So add this section to /etc/dhcpcd.conf
# Example static IP configuration:
interface eth0
static ip_address=10.1.1.87
static ip6_address=fd51:42f8:caae:d92e/64
static routers=10.1.1.1
static domain_name_servers=10.1.1.1 8.8.8.8 fd51:42f8:caae:d92e/64
Step 3: Assigning the Static IP (Debian version ~9)
Go back to the previous section if you're running Debian version 10
Next, in the terminal, enter:
sudo nano -B /etc/network/interfaces
Nano (a Linux command line text editor) should open, displaying the file with text like this:
GNU nano 2.2.6 File: /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
iface eth0 inet dhcp
#allow-hotplug wlan0
#iface wlan0-raspbian inet manual
# wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1-raspbian inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
mapping wlan0
script /root/bin/map_iface
mapping wlan1
script /root/bin/map_iface
source /boot/octopi-network.txt
Go down to the line that reads "iface eth0 inet dhcp", add a "#" to the front of it.
Now, add a new line, and then enter the values in bold text:
GNU nano 2.2.6 File: /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
#iface eth0 inet dhcp
auto eth0
iface eth0 inet static
address [target.static.ip.address]
netmask [value.from.ifconfig.Mask]
broadcast [value.from.ifconfig.Bcast]
#allow-hotplug wlan0
#iface wlan0-raspbian inet manual
# wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1-raspbian inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
mapping wlan0
script /root/bin/map_iface
mapping wlan1
script /root/bin/map_iface
source /boot/octopi-network.txt
Note: indentation is only for clarity - it is not required.
An example:
The results for eth0 from "ifconfig":
inet addr:10.1.1.87 Bcast:10.1.255.255 Mask:255.255.0.0
inet6 addr: fe80::e8ad:3794:3b38:926d/64 Scope:Link
So add this section to /etc/network/interfaces:
auto eth0
iface eth0 inet static
address 10.1.1.240
netmask 255.255.0.0
broadcast 10.1.255.255
Step 4
Once entered, press Ctrl+X to Exit, then type "y" to confirm overwriting the current file.
It is critical you use the correct values for your local network, as any misconfiguration here will likely prevent communication on the modified interface. Also, ensure that the static IP address you are attempting to set does not interfere with anything else on the network - preferably choose an address outside of your local DHCP assignment range (many routers allow this to be configured, and some will have a range reserved for non-DHCP clients).
Once you are certain the changes have been made correctly, reboot the system by sending "sudo reboot" in the terminal. The Raspberry Pi should reboot with the new static IP address. It should still be reachable via M3Printer[#####].local, or U1Printer[#####].local.