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 if ! yum -y install iptables-services; then
22 printf '%s\n' 'nat_setup.sh: Unable to install iptables-services' >&2
26 ##start and enable iptables service
27 if ! systemctl start iptables; then
28 printf '%s\n' 'nat_setup.sh: Unable to start iptables-services' >&2
32 systemctl enable iptables
34 ##enable IP forwarding
35 echo 1 > /proc/sys/net/ipv4/ip_forward
38 /sbin/iptables -t nat -I POSTROUTING -o enp0s10 -j MASQUERADE
39 /sbin/iptables -I FORWARD 1 -i enp0s10 -o enp0s8 -m state --state RELATED,ESTABLISHED -j ACCEPT
40 /sbin/iptables -I FORWARD 1 -i enp0s8 -o enp0s10 -j ACCEPT
41 /sbin/iptables -I INPUT 1 -j ACCEPT
42 /sbin/iptables -I OUTPUT 1 -j ACCEPT