Add IP addresses to VMs


Recommended Posts

With DHCP its not possible to see what IPs your VM are picking up without logging into them.
So we could make the IPs appear in UNRAID on the VM page using a script.
 



Would be possible to add the IPs of the VMs to the VM web guide page?
I was thinking that a simple ARP could be done.


So maybe start with a broadcast ping to the network.

% ping 192.168.0.255

PING 192.168.0.255 (192.168.0.255): 56 data bytes

Request timeout for icmp_seq 0

Request timeout for icmp_seq 1

Request timeout for icmp_seq 2

 

Then do an arp with a filter of the MAC address form the Vm log
-device '{"driver":"virtio-net","netdev":"hostnet0","id":"net0","mac":"52:54:00:05:9f:59","bus":"pci.0","addr":"0x2"}' \


Then filter for the MAC:

% arp -a | grep 9f:59

? (192.168.1.106) at 52:54:0:5:9f:59 on en6 ifscope [ethernet]

? (192.168.1.106) at 52:54:0:5:9f:59 on en0 ifscope [ethernet]

 

Then check and filter the IPs from potentially multiple interfaces

? (192.168.1.106) at 52:54:0:5:9f:59 on en0 ifscope [ethernet]
 

Then provide the IP(s) to the VM web guide page beside the VM.

192.168.1.106

We could maybe make the IP a clickable link to RDP or SSH?
 



From VM start up log:

netdev tap,fd=36,id=hostnet0 \
-device '{"driver":"virtio-net","netdev":"hostnet0","id":"net0","mac":"52:54:00:05:9f:59","bus":"pci.0","addr":"0x2"}' \
-chardev pty,id=charserial0 \
-device '{"driver":"isa-serial","chardev":"charserial0","id":"serial0"}' \
-

Link to comment
  • 3 weeks later...
On 3/14/2022 at 7:37 PM, newmember said:

With DHCP its not possible to see what IPs your VM are picking up without logging into them.
So we could make the IPs appear in UNRAID on the VM page using a script.
 



Would be possible to add the IPs of the VMs to the VM web guide page?
I was thinking that a simple ARP could be done.


So maybe start with a broadcast ping to the network.

% ping 192.168.0.255

PING 192.168.0.255 (192.168.0.255): 56 data bytes

Request timeout for icmp_seq 0

Request timeout for icmp_seq 1

Request timeout for icmp_seq 2

 

Then do an arp with a filter of the MAC address form the Vm log
-device '{"driver":"virtio-net","netdev":"hostnet0","id":"net0","mac":"52:54:00:05:9f:59","bus":"pci.0","addr":"0x2"}' \


Then filter for the MAC:

% arp -a | grep 9f:59

? (192.168.1.106) at 52:54:0:5:9f:59 on en6 ifscope [ethernet]

? (192.168.1.106) at 52:54:0:5:9f:59 on en0 ifscope [ethernet]

 

Then check and filter the IPs from potentially multiple interfaces

? (192.168.1.106) at 52:54:0:5:9f:59 on en0 ifscope [ethernet]
 

Then provide the IP(s) to the VM web guide page beside the VM.

192.168.1.106

We could maybe make the IP a clickable link to RDP or SSH?
 



From VM start up log:

netdev tap,fd=36,id=hostnet0 \
-device '{"driver":"virtio-net","netdev":"hostnet0","id":"net0","mac":"52:54:00:05:9f:59","bus":"pci.0","addr":"0x2"}' \
-chardev pty,id=charserial0 \
-device '{"driver":"isa-serial","chardev":"charserial0","id":"serial0"}' \
-

I have added a PR to be able to show IP address on the VM Page. but it is dependant on running qemu guest agent.

 

 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.