Hello,
I realize there is a similar topic on the main page by a different user I was just not sure how similar it is to what I'm trying to do so please bare with me.
I compiled my kernel with vimage (network virtualization project for freebsd) and was able to start two jails with a bridge on the main host, so I was able to establish communication between the two jails (using ping) and each jail would have its separate network stack.
I have done all of this using commands, what I want to know is how I can incorporate these commands into rc.conf so that the virtualization of network stack starts automatically rather than me having to enter these commands manually on startup.
Here are the commands I use to create the jails, the vnets and the whole configuration
Create a pair of interfaces
[CMD=]root# ifconfig epair create[/CMD]
Create jails with virtual network stacks
[CMD=]root# jail -c vnet name=jail1 host.hostname=jail1 path=/ persist[/CMD]
[CMD=]root# jail -c vnet name=jail2 host.hostname=jail2 path=/ persist[/CMD]
Assign one of the created interfaces to the network stack of the first jail
[CMD=]root# ifconfig epair0b vnet 1[/CMD]
Give it an IP address
[CMD=]root# jexec 1 ifconfig epair0b 192.168.1.2[/CMD]
Give the other interface an IP address
[CMD=]root# ifconfig epair0a 192.168.1.1[/CMD]
Create another pair of virtual interfaces
[CMD=]root# ifconfig epair create[/CMD]
Assign one interface to the network stack of the second jail
[CMD=]root# ifconfig epair1b vnet 2[/CMD]
Give it an IP address
[CMD=]root# jexec 2 ifconfig epair1b 192.168.1.3[/CMD]
Create a bridge to link traffic between the two virtual network stacks of the jails
[CMD=]root# ifconfig bridge create[/CMD]
[CMD=]root# ifconfig bridge0 addm epair0a addm epair1a up[/CMD]
[CMD=]root# ifconfig epair0a -alias[/CMD]
[CMD=]root# ifconfig bridge0 192.168.1.1[/CMD]
[CMD=]root# ifconfig epair1a up[/CMD]
now I have a connection between the jails each on its separate network stack. The guide I was following suggested I added vnet in the jail_flags portion of the rc.conf, yet it failed to give an example. I'm relatively new to FreeBSD, and don't really know my way around rc.conf. Any help would be appreciated.
I realize there is a similar topic on the main page by a different user I was just not sure how similar it is to what I'm trying to do so please bare with me.
I compiled my kernel with vimage (network virtualization project for freebsd) and was able to start two jails with a bridge on the main host, so I was able to establish communication between the two jails (using ping) and each jail would have its separate network stack.
I have done all of this using commands, what I want to know is how I can incorporate these commands into rc.conf so that the virtualization of network stack starts automatically rather than me having to enter these commands manually on startup.
Here are the commands I use to create the jails, the vnets and the whole configuration
Create a pair of interfaces
[CMD=]root# ifconfig epair create[/CMD]
Create jails with virtual network stacks
[CMD=]root# jail -c vnet name=jail1 host.hostname=jail1 path=/ persist[/CMD]
[CMD=]root# jail -c vnet name=jail2 host.hostname=jail2 path=/ persist[/CMD]
Assign one of the created interfaces to the network stack of the first jail
[CMD=]root# ifconfig epair0b vnet 1[/CMD]
Give it an IP address
[CMD=]root# jexec 1 ifconfig epair0b 192.168.1.2[/CMD]
Give the other interface an IP address
[CMD=]root# ifconfig epair0a 192.168.1.1[/CMD]
Create another pair of virtual interfaces
[CMD=]root# ifconfig epair create[/CMD]
Assign one interface to the network stack of the second jail
[CMD=]root# ifconfig epair1b vnet 2[/CMD]
Give it an IP address
[CMD=]root# jexec 2 ifconfig epair1b 192.168.1.3[/CMD]
Create a bridge to link traffic between the two virtual network stacks of the jails
[CMD=]root# ifconfig bridge create[/CMD]
[CMD=]root# ifconfig bridge0 addm epair0a addm epair1a up[/CMD]
[CMD=]root# ifconfig epair0a -alias[/CMD]
[CMD=]root# ifconfig bridge0 192.168.1.1[/CMD]
[CMD=]root# ifconfig epair1a up[/CMD]
now I have a connection between the jails each on its separate network stack. The guide I was following suggested I added vnet in the jail_flags portion of the rc.conf, yet it failed to give an example. I'm relatively new to FreeBSD, and don't really know my way around rc.conf. Any help would be appreciated.