Linux – How to setup /etc/issues to show the IP address for eth0

centoslinuxvirtual-machines

I've got a couple of linux virtual machines with bridged interfaces, and I'd like the IP address of the machine to show up after the machine boot (in the login, where it usually shows the release and kernel).

From what I can tell the message is picked up from /etc/issues, but I'm not sure how and when to write to it.

Best Answer

It's just a text file...you write to it the same way you'd send text to a file with any other shell script. Something like this would replace /etc/issue with just your ip address:

ifconfig eth0 | awk '/inet addr/ {print $2}' | cut -f2 -d: > /etc/issue

Obviously you can make this arbitrarily more complex, depending on what information you want in your /etc/issue file.

You can write to this file in your local equivalent of /etc/rc.d/rc.local (which typically executes after all the other startup scripts).