Configuring Networking in OpenBSD HVM

Hello, friends.
I was trying to create a openbsd hvm and even got succeded in doing so. But I somehow did broke its connectivity ( I was never able to access internet from this hvm). I think I set up networking in wrong way.
My method was-

  1. I downloaded Install67.iso from official OpenBSD website.
  2. Then I created and started an empty standalone hvm qube with this iso.
  3. Followed Installation and completed it. I tried to manually setup network interfaces during install, but had no idea how to do it in proper way.
  4. Openbsd is able to start and I can login and access terminal in it.
  5. No idea how to have connectivity in this hvm.

Can somebody please help.

Do you know how to configure networking in openBSD?
If not, read this:
https://www.openbsd.org/faq/faq6.html

The network settings you need are on the Basic Settings tab for the HVM
you have created. This shows IP and gateway.
Use a netmask of 255.255.255.0

You can either use the Qubes DNS IP addresses, or 9.9.9.9 , or similar.

Okay, so I tried a reinstall.
Installation details-
which interface you wish to configure- xnf0 vlan0
I configured only xnf0 with following-
IPV4 address for xnf0? 10.137.0.35
Netmask? 255.255.255.0
IPV6 address? none
Default IPV4 route? 10.137.0.35

The details on basic tab of settings were
IP address- 10.137.0.35
netmask- 255.255.255.255
gateway- 10.138.7.37

No success in connection after that.

(mod edit: @wobo I edited the title to make this thread easier to find, if you feel it’s not adequate, feel free to change it)

There was no need to reinstall.
But as you did, why didn’t you set the gateway correctly?

You haven’t said what trouble shooting steps you have taken. Have you
made sure that the issue isn’t with DNS by testing connection to an IP
address?

Sorry as I am newbie to OpenBSD but I have given info what was asked during installation and what I provided. Gateway was not asked during install and Can these settings be modified after install. I cannot find a good documentation about it. Either way @unman can you suggest me if what should I have provided in these settings. Are those should be-
IPV4 address 10.137.0.35
netmask 255.255.255.255
IPV6 none
Default IPV4 10.137.0.35

Although I gave DNS address from basic tab itself.
Where to put gateway.
Qubes provided gateway to OpenBSD hvm is 10.138.7.37
One last thing do I have to configure xnf0 or vlan0. My understanding about it is that I have to configure only xnf0.
I understand that this is not OpenBSD forum but there is a documentation on Qubes website about installing openbsd as hvm and that really far away from how I installed it. I cannot understand that doc page. Doesn’t it need an update for current situations.

if qubes settings tells you:

ip: 10.137.0.123
netmask: 255.255.255.255
gateway: 10.137.0.1
dns: 10.139.1.1, 10.139.1.2

you need to have:

in /etc/hostname.xnf0:

inet 10.137.0.123 255.255.255.0

in /etc/mygate:

10.137.0.1

in /etc/resolv.conf:

nameserver 10.139.1.1

that should be it

then run sh /etc/netstart xnf0

forget about vlan0

sometimes the nic gets stuck. just reboot the qube if config is correct but cant ping default gw or 8.8.8.8

/etc/hostname.xnf0 tells
inet 10.137.0.35 netmask 0*ffffff00
when I try vi /etc/mygate it shows empty file. When I tried to put 10.138.7.37 there, I was unable to do same as it was readonly even when I was logged in as root. Then I tried cat /etc/mygate it shows file not exist.
Then I tried -

route add 10.137.0.35 -netmask 255.255.255.0 10.138.7.37

result was -
add net 10.137.0.35: gateway 10.138.7.37: Network is unreachable.

I also used sh /etc/netstart xnf0 and also used reboot, results were same.

You have to have a gateway set in /etc/mygate.
Just create that file with the content:
10.138.7.37

You cant set a route as you have because the system doesn’t know how to
get to the gateway that you have set in that route.

just noticed your gw/netvm is 10.138.7.37 and your qube ip is 10.137.0.35…you are using a disposable qube for netvm?

you will need additional routing to make it work since qube+netvm/gw subnets are diff but they are ‘directly’ connected.

use this in /etc/hostname.xnf0:

inet 10.137.0.35 255.255.255.0
!route add -iface -cloning 10.138.7.37 10.137.0.35

and in /etc/mygate:

10.138.7.37

the !route in hostname.xnf0 makes sure bsd knows how to reach the default gw since its separate subnet

Good catch