3 #NAT setup script to setup NAT from Admin -> Public interface
5 #Called by Vagrantfile in conjunction with deploy.sh
6 #author: Tim Rozet (trozet@redhat.com)
8 #Uses Vagrant and VirtualBox
9 #VagrantFile uses nat_setup.sh which sets up NAT
12 ##make sure firewalld is stopped and disabled
13 if ! systemctl stop firewalld; then
14 printf '%s\n' 'nat_setup.sh: Unable to stop firewalld' >&2
18 systemctl disable firewalld
21 # Major version is pinned to force some consistency for Arno
22 if ! yum -y install iptables-services-1*; then
23 printf '%s\n' 'nat_setup.sh: Unable to install iptables-services' >&2
27 ##start and enable iptables service
28 if ! systemctl start iptables; then
29 printf '%s\n' 'nat_setup.sh: Unable to start iptables-services' >&2
33 systemctl enable iptables
35 ##enable IP forwarding
36 echo 1 > /proc/sys/net/ipv4/ip_forward
39 /sbin/iptables -t nat -I POSTROUTING -o enp0s10 -j MASQUERADE
40 /sbin/iptables -I FORWARD 1 -i enp0s10 -o enp0s8 -m state --state RELATED,ESTABLISHED -j ACCEPT
41 /sbin/iptables -I FORWARD 1 -i enp0s8 -o enp0s10 -j ACCEPT
42 /sbin/iptables -I INPUT 1 -j ACCEPT
43 /sbin/iptables -I OUTPUT 1 -j ACCEPT