OPNsense VM can't boot and assigns wrong address after changing Proxmox IP address

dmpm

Member
Dec 29, 2023
53
2
8
My LAN was originally on the 192.168.1.x subnet but I had to change it on the router to 192.168.0.x to avoid clashing with my Dad's network when I'm connected to that via Tailscale.

My Proxmox box was originally on 192.168.1.113 and I changed it to 192.168.0.199 and set the gateway to 192.168.0.1 by editing /etc/network/interfaces and /etc/hosts.

I edited the conf files in /etc/pve/lxc/ for my two lxcs to set them to 192.168.0.101 and 192.168.0.102. The LXCs were still using the 192.168.1.x addresses after doing that, so I also had to edit the conf files in /etc/pve/nodes/pve/lxc to change the addresses. I don't really understand why these files are duplicated and why changing the ones in /etc/pve/lxc files isn't sufficient, as that suggests that they're ignored and redundant. Anyway, the LXCs are working now.

The problem I have is with my OPNsense VM, as that gets stuck booting now at "Configuring WAN interface". There's no fixed IP address set in the conf files in /etc/pve/qemu-server/ or /etc/pve/nodes/pve/qemu-server.

I tried creating a new OPNsense VM, but after that finished installing it said that it was running on 192.168.1.1 and I don't understand where it got that address from. I went into the shell from the OPNsense menu and changed the address in /etc/hosts and rebooted, and then I used the menu to assign vtnet0 to the LAN and it still gave it the 192.168.1.1 address again, so I had to change it to 192.168.0.2 via the menu and then I could access the OPNsense GUI on that address.

I'd like to know how to fix the problem with my original OPNsense VM that's not booting at the moment, and also find out where the new VM is getting the 192.168.1.1 address from, as that's likely to affect any further VMs that I create, and this will help me understand how Proxmox works and enable me to fix any similar problems in future.
 
Hello!
The network config is done not by editing files directly but into the GUI of ProxMox into your node settings at this place:

When managing from there everything is setuped correctly into the proxmox nodes!


1703918805897.png
 
Hi,

I don't think it really matters whether you change the network config via the GUI or by editing the conf files manually. The GUI reflects the changes that I made to /etc/network/interfaces and /etc/hosts, as shown in the image below. I don't think there's any way to set a static IP address for each LXC or VM via the GUI, so that has to be done by editing the conf files.

Anyway, the main issue is with the OPNsense VM getting the wrong address, as you can't login to the OPNsense GUI to configure it until it has a valid address. I had to manually edit the /etc/hosts file in the OPNsense shell to change the address from 192.168.1.1. to 192.168.0.2, but I don't understand where it got 192.168.1.1 from, as my router and Proxmox aren't using that subnet.

Proxmox M720q network.png
 
I guess that works for most people as they're on the 192.168.1.x subnet, but for people like me who are on a different subnet, 192.168.1.1 isn't accessible. I should ask about this on the OPNsense forum though, as if it's hardcoded to default to 192.168.1.1 that's not a Proxmox issue.