openSUSE 11.4 Login Screen - show IP?

Okay so I’ve got a few VM’s of opensuse 11.4 running. Normally I ssh to them and run apps from them, this gives me a nice native look because the VM’s are really cut to the bone with what they have on them.

However I on every VM I have I need to login to it and then see what IP it is and THEN ssh into it.

It would be great if I didn’t need to do this and somehow the IP address of eth0 is shown on the KDM login screen, so I just power the VM up, check the IP address on the login screen and then SSH in via the terminal on my HOST pc.

Is there any theme that does this? Or can I modify the theme to show this?

login to it and then see what IP it is and THEN ssh into it
This does not make sense.

I admin dozens of remote machines via ssh. It does not matter whether they are on the LAN or in another continent, physical or virtual, I cannot login without establishing a ssh connection FIRST, which in turn requires an IP route. There are short-name entries for these machines in my local* /etc/hosts*. Details for the ssh protocol are in ~/.ssh/config. The connection and login is then achieved with:
ssh macine-name

To find your IP address(es) while at the terminal prompt, you can type in the following command:

/sbin/ifconfig | grep "inet addr:" | grep "Bcast:"

inet addr:192.168.0.185  Bcast:192.168.0.255  Mask:255.255.255.0

OR

/sbin/ifconfig | grep "inet addr:" | grep "Bcast:"| awk '{print $2}' | cut -d \: -f 2

192.168.0.185

Thank You,

Sorry my mistake I wasn’t clear in describing what I want.

I just want to be able to SEE the current IP address assigned to my machine on the login screen - thats all.

Or to put it another way - is there anyway of outputting the result of a terminal command on the KDM login screen?

rash m wrote:

>
> Sorry my mistake I wasn’t clear in describing what I want.
>
> I just want to be able to SEE the current IP address assigned to my
> machine on the login screen - thats all.
>
> Or to put it another way - is there anyway of outputting the result of
> a terminal command on the KDM login screen?
>
>
Did you look here
http://docs.kde.org/stable/en/kdebase-workspace/kdm/configuring-kdm.html
there seems to be an option to use an arbitrary program to draw the kdm
background, happy hacking.


PC: oS 11.4 64 bit | Intel Core i7-2600@3.40GHz | KDE 4.6.0 | GeForce GT 420
| 16GB Ram
Eee PC 1201n: oS 12.1 RC2 64 bit | Intel Atom 330@1.60GHz | KDE 4.7.2 |
nVidia ION | 3GB Ram

You can use the blip script posted here: netinfo - Read Network & PC Information into a Local Text File - Page 3

It prints your external IP and tells you if it is blacklisted.

  • oops … on the login screen! … Well … it only gives you the first half of the solution then. You still have to print $(blip | awk ‘{ print $2}’) somehow on the kdm login screen. It might be possible by hacking kdmrc or one of the files used by kdm.

If you are using KDE with NetworkManager you don’t actually have an IP until you start up the desktop.

If you are not using NetworkManager, then why not give each VM a static address?

And if you are already giving them static addresses, then why not set up /etc/hosts or DNS to tie them to easy to remember names? Sounds like you are perpetuating a problem (using IP addresses) that shouldn’t be created in the first place.

It should be possible to run conky on the top of kdm screen and have it displaying the IP (provided you have one indeed).
information displaying on screen - Page 2

These are all VM’s - so they all have ethernet setup via ifup/ifdown - NOT knetworkmanager. So they should have IP’s when they boot. Managing static IP addresses is a pain - as I might delete and VM, or clone one etc etc. or might not even be on the same network (all of this is setup on my laptop).

I did look at one option in addition to what you guys have suggested - that was convert it’s a linux app that lets you edit images; by adding the IP address to an image and setting it as the boot logo - it might work!

I’ll see what I can do and report back with what I did so I can at least help someone else.

If you are running the VMs with host network interfaces, then set up your own DHCP server on the host and assign fixed IPs to the VMs based on the MAC addresses. You could even get the DHCP server to update a DNS server.

On 2011-11-06 23:46, ken yap wrote:
>
> If you are running the VMs with host network interfaces, then set up
> your own DHCP server on the host and assign fixed IPs to the VMs based
> on the MAC addresses. You could even get the DHCP server to update a DNS
> server.

