diff --git a/vm_example_scripts/freebsd/init_freebsd.sh b/vm_example_scripts/freebsd/init_freebsd.sh new file mode 100644 index 0000000..64d062a --- /dev/null +++ b/vm_example_scripts/freebsd/init_freebsd.sh @@ -0,0 +1,30 @@ +#!/bin/csh + +# Variables +set IP = "$1" +set HOSTNAME = "$2" +set IP_RANGE = `echo "$IP" | sed 's/\.[0-9]*$//'` +set IP_GATEWAY = "1" +set IP_NETMASK = "255.255.255.0" + +# Jail related config (assuming you need these) +sysrc jail_enabled="YES" +sysrc cloned_interfaces="lagg0" +echo ".include "/etc/jail.conf.d/*.conf";" > /etc/jails.conf + +# Set hostname +sysrc hostname="$HOSTNAME.local" + +# Set IP +sysrc ifconfig_em0="inet $IP netmask $IP_NETMASK broadcast $IP_RANGE.255" +sysrc defaultrouter="$IP_RANGE.$IP_GATEWAY" + +# Set DNS +cat > /etc/resolv.conf << EOF +nameserver 208.67.222.222 +nameserver 208.67.220.220 +EOF + +# Restart network +service netif restart +service routing restart diff --git a/vm_example_scripts/freebsd/jail.conf b/vm_example_scripts/freebsd/jail.conf new file mode 100644 index 0000000..98ce0cc --- /dev/null +++ b/vm_example_scripts/freebsd/jail.conf @@ -0,0 +1,29 @@ +#!/bin/csh + +# Variables +set IP = "$1" +set HOSTNAME = "$2" +set IP_RANGE = `echo "$IP" | sed 's/\.[0-9]*$//'` +set IP_GATEWAY = "1" +set IP_NETMASK = "255.255.255.0" + +# Jail related config (assuming you need these) +sysrc jail_enabled="YES" +sysrc cloned_interfaces="lagg0" + +# Set hostname +sysrc hostname="$HOSTNAME.local" + +# Set IP +sysrc ifconfig_em0="inet $IP netmask $IP_NETMASK broadcast $IP_RANGE.255" +sysrc defaultrouter="$IP_RANGE.$IP_GATEWAY" + +# Set DNS +cat > /etc/resolv.conf << EOF +nameserver 208.67.222.222 +nameserver 208.67.220.220 +EOF + +# Restart network +service netif restart +service routing restart diff --git a/vm_example_scripts/freebsd/jail_manifest.conf b/vm_example_scripts/freebsd/jail_manifest.conf new file mode 100644 index 0000000..64fe86f --- /dev/null +++ b/vm_example_scripts/freebsd/jail_manifest.conf @@ -0,0 +1,22 @@ +_jailname_ { + # STARTUP/LOGGING + exec.start = "/bin/sh /etc/rc"; + exec.stop = "/bin/sh /etc/rc.shutdown"; + exec.poststop = "/sbin/umount -f /usr/local/jails/$name/skeleton; /sbin/umount -f /usr/local/jails/$name"; + exec.consolelog = "/var/log/jail_console_${name}.log"; + + # PERMISSIONS + allow.raw_sockets; + exec.clean; + mount.devfs; + + # HOSTNAME/PATH + host.hostname = "${name}"; + path = "/usr/local/jails/${name}"; + mount.fstab = "/usr/local/jails/jail.fstab.d/$name.fstab"; + + # NETWORK + ip4.addr = 192.168.1._IP_; + #ip6.addr = ::ffff:c0a8:197 + interface = lagg0; +} diff --git a/vm_example_scripts/init_freebsd.sh b/vm_example_scripts/init_freebsd.sh new file mode 100644 index 0000000..98ce0cc --- /dev/null +++ b/vm_example_scripts/init_freebsd.sh @@ -0,0 +1,29 @@ +#!/bin/csh + +# Variables +set IP = "$1" +set HOSTNAME = "$2" +set IP_RANGE = `echo "$IP" | sed 's/\.[0-9]*$//'` +set IP_GATEWAY = "1" +set IP_NETMASK = "255.255.255.0" + +# Jail related config (assuming you need these) +sysrc jail_enabled="YES" +sysrc cloned_interfaces="lagg0" + +# Set hostname +sysrc hostname="$HOSTNAME.local" + +# Set IP +sysrc ifconfig_em0="inet $IP netmask $IP_NETMASK broadcast $IP_RANGE.255" +sysrc defaultrouter="$IP_RANGE.$IP_GATEWAY" + +# Set DNS +cat > /etc/resolv.conf << EOF +nameserver 208.67.222.222 +nameserver 208.67.220.220 +EOF + +# Restart network +service netif restart +service routing restart