Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show ip address when os boot

I want to make when CentOS start in init 3 to show me my ip addr, before log in. For Example:

CentOS Realese 6.5(Final)
Kernel 2.6..
ip addr: 192.168.1.1

or something like that.

I make script which is:

    #!/bin/bash
    ifconfig eth0 | grep 'inet addr'

but, I don't know where I put it.

I try in rc.local (with "cat" and him path) but obviously it is not right place, or I make something wrong. And I try in /etc/issue , but and there maybe I make something wrong.

like image 326
ValeriRangelov Avatar asked Dec 08 '25 03:12

ValeriRangelov


1 Answers

On CentOS 7 and Debian 8 (and maybe other as well), just append the following line to /etc/issue

My IP address: \4

and that will resolve to the machine's IPv4 address. If you have multiple network interfaces and you want to pick one specific, you can specify it with

My IP address: \4{eth0}
like image 184
PaoloC Avatar answered Dec 11 '25 01:12

PaoloC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!