Archive

Archive for September, 2012

Quickie to show IP Addresses on console login

September 25, 2012 Leave a comment

Here’s a simple script to put into /etc/rc3.d/ to add the IP addresses to the /etc/issue file so that they appear on the console login screen. Handy for environments like Virtual Box or VMWare, to display the IP addresses that were configured via DHCP so I can SSH directly into the system.

#!/bin/sh
#
# /etc/rc3.d/S99issue

cp /etc/issue /tmp/issue-$$
head -3 /tmp/issue-$$ > /etc/issue
ifconfig | awk '/^[a-z]/{ i=$1 } /inet addr/{print i,"\t",$1,$2}' >> /etc/issue
echo >> /etc/issue
rm -f /tmp/issue-$$
Categories: Computing Tags: , ,