Home > Computing > Quickie to show IP Addresses on console login

Quickie to show IP Addresses on console login

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-$$
Advertisements
Categories: Computing Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: