﻿id,summary,reporter,owner,description,type,status,component,version,resolution,keywords,cc,guest,host
20829,cannot assign static IP in host only adapter - other than 192.168.56.0/21,bilias,,"I'm trying to use my old vboxnetX adapters with my custom IPs, but for the last releases I cannot. Interfaces are starting but with no IPs

Fedora 35 / VirtualBox-6.1-6.1.32_149290_fedora33-1.x86_64

# VBoxManage hostonlyif create 
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Interface 'vboxnet0' was successfully created

# VBoxManage hostonlyif ipconfig vboxnet0 --ip 10.88.88.1 --netmask 255.255.255.0
VBoxManage: error: Code E_ACCESSDENIED (0x80070005) - Access denied (extended info not available)
VBoxManage: error: Context: ""EnableStaticIPConfig(Bstr(pszIp).raw(), Bstr(pszNetmask).raw())"" at line 242 of file VBoxManageHostonly.cpp

in log I get:

00:00:00.154243 nspr-2   NetIfAdpCtl: failed to create process for /usr/lib/virtualbox/VBoxNetAdpCtl: iStats=38 enmReason=1
00:00:00.154256 nspr-2   Failed to EnableStaticIpConfig with rc=VERR_ACCESS_DENIED

# strace /usr/lib/virtualbox/VBoxNetAdpCtl vboxnet0 10.88.88.1 netmask 255.255.255.0
...
stat(""/sbin/ip"", {st_mode=S_IFREG|0755, st_size=719208, ...}) = 0
openat(AT_FDCWD, ""/etc/vbox/networks.conf"", O_RDONLY) = 3
newfstatat(3, """", {st_mode=S_IFREG|0644, st_size=28, ...}, AT_EMPTY_PATH) = 0
read(3, ""10.88.88.0/24\n10.88.89.0/24\n"", 4096) = 28
read(3, """", 4096)                       = 0
close(3)                                = 0
write(2, ""Error: permission denied\n"", 25Error: permission denied

cat /etc/vbox/networks.conf 
10.88.88.0/24
10.88.89.0/24

ls -ld /etc/vbox/networks.conf 
-rw-r--r-- 1 root root 28 Feb 16 13:46 /etc/vbox/networks.conf

all commands are as root

If I manually edit VirtualBox.xml and add the ips (this was my config until I removed the adapters to try from scratch)

# VBoxManage list hostonlyifs 

Name:            vboxnet0
GUID:            786f6276-656e-4074-8000-0a0027000000
DHCP:            Disabled
IPAddress:       10.88.88.1
NetworkMask:     255.255.255.0
IPV6Address:     
IPV6NetworkMaskPrefixLength: 0
HardwareAddress: 0a:00:27:00:00:00
MediumType:      Ethernet
Wireless:        No
Status:          Down
VBoxNetworkName: HostInterfaceNetworking-vboxnet0

Name:            vboxnet1
GUID:            786f6276-656e-4174-8000-0a0027000001
DHCP:            Disabled
IPAddress:       10.88.89.1
NetworkMask:     255.255.255.0
IPV6Address:     
IPV6NetworkMaskPrefixLength: 0
HardwareAddress: 0a:00:27:00:00:01
MediumType:      Ethernet
Wireless:        No
Status:          Down
VBoxNetworkName: HostInterfaceNetworking-vboxnet1

When I start VirtualBox I get in logs:
00:00:00.122927 nspr-2   failed to create vboxnet0, error (0xffffffff)
00:00:00.126670 nspr-2   failed to create vboxnet1, error (0xffffffff)

and upon starting a VM:

00:00:53.167974 nspr-2   NetIfAdpCtl: failed to create process for /usr/lib/virtualbox/VBoxNetAdpCtl: iStats=38 enmReason=1
00:00:53.168021 nspr-2   Failed to EnableStaticIpConfig with rc=VERR_ACCESS_DENIED

ifconfig vboxnet0

vboxnet0: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 0a:00:27:00:00:00  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
",defect,new,network/hostif,VirtualBox 6.1.32,,,,other,other
