Maybe Im stupid, but I cant figure out the syntax in rc.conf for multiple ips.


You might try this patch against /etc/rc.d/jail to help starting multi- IPv4/v6/no-IP jails

Just the 1st iteration

open issues

* add support for no-IP jails
* handle ipv6 addresses more cleanly (support notations like 2001:888:1029::10.1.1.1, 2001:888:1029:0:0:0:0:1)

this is because you'll get "address not assigned" errors because ifconfig doesn't seem to make the v6 address canonical. This only happens when you stop the jail btw.

you'll need to stuff v6 stuff in _ipv6 variables though.


--- /etc/rc.d/jail	2008-06-20 12:48:19.000000000 +0200
+++ /usr/src/etc/rc.d/jail	2008-02-12 22:08:20.000000000 +0100
@@ -39,7 +39,6 @@
 	_procdir="${_rootdir}/proc"
 	eval _hostname=\"\$jail_${_j}_hostname\"
 	eval _ip=\"\$jail_${_j}_ip\"
-	eval _ipv6=\"\$jail_${_j}_ipv6\"
 	eval _interface=\"\${jail_${_j}_interface:-${jail_interface}}\"
 	eval _exec=\"\$jail_${_j}_exec\"
 	eval _exec_start=\"\${jail_${_j}_exec_start:-${jail_exec_start}}\"
@@ -93,7 +92,6 @@
 	debug "$_j mount enable: $_mount"
 	debug "$_j hostname: $_hostname"
 	debug "$_j ip: $_ip"
-	debug "$_j ipv6: $_ipv6"
 	debug "$_j interface: $_interface"
 	debug "$_j root: $_rootdir"
 	debug "$_j devdir: $_devdir"
@@ -297,12 +295,7 @@
 			continue;
 		fi
 		if [ -n "${_interface}" ]; then
-			for __ip in ${_ip}; do
-				ifconfig ${_interface} alias ${__ip} netmask 255.255.255.255
-			done
-			for __ipv6 in ${_ipv6}; do
-				ifconfig ${_interface} inet6 alias ${__ipv6} prefixlen 128
-			done
+			ifconfig ${_interface} alias ${_ip} netmask 255.255.255.255
 		fi
 		if checkyesno _mount; then
 			info "Mounting fstab for jail ${_jail} (${_fstab})"
@@ -358,7 +351,7 @@
 		fi
 		_tmp_jail=${_tmp_dir}/jail.$$
 		eval jail ${_flags} -i ${_rootdir} ${_hostname} \
-			$(echo ${_ip} ${_ipv6} | tr ' ' ',') ${_exec_start} > ${_tmp_jail} 2>&1
+			${_ip} ${_exec_start} > ${_tmp_jail} 2>&1
 
 		if [ "$?" -eq 0 ] ; then
 			_jail_id=$(head -1 ${_tmp_jail})
@@ -380,12 +373,7 @@
 		else
 			jail_umount_fs
 			if [ -n "${_interface}" ]; then
-				for __ip in ${_ip}; do
-					ifconfig ${_interface} -alias ${_ip}
-				done
-				for __ipv6 in ${_ipv6}; do
-					ifconfig ${_interface} inet6 ${_ipv6} -alias 
-				done
+				ifconfig ${_interface} -alias ${_ip}
 			fi
 			echo " cannot start jail \"${_jail}\": "
 			tail +2 ${_tmp_jail}
@@ -416,12 +404,7 @@
 				echo -n " $_hostname"
 			fi
 			if [ -n "${_interface}" ]; then
-				for __ip in ${_ip}; do
-					ifconfig ${_interface} -alias ${_ip}
-				done
-				for __ipv6 in ${_ipv6}; do
-					ifconfig ${_interface} inet6 ${_ipv6} -alias
-				done
+				ifconfig ${_interface} -alias ${_ip}
 			fi
 			rm /var/run/jail_${_jail}.id
 		else



Regards,
        Ruben

Attachment: PGP.sig
Description: This is a digitally signed message part

Reply via email to