If it is vmware, it runs its own dhcp server, with configuration under
/etc/vmware/*


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

After reading you first post (which I should have done before posting), it became clear to me that what you need is not to have the IPs displayed at the login screen of your vms but just to know the IPs in order to ssh to them, right? In this case, you should set up your vms to use bridge instead of NAT (we still don’t know what kind of vms they are) and either run a DHCP/DNS on the host - as already suggested - or just assign fix ips and host names to your vms, write an entry for each vm in /etc/hosts on the host and ssh to them by name (you don’t need to remember ips at all).

On 2011-11-07 11:16, please try again wrote:
>
> After reading you first post (which I should have done before posting),
> it became clear to me that what you need is not to have the IPs
> displayed at the login screen of your vms but just to know the IPs in
> order to ssh to them, right? In this case, you should set up your vms
> to use bridge instead of NAT (we still don’t know what kind of vms they
> are) and either run a DHCP/DNS on the host - as already suggested - or
> just assign fix ips and host names to your vms, write an entry for each
> vm in /etc/hosts on the host and ssh to them by name (you don’t need to
> remember ips at all).

In the case of vmware, as I said, it runs its own dhcpd server, and the
virtual machines get always the same IP, even with NAT. I have names for
the VM in the hosts file. The IP can change if I move the VM to another
computer, but that is to be expected.

I just have to find the IP once in life.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

Every keeps pushing me to use the fixed IP/hostname solution - but I wish to avoid that. The reason for this is that this particular setup will be for a base virtual machine from which all Linux VM’s are cloned.

Thus, fixed IP’s/hostnames etc are not an ideal solution for me, as the network I connect the VM’s to will change, if they need access to the internet I need to connect them to eth0 or wlan0, but if I don’t need internet access then internal vmnet0 or vmnet1 (or whatever they are called) will do fine.

Anyway I think I have done it!!! Heres how

Create a copy of /usr/share/kde4/config/kdm/kdmrc file, and place it in the same folder (I called mine kdmrc.template.bak)
Change the GreetString from ‘Welcome to %s at %n’ to ‘Welcome to %s at (192.168.1.1)’ in the kdmrc.template.bak file.

now edit the following file
/etc/rc.d/xdm

and add the following two lines some where near the top

sleep 20
sed -r 's/192.168.1.1'/$(/sbin/ifconfig | grep inet | grep -v inet6 | grep -v 127.0.0.1 | cut -d: -f2 | awk '{printf $1"
"}')/ /usr/share/kde4/config/kdm/kdmrc.template.bak > /usr/share/kde4/config/kdm/kdmrc

And thats it the greeting string will now SHOW you the IP.

I assume you have disabled the themed login screen (you need to do this from yast2 -> /etc/sysconfig and change kdm theme from SUSE to null). And this is a little crude - but it works for me so I’m happy.

Hi
So you have to run X to get the login ip so you can then ssh to the vm?
Why run X at all?

I would just use the mail command to send the current dhcp address to
the host I’m logging into, then just run a script to suck the ip
address out into a file for that host, then just use the ssh command as
well as reading the ip address from the file.


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.4 (x86_64) Kernel 2.6.37.6-0.7-desktop
up 7 days 5:01, 4 users, load average: 0.63, 0.19, 0.10
GPU GeForce 8600 GTS Silent - Driver Version: 285.05.09

I run stuff like Qt creator, eclipse and the like via ssh hence the need for X. I don’t however need a graphical login.

Anyway if X is not running then (i.e. runlevel 3) then the -X swich of the ssh command has no effect as there are no X sessions to forward? (please let me know if this is correct.)

Also if I switch permamently to a console login - will it automatically log me into a KDE4 session when I login or will I need to start in manually? I know my University had a console login where we could choose the different windows manager once we logged in. Something like that would be cool.

On 2011-11-08 00:06, rash m wrote:

> I run stuff like Qt creator, eclipse and the like via ssh hence the
> need for X. I don’t however need a graphical login.
>
> Anyway if X is not running then (i.e. runlevel 3) then the -X swich of
> the ssh command has no effect as there are no X sessions to forward?
> (please let me know if this is correct.)

No, not true. You do not need an X server on the machine you connect to.
You need an X server on the machine you connect from.

Notice that the above paragraph has the server and client words reversed to
what intuition say. They are correct.

To make sure that this is still true, I booted a VMplayer oS 11.3 machine
in text mode. Then I ssh-ed to it from the host, and run yast -qt graphical
interface in the host - using the host X server and the guest client. Yes,
the terminology is confusing.

> Also if I switch permamently to a console login - will it automatically
> log me into a KDE4 session when I login or will I need to start in
> manually? I know my University had a console login where we could choose
> the different windows manager once we logged in. Something like that
> would be cool.

On servers where people are not normally sitting, we can leave a text mode
login to save resources. If needed, you can still log in, issue “init 5”
and start the graphical mode, or issue “startx”.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

Indeed. And with FreeNX or NoMachine NX server running in your vms, you could even get a GUI login to your vms while booting them in runlevel 3. It might be an interesting option.