Wednesday, May 8, 2024
 Popular · Latest · Hot · Upcoming
44
rated 0 times [  44] [ 0]  / answers: 1 / hits: 35740  / 2 Years ago, sun, november 13, 2022, 2:21:34

The server I administrate has a dynamic IP address assigned by DHCP, which is inconvenient. When I want to SSH into it, I have to first log in by hand and use ifconfig to find its current IP address. Thankfully, it lives about two feet from where I sit.


I know how to edit /etc/issue to show different values before the login prompt is delivered to the display, but I'd like to know if it's possible for /etc/issue to display the current IP address of eth0 (re-evaluated at boot time) so that I can see it and then ssh in without having to log in to run ifconfig.


More From » login

 Answers
5

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 
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)


[#34288] Monday, November 14, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
zebrla

Total Points: 356
Total Questions: 110
Total Answers: 120

Location: Sudan
Member since Tue, Aug 3, 2021
3 Years ago
;