I took @SirDice's advice and just reinstalled all necessary applications and transferred configuration files and user data to the new server, instead of making and restoring an image. In the process, I decided to change my jail setup a little. In the past, I would just set up jails on aliases on the primary interface, for example:
rc.conf
The advantage of this first method being that no NAT is required by PF; it's all done at the router, which although very basic in function, is much simpler than messing around with pf.conf.
On the new system, I decided to create a network on a cloned device for my jails:
rc.conf
The disadvantage with this approach is that it requires a bit of work in /etc/pf.conf:
I am looking for advice as to which method is considered optimal.
Thanks.
rc.conf
Code:
ifconfig_rl0="inet 10.0.0.50/24"
defaultrouter="10.0.0.150"
ifconfig_rl0_alias0="inet 10.0.0.110/24" # srv
ifconfig_rl0_alias1="inet 10.0.0.120/24" # mail
ifconfig_rl0_alias2="inet 10.0.0.100/24" # relay
ifconfig_rl0_alias3="inet 10.0.0.130/24" # rtd
ifconfig
Code:
ath0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 2290
ether 00:16:e3:14:8f:33
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
status: no carrier
rl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=2008<VLAN_MTU,WOL_MAGIC>
ether 00:a0:d1:38:e6:f5
inet 10.0.0.50 netmask 0xffffff00 broadcast 10.0.0.255
inet6 fe80::2a0:d1ff:fe38:e6f5%rl0 prefixlen 64 scopeid 0x2
inet 10.0.0.110 netmask 0xffffffff broadcast 10.0.0.255
inet 10.0.0.120 netmask 0xffffffff broadcast 10.0.0.255
inet 10.0.0.100 netmask 0xffffffff broadcast 10.0.0.255
inet 10.0.0.130 netmask 0xffffffff broadcast 10.0.0.255
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
inet 127.0.0.1 netmask 0xff000000
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
pflog0: flags=141<UP,RUNNING,PROMISC> metric 0 mtu 33184
The advantage of this first method being that no NAT is required by PF; it's all done at the router, which although very basic in function, is much simpler than messing around with pf.conf.
On the new system, I decided to create a network on a cloned device for my jails:
rc.conf
Code:
ifconfig_bge0="inet 10.0.0.55"
defaultrouter="10.0.0.150"
ifconfig_bge0_ipv6="inet6 accept_rtadv"
cloned_interfaces="lo1"
ifconfig_lo1="inet 10.1.1.254 netmask 255.255.255.0"
ifconfig_lo1_alias0="inet 10.1.1.1/32" # srv
ifconfig_lo1_alias1="inet 10.1.1.2/32" # mail
ifconfig
Code:
bge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=8009b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,LINKSTATE>
ether 00:14:22:bd:3f:05
inet 10.0.0.55 netmask 0xff000000 broadcast 10.255.255.255
inet6 fe80::214:22ff:febd:3f05%bge0 prefixlen 64 scopeid 0x1
nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
iwi0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 2290
ether 00:13:ce:56:68:d9
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
status: no carrier
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
inet 127.0.0.1 netmask 0xff000000
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
lo1: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
inet 10.1.1.254 netmask 0xffffff00
inet 10.1.1.1 netmask 0xffffffff
inet 10.1.1.2 netmask 0xffffffff
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
pflog0: flags=141<UP,RUNNING,PROMISC> metric 0 mtu 33184
The disadvantage with this approach is that it requires a bit of work in /etc/pf.conf:
Code:
ext_if="bge0"
tcp_services = "{ ssh, smtp, domain, www, https, pop3, auth, pop3s }"
udp_services = "{ domain }"
JAIL_MAIL="10.1.1.2"
JAIL_SRV="10.1.1.1"
PORT_WWW="{80,443,2222}"
PORT_MAIL="{25,587,465,143,993}"
table <bruteforce> persist
set skip on lo0
scrub in all
!------------------------------[ JAIL ]------------------------------!
nat on $ext_if from lo1:network to any -> $ext_if
rdr pass on $ext_if proto tcp from any to $ext_if port $PORT_WWW -> $JAIL_SRV
rdr pass on $ext_if proto tcp from any to $ext_if port $PORT_MAIL -> $JAIL_MAIL
!------------------------------[ JAIL ]------------------------------!
block all
pass out proto tcp to any port $tcp_services keep state
pass proto udp to any port $udp_services keep state
pass quick proto { tcp, udp } from any to any port ssh \
flags S/SA keep state \
(max-src-conn 15, max-src-conn-rate 5/3, \
overload <bruteforce> flush global)
block quick from <bruteforce>
I am looking for advice as to which method is considered optimal.
Thanks.
Last edited by a moderator: