I have a Linux machine and I want it to show the current IP in the banner that shows before the login prompt is displayed. How can I do that? I considered making a startup script that finds the IP in the MOTD, but found that the MOTD gets displayed only after the person logged in, and I need the message to show before the person logged in.
If it matters, this is CentOS, I think version 6.
Best Answer
If you want to show the IP address in the
/etc/issue
, then you may be able to use\4
, or\4{eth0}
in the issue file. This certainly works in CentOS 7, and Ubuntu 16.04 and later. To show your IPv6 address, then use\6
.For example:
will be replaced by
IP:
then your IP address.Other
\
escape sequences that are supported are documented in man agetty