* network setup script: /opt/custom/bin/net-setup
#+BEGIN_SRC bash
set -x
/usr/sbin/ipadm delete-addr vnic0/v4
/usr/sbin/ipadm delete-addr vnic0/v6
/usr/sbin/ipadm delete-if vnic0
/usr/sbin/dladm delete-vnic vnic0
echo cleanup done
set -eu
echo -n creating vnic ...
if /usr/sbin/dladm create-vnic -m auto -l private0 vnic0; then
echo success!;
else
echo fail;
fi
echo -n creating ipv4 addr ...
if /usr/sbin/ipadm create-addr -T static -a $IPV4_ADDR/$IPV4_SUBNET vnic0/v4; then
echo success!
else
echo fail;
fi
echo -n creating ipv6 addr ...
if /usr/sbin/ipadm create-addr -T static -a $IPV6_ADDR/$IPV6_SUBNET vnic0/v6; then
echo success!
else
echo fail;
fi
/usr/sbin/routeadm -u -e ipv4-forwarding
/usr/sbin/routeadm -u -e ipv6-forwarding
#+END_SRC
* smf conf: /opt/custom/smf
#+BEGIN_SRC xml
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type='manifest' name='site:net-setup'>
<service name='site/net-setup' type='service' version='1'>
<create_default_instance enabled='true' />
<single_instance />
<dependency name='net-physical' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/network/physical'/>
</dependency>
<dependency name='filesystem' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/filesystem/local'/>
</dependency>
<exec_method type='method' name='start' exec='/opt/custom/bin/net-setup' timeout_seconds='0' />
<exec_method type='method' name='stop' exec=':true' timeout_seconds='0' />
<property_group name='startd' type='framework'>
<propval name='duration' type='astring' value='transient' />
</property_group>
<stability value='Unstable' />
</service>
</service_bundle>
#+END_SRC