{"action":"opened","issue":{"url":"https://api.github.com/repos/churchers/vm-bhyve/issues/25","labels_url":"https://api.github.com/repos/churchers/vm-bhyve/issues/25/labels{/name}","comments_url":"https://api.github.com/repos/churchers/vm-bhyve/issues/25/comments","events_url":"https://api.github.com/repos/churchers/vm-bhyve/issues/25/events","html_url":"https://github.com/churchers/vm-bhyve/issues/25","id":115758913,"number":25,"title":"Add support for manually configured bridges to vm switch","user":{"login":"shonjir","id":11600703,"avatar_url":"https://avatars.githubusercontent.com/u/11600703?v=3","gravatar_id":"","url":"https://api.github.com/users/shonjir","html_url":"https://github.com/shonjir","followers_url":"https://api.github.com/users/shonjir/followers","following_url":"https://api.github.com/users/shonjir/following{/other_user}","gists_url":"https://api.github.com/users/shonjir/gists{/gist_id}","starred_url":"https://api.github.com/users/shonjir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shonjir/subscriptions","organizations_url":"https://api.github.com/users/shonjir/orgs","repos_url":"https://api.github.com/users/shonjir/repos","events_url":"https://api.github.com/users/shonjir/events{/privacy}","received_events_url":"https://api.github.com/users/shonjir/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-08T20:46:18Z","updated_at":"2015-11-08T20:46:18Z","closed_at":null,"body":"In my configuration my VMs share the host LAN interface (igb0).  I have a vm switch configured (lan) which creates the bridge0 interface and binds to igb0:\r\n```\r\nswitch_list=\"lan wan\"\r\nports_lan=\"igb0\"\r\nports_wan=\"igb3\"\r\n```\r\nMy rc.conf initially looked like this:\r\n```\r\nifconfig_igb0=\"inet xx.xx.xx.5 netmask 255.255.255.0\"\r\nifconfig_igb0_ipv6=\"inet6 xxxx::5 accept_rtadv\"\r\n```\r\nAfter creating a test fbsd10 VM bound to 'lan', on boot that VM is unable to communicate with the host on IPv6 unless the host first sends a packet to the VM.\r\n\r\nAfter some troubleshooting I was able to narrow this down to the bridge configuration.  Per the FreeBSD handbook, the bridge0 interface must be the addressed interface.  So, this is my 2nd configuration:\r\n```\r\n# new config moving IP to the bridge\r\ncloned_interfaces=\"bridge0\"\r\nifconfig_bridge0=\"addm igb0 up\"\r\nifconfig_bridge0_alias0=\"inet xx.xx.xx.5 netmask 255.255.255.0\"\r\nifconfig_bridge0_ipv6=\"inet6 xxxx::5 accept_rtadv\"\r\nifconfig_igb0=\"up\"\r\nifconfig_igb3=\"up\"\r\n```\r\nThe system comes up properly, but the vm script would not properly bind the tap interfaces to the bridges because they didn't have the vm script bridge identifiers.  So, I added the bridge identifiers and manually specified both bridges:\r\n```\r\n# new config moving IP to the bridge\r\ncloned_interfaces=\"bridge0 bridge1\"\r\nifconfig_bridge0=\"addm igb0 up description vm-lan\"\r\nifconfig_bridge1=\"addm igb3 up description vm-wan\"\r\nifconfig_bridge0_alias0=\"inet xx.xx.xx.5 netmask 255.255.255.0\"\r\nifconfig_bridge0_ipv6=\"inet6 xxxx::5 accept_rtadv auto_linklocal\"\r\nifconfig_igb0=\"up\"\r\nifconfig_igb3=\"up\"\r\n```\r\nThe vm script now binds tap interfaces to the bridges properly, and vm's work as expected. (I added auto_linklocal as because link-local addresses are not automatically added to bridge interfaces even with _sysctl -w net.inet6.ip6.auto_linklocal=1_)\r\n\r\nHowever, because the vm switch configuration automatically configures bridge interfaces there is potential for breakage if switch configuration is modified using 'vm switch' commands.\r\n\r\nIt would be ideal if in the switch configuration supported manually specified bridge interfaces as well as bridge autoconfiguration.  The bridge interface description could be configured by 'vm switch' to preserve existing behavior (in effect, vm would 'adopt' a manually configured bridge).  In such case 'vm switch destroy' should not be able to destroy a bridge that was manually configured.\r\n\r\nThe resulting switch configuration for this feature might look something like this:\r\n```\r\nswitch_list=\"lan wan\"\r\nbridge_lan=\"bridge0\"\r\nbridge_wan=\"bridge1\"\r\n```"}}