This is fine for most occasions. But I have one instance set-up to run zookeeper. I'd have to go around and change the config files on all my other Pi's. Ansible could cure this, and I'll get there one of these days. But I'm not there today. And actually - I think I'll use the script I wrote previously to update ansibles' hosts file. I just now thought of that.
Anyway - I want the zookeeper Pi to always have the same address.
I combined this question on superuser.com with what I learned about creating systemd start-up jobs to request the same ip address from my hotspot.
The gist of the superuser.com answer is add send dhcp-request-address 192.168.0.XXX to /etc/dhcp/dhclient.conf.
I then created a short executable script in /usr/bin called request_ip.sh.
$cat /usr/bin/request_ip.shThen I created the service file:
#! /bin/bash
dhclient -r -v && dhclient -4 -d -v -cf /etc/dhcp/dhclient.conf wlan0
# cat /etc/systemd/system/request_ip.serviceI installed request_ip.service in /etc/systemd/system, and enabled it with systemctl enable request_ip.service. Checking syslog, I know it ran. I'll update this post if I run into problems.
[Unit]
Description=Change ip to 131 for myProject
After=network-online.target
[Service]
Type=oneshot
ExecStart=/usr/bin/request_ip.sh
[Install]
WantedBy=multi-user.target
WantedBy=graphical.target
No comments:
Post a Comment