How to display ip on a remove vm before login

Source: taken from (

This is mainly useful when you boot up a WM with a remote console and want to switch to ssh for connection.

First, create a script in /usr/local/bin/get-ip-address with the following contents:

/sbin/ifconfig | grep "inet addr" | grep -v "" | awk '{ print $2 }' | awk -F: '{ print $2 }'

Then add the following script to /etc/network/if-up.d/show-ip-address with the following contents:

if [ "$METHOD" = loopback ]; then
    exit 0

# Only run from ifup.
if [ "$MODE" != start ]; then
    exit 0

cp /etc/issue-standard /etc/issue
echo "IP Address: " >> /etc/issue
/usr/local/bin/get-ip-address >> /etc/issue
echo "" >> /etc/issue

You need to copy your standard issue to a copy and fix rights:

sudo cp /etc/issue /etc/issue-standard
sudo chmod +x /usr/local/bin/get-ip-address
sudo chmod +x /etc/network/if-up.d/show-ip-address

it will give you a simple prompt like this one:

Example of IP display

That’s all folks!