Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A network restart is leading missing IP address on vm-public #568

Open
osokin opened this issue Nov 25, 2024 · 10 comments
Open

A network restart is leading missing IP address on vm-public #568

osokin opened this issue Nov 25, 2024 · 10 comments

Comments

@osokin
Copy link

osokin commented Nov 25, 2024

Hi,

I've figured our that service netif restart removes IP address from the vm-public interface, and there's no way (except the manual one) to assign IP address to the interface back, i.e.:

# ifconfig vm-public inet 10.0.0.1/24

Would that be good idea to move vm-public initialization to /etc/rc.conf and make that explicitly.

@akrivulya
Copy link

As a workaround one's can create bridge interface with /etc/rc.conf and make vm's switch of type manual.

@osokin
Copy link
Author

osokin commented Nov 26, 2024

As a workaround one's can create bridge interface with /etc/rc.conf and make vm's switch of type manual.

Just to make that a bit more clear, so /etc/rc.conf records should be something like the following:

cloned_interfaces="vm-public"
ifconfig_vm-public="addm wlan0" # change the interface's name on your taste
config_vm-public="inet 10.0.1.1/24 up"

Is there anything needs to add/change in /vm/.config/system.conf file?

@akrivulya
Copy link

Something like this in /etc/rc.conf:

cloned_interfaces="bridge0"
ifconfig_bridge0="addm wlan0 name vm-public 10.0.1.1/24" # change the interface's name on your taste
ifconfig_wlan0="up"

and then
# vm switch create -t manual -b vm-public vm-public

@osokin
Copy link
Author

osokin commented Nov 27, 2024

Something like this in /etc/rc.conf:

cloned_interfaces="bridge0"
ifconfig_bridge0="addm wlan0 name vm-public 10.0.1.1/24" # change the interface's name on your taste
ifconfig_wlan0="up"

and then # vm switch create -t manual -b vm-public vm-public

That doesn't work. Also, it would be great to avoid using - symbol in the network interfaces names. Would that be good idea to rename vm-public to vmpublic0 or so?

@akrivulya
Copy link

Also, it would be great to avoid using - symbol in the network interfaces names. Would that be good idea to rename vm-public to vmpublic0 or so?

Generally speaking if you need to configure vm-public0 network interface in /etc/rc.conf it must be present as vm_public0, for example:
ifconfig_vm_public0="DHCP"

This configuration works for me:

cloned_interfaces="bridge0"
create_args_bridge0="link 58:9c:fc:b1:dc:6d"
ifconfig_bridge0="192.168.254.1/27 name vm-LAN"

@osokin
Copy link
Author

osokin commented Nov 27, 2024

Also, it would be great to avoid using - symbol in the network interfaces names. Would that be good idea to rename vm-public to vmpublic0 or so?

Generally speaking if you need to configure vm-public0 network interface in /etc/rc.conf it must be present as vm_public0, for example: ifconfig_vm_public0="DHCP"

This configuration works for me:

cloned_interfaces="bridge0"
create_args_bridge0="link 58:9c:fc:b1:dc:6d"
ifconfig_bridge0="192.168.254.1/27 name vm-LAN"

Thanks. I've decided to use bridge0 interface name in the vm-bhyve configuration files.

@GogoFC
Copy link

GogoFC commented Jan 16, 2025

I was just wondering why assign an IP to a switch?

@akrivulya
Copy link

I was just wondering why assign an IP to a switch?

For example if hypervisor is a gateway for VM's network.

@GogoFC
Copy link

GogoFC commented Jan 16, 2025

I'm not an expert but I understand some. So do you have bunch of different networks? I've only figured out how to use the physical router with the switch and then some other virtual switches but for those I have VMs running as routers. I haven't figured out how to do pf to do routing on the host. It would be nice to have website dedicated to bhyve showcase of people's setup.

@akrivulya
Copy link

Yes, in some cases hardware router or router in VM may be a little overhead. pf nat on hypervisor also can do it. Even more, for example we have a lot of customers vm's running inside vnet jails with custom pf rules and ip addressing. Each jail has an internal bridge for vm's network with ip address assigned which acts as a gateway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants