How to add WiFi to a multifunction printer with USB using Raspberry Pi – Part 3, Set Fixed IP Address

PART 3: SET FIXED IP ADDRESS

In the previous part, we configured the printer server, now we may want to set a fixed IP address, which makes configuring the scanner software easier, and also facilitates printer search too. The IP address range used by router’s DHCP should not be used for fixed addresses, but you may be able to set a fixed DHCP address for the raspberry in the router’s config, so that the DHCP always gives the same address to the device (which it reconginzes in WLAN by its MAC address).

21) Plan the place of the Raspberry Pi in your Local Area Network

Let’s think about configuring your RPi to have a fixed IP address in the WLAN. You can either program your WLAN router to always give the same IP address to the RPi:s WLAN adapter, or select an address within the subnet and out of the DHCP range in use. In this writing, we take the latter route, i.e. setting the IP address out of the DHCP range; assuming that DHCP is giving addresses starting from 192.168.1.10 and ending to 192.168.1.200, we pick an address in range 201-254, say, 192.168.1.245. This depends of course of your subnet configuration. If you have router management IP in 192.168.1.1 and the IP V4 net mask is 255.255.255.0, and you have nothing in your net with IP address 192.168.1.245, you’re good to go with my settings.

22) Configure the IP V4 address via DHCP

Configure the dhcp daemon to make the IP address a static one; consult iwconfig to get the name of your connected wlan interface. In the system configuration step, raspi-config , section Network – 2, you should haveĀ  set “Enable Predictable names” to get wlan0 instead of something like wlx01234678ABCD. Now, edit dhcp configuration file:

sudo nano /etc/dhcpcd.conf

#Add to beginning:

nohook lookup-hostname
interface wlan0 # wlan0 is the typical name for the wireless lan (wifi) interface, but it may be also longer
static ip_address=192.168.1.245/24
static routers=192.168.1.1
static domain_name_servers=1.1.1.1 # of whichever DNS you want, for example, 192.168.1.1, 8.8.8.8 will also do.

Save and then restart DHCPD, or just reboot.

Now we have set fixed IP address for the Raspberry Pi. Please note that if you configured the printer in the PC using IP address, you may want to reconfigure the address now.

In the next part we will configure the scanner server.

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *