Skip to content
July 4, 2017 / ftth

Displaying a host IP pre-logon on Arch

Sometimes it’s useful to be able to determine a system’s IP address directly from the terminal, prior to logon.

To do that, you can create a dedicated systemd unit file (e.g. /lib/systemd/system/display_ip_on_logon.service):

Description=Update /etc/issue with ip address



The script would be pretty straightforward:

while true
    do IP=$(/sbin/ip route get 1 | cut -d " " -f7)
    printf "ubicast mediacoder $HOSTNAME $IP\n\n" > /etc/issue
    sleep 30

That way, when connecting a display to the system, just type any key on the keyboard and the logon banner will show the host IP.

Do not forget to:

systemctl daemon-reload
systemctl enable display_ip_on_logon.service
systemctl start display_ip_on_logon.service

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: