Linux: Howto show the Servers IP address at the login console

Howto show the Servers IP address at the login console
I have a few test systems running as virtual guests and assign them IP Addresses from my DHCP. Ideally when I fire them up in the VM I see the console only and would like to ssh to them. I don’t see a point in login to the console first to get their IP address and the DNS Masq also sometimes doesn’t react well or the name is too long and cryptic.
Easiest for me was to create a login banner (welcome screen) to show my IP Address on the console.
Here we go.
1. Insert a command which will be executed at the start-up and inserts what we want into the /etc/issue file.
I do this in the /etc/rc.local (because I’m a bit lazy to mess around with several separate scripts)
# sudo vi /etc/rc.local insert before "touch /var/lock/subsys/local" : sed -i_bak -e '/Addres/d' /etc/issue IPADD=`/sbin/ifconfig | sed '/Bcast/!d' | awk '{print $2}'| awk '{print $2}' FS=":"` echo "The IP Addres is: $IPADD" >> /etc/issue
Explanantion:
sed removes any old (previous created) line with the IP address.
The the newly assigned IP address will be added to /etc/issues
2. That would do already the job but I also wanted to shape the issue file, so this is optional:
# sudo vi /etc/issue insert at the end: Today is d t @ n
or
echo "Today is d t @ n" >> /etc/issue
Update: I added as well the following to prevent the console to go blank after a while.
echo -ne " 33[9;0]" >> /etc/issue
Explanation to /etc/issue:
b Insert the baudrate of the current line.
d Insert the current date.
s Insert the system name, the name of the operating system.
l Insert the name of the current tty line.
m Insert the architecture identifier of the machine, e.g., i686.
n Insert the nodename of the machine, also known as the hostname.
o Insert the domainname of the machine.
r Insert the release number of the kernel, e.g., 2.6.11.12.
t Insert the current time.
u Insert the number of current users logged in.
U Insert the string “1 user” or “<n> users” where <n> is the
number of current users logged in.
v Insert the version of the OS, e.g., the build-date etc.
3. Now its time for a reboot to see the result
Update:
added echo commands for fast copy and paste.