ESXI: Get machine name from the virtual machine itself? - linux

I looked and looked but probably overlooked . I have a vsphere cloud with over 300 virtual machines. Each machine name as it appears in the vsphere client is actually the hostname of each machine (I have done this manually). Those machines sometimes have to change their hostname. At this time I hope there is a way to obtain/get/read the guest machine name from the machine itself, and then if there is a mismatch, then I'll know and modify the machine name when needed.
So, vmware-toolbox-cmd or other tool (from the linux open-vm-tools) can retrieve that info, the machine name ?

I don't normally use the ESXi host directly to retrieve information about the guest VMs, but you should be able to do something like: vmware-toolbox-cmd config get guestinfo hostname
This is sourced from the API docs for GuestInfo

Related

VM (Hyper-V) into AD (non-virtual)

I have trouble getting my VMs into the domain.
Several old machines functioned as "servers" in our environment and when I newly started working here, I wanted to change this cluster into something more appropriate. So I calculated how one big server would cost us a certain amount of money but we would save it in electricity-bills etc.
The server finally arrived (HP Proliant) and I installed a Server 2008 R2 on it (boss wont pay for something newer a.k.a. more expensive). I created .vhd files of the HDDs of the servers I want to virtualize and copied those files into the new server. I activated Hyper-V role and created a new VM and selected one of the .vhd files as the HDD for that VM and started the machine. The machine starts, all goody.
As far as I understand in Hyper-V we got 3 network-settings and for my purpose "external network" is the one to go with. Correct me if I'm wrong. The server is already in the domain. So I thought it should actually work already, but somehow I cannot connect to the domain.
The network settings on the VM is DHCP but it is not getting an IP from the DC. Do I need to spoof the old MAC-Address? Do I have to turn the physical machine that I'm virtualizing off? (I didn't do that because I wanted to check first whether I can get both running at the same time before turning it off. Also I cannot access the environment past business hours, so testing this is when nobody is around is kinda out of question)
The VM has W7 running on it, if it matters. I'm kinda lost what to do as I only find how to join a VM into a virtual network when I try to google for solutions.
DC (physical, x.x.x.1 IP), The new server (physical, x.x.x.82 IP), The VM (virtual, DHCP, current address of its physical copy x.x.x.123 though DHCP is set on it, 123 is just the IP it got).
Regards
Edit: Found the solution. The server has 2 NICs. "Connection" and "Connection 2" or whatever it is called by standard in English. The virtual adapter (3rd NIC so to say) has "Connection 2" in its description too. I got confused and addressed the wrong NIC in the Hyper-V options. I am editing this from the VM that finally has connection to the domain.
Has been resolved. Answer is in the edit of original post.

How To Find Credentials of Host Machine in VM?

I thought I was sshing into an old server, but it turns out to be a VM into which I ssh'd. I don't know the credentials of the host machine and would like to get this to connect to it directly. Is there a way I can find this through the VM?
EDIT:
Suppose I just want whatever I can get - in this case, perhaps just the IP, as robmathers notes.
dmidecode | egrep -i 'system-product-name'
gives me "VMware Virtual Platform".
No. Passwords in Linux are stored in encrypted form and you can't read them. But if you can change the password by mounting the virtual hard drive and modifying /etc/shadow (unless the drive is encrypted). There are many guides how to do that.

How to contact linux ClearCase clients from Windows servers

