change the default gateway

My maas environment contains a PXE vlan and a data vlan. I find that the default gateway is the gateway of the PXE network after the OS is deployed, but I want the gateway of the data vlan as the default gateway. So after a few tries, I find that setting the “Subnet” and “IP mode” of the PXE network on the network tab to “Unconfigured” before deploying the OS works, but this also causes the PXE network not to have an IP address configured. My question is, if the PXE network and the data network of the server are independent of each other, can I not assign IP address to the PXE network and if it’s true will this cause problems in later use?
Thank you.

I think our situation is similar to what you describe: separate vlans for PXE and data. What we’ve done is configure the subnets in MAAS so that only the data subnet has a Gateway configured. The PXE subnet leaves the Gateway entry blank. Then, after a machine deploys it has only one default gateway: the data vlan.
To address your question specifically: we assign static IP addresses to both the PXE and data NICs to a machine before we deploy it. This setup is working well for us. Let me know if it works for you as well.

Hello jb-ubuntu1,
Thanks for the answer. Our yum / apt repository is in a different subnet from PXE, so the OS deployment of maas will fail if we don’t configure a gateway for PXE subnet. PXE subnet is useless to us after the OS deployment, which means that I do not need to keep PXE network for a long time. I already found a way to configure and use PXE network only during deployment and do not retain PXE network after deployment, but I am not sure whether this will bring subsequent use problems. I want to confirm this. Thank you.