Custom logon prompt for getty
Fix your logon prompt for when you are on the console of your Linux server (Centos 6 runlevel 3 or Centos 7 multi-user.target) so that it displays your current ip address
Edit /etc/rc.d/rc.local and add the following lines to the end of the file
echo "\S" > /etc/issue echo "Kernel \r on an \m" >> /etc/issue myip="$(ifconfig | grep "inet " | grep -v 127.0.0.1 | awk {'print $2'} | awk 'NR==1{print $1}')" echo $myip >> /etc/issue
Then if you are running Cenots 7 execute
systemctl enable rc-local.service chmod +x /etc/rc.d/rc.local
The next time you reboot the machine, your current IP address will be displayed.
Note – if you have a multi-homed system you may need to modify the “myip=” statement to get the correct ip address(es) to display