I am working on trying to get some linux Clearcase clients to work with our existing Windows infrastructure. All of the vobs and servers are stored on Windows machines.
Using an existing vob, I was able to create a tag in the linux region to refer to the vob, and then create a view on the linux client. This client was able to connect to the vob and pull the files in when I updated the config spec. However, while it can view files, it does not have permission to edit them.
The usernames match
linux: user1
windows: DOMAIN\user1
The Clearcase admin panel is set to "Use this domain to map UNIX user and group names" with DOMAIN selected.
However, the authentication does not appear to be working. From the unix client, if I run
credmap windowsServer
I get Nobody/Nobody for the remote username and group ID. If I run from the Windows server
credmap linuxClient
It times out and I get
credmap: Error: Unable to contact albd_server on host
Investigating further albd_list on unix shows that the albd server is running, and even finds the albd_server on the windows machine.
albd_server addr = 166.20.20.81, port= 371
albd_list 166.20.17.118
albd_server addr = 166.20.17.118, port= 371
Going in the opposite direction returns
albd_list 166.20.20.81
noname: Error: Unable to contact albd_server on host '166.20.20.81'
cannot contact albd
Ping works from the windows host to the linux host, and I am even connected to the linux host by SSH from the parent at the moment.
If anyone has any ideas on what to look for next, you'd be my hero :(
You get limited ClearCase functionality when you access a ClearCase server (running on Windows) from a Linux client. To learn more, read about CCFS.
I'd suggest you to consider migrating your VOB server to Linux. This way you get all ClearCase functionality, including dynamic views.
I confirm having Vob server on windows mean they won't be fully accessible from linux client, even though the official documentation from IBM describes the CCFS setting to follow.
(See "Configure UNIX or Linux clients to access Windows VOBs", which you must have seen)
In particular, I never managed to have a credential mapping fully working from Linux to windows (the other way works well).
And you need to make sure your view storage is accessible from Linux (see "Creating a view on a NAS device")
That leaves you with inter-environment solutions, like:
CCRC (ClearCase Remote Client, for CC7.x)
ClearTeam (for CC 8.x)
See "Feature Comparison Matrix for CCRC, CTE, CCWeb, Native ClearCase GUI and SCM Adapter".
This wound up being something stupid. There was a firewall running on the linux machine blocking the albd_server port.
This also did not resolve the credential mapping issues, but it at least let me eliminate one more potential cause. Thanks

ossec Setup with Virtual Machine

How does one set up ossec to have the host work as a server, and the guests have agents in them? Specifically, at least one point in the installation confuses me as to how this would work-how do you set the sever IP, if you are running ossec on a laptop, the IP address will change. How do you resolve the host that is running the guests ip dynamically?
Maybe the question should in that case be retitled to that, but the base cause for asking this question is for an ossec setup, and I will likely have more questions later, I'd rather them all be related to this.
Perhaps there is a guide to explain how to do what I want, which is to set up a mac os X lion host running ossec as the server, and have several vm guests with agent setups on them that talk to the host.
One deployment scenario is to create one OSSEC server and then to install OSSEC agents on everything you would like to watch for security events.
Regarding DHCP configured OSSEC agents, you can check out "Agent systems behind NAT or with dynamic IPs (DHCP)" http://www.ossec.net/doc/manual/agent/agent-dhcp-nat.html
If you have a specific DHCP or network range you would like any OSSEC agent to be able use and to be able to connect to the OSSEC server, then you can modify the following lines in the ossec.conf file (snippet borrowed from the OSSEC book):
We can also use the <allowed-ips></allowed-ips> tag to explicitly state which IP address
we allow connections from. In the following example, we used the <allowed-ips></allowed-ips>
tag in conjunction with the <connection></connection> tag to indicate that we expect OSSEC
HIDS agent connections from the 192.168.10.0/24 network
<ossec_config>
<remote>
<connection>secure</connection>
<allowed-ips>192.168.10.0/24</allowed-ips>
</remote>
</ossec_config>
I found out from vmware that the host VM's that are using a NAT configuration have a static IP address that corresponds to the host: 192.168.231.1 will reach the host from within the guest VM. This way, when you set up agents within the guest VM's you can use this address, and it will work.

How can I develop using a local VM server without using URLs with ports in them?

I'm setting up a linux server in a VM for my development.
Previously I've had PHP, MySQL etc etc all installed locally on my Mac. Apart from being a security risk, it's a drag to maintain and keep up to date, and there's a risk that an OS upgrade will wipe part of your setup out as the changes you make are fairly non-standard.
Having the entire server contained within a VM makes it easily upgradable and portable between machines. It means I can have the same configuration as the destination server and with shared folders even if the VM gets corrupted my work is safe on the host machine.
Previously with the local installation I was able to develop on convenient URLs like http://site.dev. I'd quite like to carry this over to the VM way of development but I'm struggling to figure out how, if it's possible at all.
Here's the problem:
In Bridged mode, the VM is part of the same network as the host. This is great but I can't choose a fixed IP address as I may be joining other networks and that address may be taken already. I'd like a consistent way of addressing my VM.
In NAT mode I can't directly address the VM without using port forwarding. I can use http://site.dev if I use the hosts file to forward that to localhost and then localhost:8080 forwards to the vm:80. The trouble is I have to access http://site.dev:8080 which is inconvenient for URL construction.
Does anyone know a way around this? I'm using ubuntu server and virtualbox.
Thanks!
The answer is to define a separate host-only network adapter and use that for host->guest communication.
You can do this by powering down the guest and adding the adapter in the VM settings. Once that's done you can boot the guest again and configure the new network interface however suits you best. I chose a fixed IP address in an unused range.

Resources