Router

Virtual Machine (38.87.162.8):
$ cat /etc/hostname.vio0                                                           
inet 38.87.162.8 0xffffff00
inet6 2602:fccf:1:1008:: 48
$ cat /etc/mygate                                                                  
38.87.162.1
2602:fccf:1::1
Router (38.87.162.1):
/etc/hostname.em0
inet 38.81.163.42 0xfffffff8
inet6 2001:550:3402:40::2 64
/etc/hostname.em1 
inet 38.87.162.1 0xffffff00
inet6 2602:fccf:1::1 48
/etc/mygate                                                                  
38.81.163.41
2001:550:3402:40::1
# sysctl net.inet.ip.arpq.maxlen=1024
# echo "net.inet.ip.arpq.maxlen=1024" >> /etc/sysctl.conf
# sysctl net.inet.ip.forwarding=1
# echo "net.inet.ip.forwarding=1" >> /etc/sysctl.conf
# sysctl net.inet6.ip6.forwarding=1
# echo "net.inet6.ip6.forwarding=1" >> /etc/sysctl.conf

WARNING: em0 and em1 on the router must be on separate subnets. If the subnet mask indicates the two are on the same subnet, the router will not function properly.