get virtual machine information on Host - virtualization

How to retrieve virtual machine data such as ip address on the HOST .
I've created virtual machines using qemu-system-x86_64.

At time of asking, it was not possible to query the guest IP address from virsh. Modern libvirt though supports the "domifaddr" command in virsh which lets you query the DHCP assigned IP address for guests that are connected to libvirt's "default" network. It does not work for guests using direct bridging to the LAN.
Second, there is now also the ability to setup an NSS module on the host, so you can login to guests based on their hostname, instead of raw IP. Again this works for guests using the default network

Related

problem whith MSMQ while changing OS from xp to win7

In ower system we have two machines which connected by MSMSQ. one machine contains two static ip addresses (each ip belongs to other lan) and the second one using one ip address. We have a proccedure which change the ip address of the machine with one ip address to ip belongs to the lan of one of the ip address of the machine contains two ip address. the problem is that each time after changing the ip MSMQ connect after 15 minutes. On xp it was immidate.
What can couse this?
The Windows 7 situation sounds 'normal'. MSMQ relies on TCP/IP name resolution. If you change the IP address of a PC, other machines don't immediately know about it until cached information is replaced with new.
The Windows XP situation implies that the way MSMQ uses the cached information, or the way the PC caches information, was tweaked.
MSMQ and cached IP addresses
http://geekswithblogs.net/Plumbersmate/archive/2011/08/19/msmq-and-cached-ip-addresses.aspx
You will need the Wayback Machine for the KB article I reference
https://web.archive.org/web/20100212070948/http://support.microsoft.com/kb/833512

How does ping -a know the hostname of my Raspberry Pi 4?

My Raspberry Pi 4 B is connected (for the first time) to the WiFi of my PC (running Windows). Then the raspberry(ip) showed up in the list in Network Scanner of MobaXterm. What surprised me is that the list also shows the name of my Pi. And ping -a ip also shows the name.
How does this work?
When the Raspberry Pi connects to your WiFi it doesn't just get an IP address assigned. It also gets a host name assigned. It either sends its own host name to the DHCP server or the DHCP server assigns a host name.
Now, when you have an IP address, you can do a reverse search. Usually DNS works in the way that you give it a name and it returns the IP address. But there is also reverse search, give it an IP address and get a name back.
In your local network the DHCP server and your DNS resolver work together. Whenever a reverse search for a local IP address is made, the answer is fetched from the DHCP server. And the DHCP server answers with the host name from step one.
In most WiFi routers dnsmasq does this for you, on a Windows machine it is built into Windows.

IP Address of servers

So I am kind of new to networking and I'm just interested in the client/server architecture. Let's say you developed a program and the client version ran on a computer and the server version on the server(obviously). In order for the client to connect to the server, it would have to know the ip address of the server (and the port attached so it can be routed to the correct computer/program). Does that mean that the server's ip address can not change? Would you have to specifically tell your ISP to keep the ip address static? Because if both the client and server ip addresses change, then they would have no way to connect and the program wouldn't work... in other words there has to be one constant. When you sign up for a VPS do they give you a static ip address you can bind to from the client version? Thanks!
In order for the client to connect to the server, it would have to know the ip address of the server (and the port attached so it can be routed to the correct computer/program).
Correct.
Does that mean that the server's ip address can not change?
No. In fact, IPs can change at any time. Most servers that are exposed to the public Internet have a static domain name registered in the Internet's DNS system. A client asks DNS to resolve the desired domain name to its current IP address, and then the client can connect to it. But even in private LANs, most routers act as a local DNS server, allowing machines on the same network to discover each other's IP by machine name.
The OS typically handles DNS for you. A client can simply call gethostbyname() or prefferably getaddrinfo(), and the OS will perform DNS queries as needed on the client's behalf and return back the reported IP(s).
Would you have to specifically tell your ISP to keep the ip address static?
You can, but that usually costs extra. And it is not necessary if your server is registered in DNS. And there are free/cheap DNS systems that work with servers that do not have a static IP.
Because if both the client and server ip addresses change, then they would have no way to connect and the program wouldn't work...
That is where DNS comes into play.
in other words there has to be one constant.
A registered domain name that can be resolved by DNS.
When you sign up for a VPS do they give you a static ip address you can bind to from the client version?
It depends on the VPS service, but a more likely scenario would be you are assigned a static sub-domain within the VPS service's main domain. For example, myserver.thevps.com. Or, if you buy your own domain (which can be done very cheaply from any number of providers), you can usually link it to the DNS server operated by your VPS service.

configure mongodb only accept remote connection comes from LAN

mongodb has bind ip but it is not so practical due to when new server add, it need shutdown db and add the new server ip into bind ip list and restart db. This is unacceptable because all other servers need to relaunch either.
In almost all deployment, servers machine and db machine are in same LAN. So can mongodb be configured as only accept ranges of ip of [172.16.0.0 - 172.31.255.255], [192.168.0.0 - 192.168.255.255], [10.0.0.0 - 10.255.255.255]?
These 3 ranges ip is LAN ip
The bind_ip configuration value only determines which IP address(es) your MongoDB server is listening to. It does not control access from remote IPs -- that is the job of a firewall.
The address ranges you have listed as requiring remote access are all private IP address space which means these networks are not directly reachable/routable outside your LAN. Assuming you can route traffic between your private networks you should not need to bind to multiple IP addresses.
Given you are allowing access from a broad range of IP addresses, you should also read the Security section of the MongoDB manual (in particular, the Security Checklist and tutorial on enabling Access Control).
bindIp can accept multiple comma separated values. See the "Security considerations" section Here
Other than that you might want to consider configuring your firewall, maybe iptables if it runs on Linux machine.
Hope this helps

Accessing internal network resource using external IP address

How is it possible to access an internal resource (email server / FTP server) using its external IP address but from within the network ?
The situation is that a number of users have laptops and work out of the office several days per week. I don't want them to have to change the connection details from 217.x.x.x to 10.0.0.x every time they come into the office, then back again when they leave.
I have external access working, so they can connect using the 217.x.x.x IP when on the road, but it doesn't work when they are in the office.
We have a router providing NAT access to the net and different servers for FTP, email etc.
This is what DNS is for - your external DNS provides the 217.x.x.x address for the names, while your internal DNS returns the 10.0.0.x IP address. Clients access resources by hostname, not IP address, and it's done.
Unless you have filters forbidding access to the external NAT'ed address from internal clients, I do not see why it should not work.