init commit

This commit is contained in:
2025-09-14 14:22:00 -07:00
commit 0fcf53e525
14 changed files with 1065 additions and 0 deletions

37
tasks/config_routing.yaml Normal file
View File

@ -0,0 +1,37 @@
---
###############################################
# Configure internet_interface to be gateway
###############################################
# Update sysctl.conf file to enable IP forwarding
- name: sysctl - enable IP forwarding
lineinfile:
path: /etc/sysctl.conf
regexp: '^net.ipv4.ip_forward='
line: 'net.ipv4.ip_forward=1'
# Apply sysctl changes
- name: sysctl - apply changes
shell: sysctl -p
# Set up NAT with iptables
- name: NAT - iptables
shell: iptables -t nat -A POSTROUTING -o {{ internet_interface }} -j MASQUERADE
# Set up Routing with IP Tables
- name: Routing - iptables
shell: |
iptables -A FORWARD -i {{ listen_interface }} -o {{ internet_interface }} -j ACCEPT
iptables -A FORWARD -i {{ internet_interface }} -o {{ listen_interface }} -m state --state RELATED,ESTABLISHED -j ACCEPT
# Make iptables rules persistent
- name: Persistence - iptables
shell: |
netfilter-persistent save
netfilter-persistent reload
...