Skip to contentSkip to conversation

How to get a guest IP

Qemu-devel zheng sw 3 participants 3 messages Nov 4, 2005 – Nov 7, 2005

lore
Share & tools
lore

zheng sw

author
#0 lore raw

Host want to get the guest's IP when the host start the guest?

My setting is: debian(2.6.8), qemu, bridge-utils, TUN/TAP. The guest get a IP from a DHCP server which is in the same subnet whit host.

My purpose is use bash to run ssh connect to the host, then run qemu, After the guest is started, the host want to get the guest's
IP and send to me, but nobody will control the guest. Now I am
puzzle in how the host get the guest IP.

I have try 1. redirect the guest stdio to a terminal. but false,
2. Use DHCP server bound MAC address with IP, and use
-macaddr set the guest MAC. but I can't control the DHCP server now.
3, mount the qemu image, but document say it can't
mounted.
4. guest use static IP, but I may start several guest
with a image.
5. use -seral pty, but I can't read the pts.

Thank you!
My english is poor, sorry.

#1 lore raw
Quoted 1 line · zheng sw

Host want to get the guest's IP when the host start the guest?

Why?

Quoted 3 lines

My setting is: debian(2.6.8), qemu, bridge-utils, TUN/TAP. The guest get a IP from a DHCP server which is in the same subnet whit host.

Ok.

Quoted 4 lines

My purpose is use bash to run ssh connect to the host, then run qemu, After the guest is started, the host want to get the guest's IP and send to me, but nobody will control the guest. Now I am puzzle in how the host get the guest IP.

The most obvious way would be to use dynamic DNS updates, supported by most DHCP servers, automatically registering the guest host name in DNS.

Another way is to have a init script in the guest to somehow tell the host what IP address it has.

Regards
Henrik

#2 lore raw
Quoted 5 lines · Henrik Nordstrom
Quoted 1 line · zheng sw

Host want to get the guest's IP when the host start the guest?

Why?

Beause I want to login the guest with ssh in another computer, and do some test in it.

Quoted 7 lines
Quoted 4 lines

My setting is: debian(2.6.8), qemu, bridge-utils, TUN/TAP. The guest get a IP from a DHCP server which is in the same subnet whit host.

Ok.

Quoted 7 lines
Quoted 4 lines

My purpose is use bash to run ssh connect to the host, then run qemu, After the guest is started, the host want to get the guest's IP and send to me, but nobody will control the guest. Now I am puzzle in how the host get the guest IP.

The most obvious way would be to use dynamic DNS updates, supported by most DHCP servers, automatically registering the guest host name in DNS.

I think it's difficult to do such actions in program or script.

Quoted 3 lines

Another way is to have a init script in the guest to somehow tell the host what IP address it has.

In this way, the guest don't know the host IP except I send a message to guest when qemu run, Beause I may run qemu in different computer. When read the document, I can't find any way to send a message to guest in the command line or script.

The best way I think is get the output of guest when it booting. I only find the option of redirect the guest output use -serial dev. But I can't read the output when use -serial pty. Is any other ways?

thank you!
Best Regards
Zheng SW

Quoted 3 lines

Regards
Henrik