How can I display eth0's IP address at the login screen on Precise Server?

As of Debian 8/jessie you can use the \4 and \6 escape characters to output the IPv4 and IPv6 addresses. So the /etc/issue file:

Debian GNU/Linux 8 \n \l

eth0: \4{eth0}

Would output something like the following at the login console:

Debian GNU/Linux 8 myserver tty1

eth0: 192.168.1.100
myserver login:

I imagine Ubuntu would provide similar functionality (at least in newer releases)


/etc/issue is unfortunately a plain text, it has some options you can add to it (see man agetty) but not the IP address of eth0.

If you put this in /etc/rc.local:

IP=$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
echo "eth0 IP: $IP" > /etc/issue

Then you will see something like this:

eth0: 192.168.0.2
myServer login:

Tags:

Login

Ifconfig