# --- # - Install scripts # --- cp ipt-firewall-gateway /usr/local/sbin/ # - If ipv6 is in use.. # - cp ip6t-firewall-gateway /usr/local/sbin/ # --- # - Configuration # --- mkdir -p /etc/ipt-firewall cp conf/default_ports.conf \ conf/include_functions.conf \ conf/load_modules_ipv4.conf \ conf/load_modules_ipv6.conf \ conf/logging_ipv4.conf \ conf/logging_ipv6.conf \ conf/post_decalrations.conf /etc/ipt-firewall/ cp conf/interfaces_ipv4.conf.sample /etc/ipt-firewall/interfaces_ipv4.conf cp conf/main_ipv4.conf.sample /etc/ipt-firewall/main_ipv4.conf # - Adjust files # - /etc/ipt-firewall/interfaces_ipv4.conf # - /etc/ipt-firewall/main_ipv4.conf # - /etc/ipt-firewall/logging_ipv4.conf # - # - If ipv6 is in use.. # - cp conf/interfaces_ipv6.conf.sample /etc/ipt-firewall/interfaces_ipv6.conf cp conf/main_ipv6.conf.sample /etc/ipt-firewall/main_ipv6.conf # - Adjust files # - /etc/ipt-firewall/interfaces_ipv6.conf # - /etc/ipt-firewall/main_ipv4.conf # - /etc/ipt-firewall/logging_ipv6.conf # - # --- # - systemd configuration for service "ipt-firewall-gateway" / "ip6t-firewall-gateway" # --- ## - Create a systemd service ## - # IPv4 # cat < /etc/systemd/system/ipt-firewall.service [Unit] Description=IPv4 Firewall with iptables After=network.target [Service] SyslogIdentifier="ipt-gateway" Type=oneshot RemainAfterExit=yes ExecStart=/usr/local/sbin/ipt-firewall-gateway start ExecStop=/usr/local/sbin/ipt-firewall-gateway stop User=root [Install] WantedBy=multi-user.target EOF # IPv6 # cat < /etc/systemd/system/ip6t-firewall.service [Unit] Description=IPv6 Firewall with ip6tables After=network.target [Service] SyslogIdentifier="ip6t-gateway" Type=oneshot RemainAfterExit=yes ExecStart=/usr/local/sbin/ip6t-firewall-gateway start ExecStop=/usr/local/sbin/ip6t-firewall-gateway stop User=root [Install] WantedBy=multi-user.target EOF ## - Eanable script (for autostart at boot time) ## - systemctl enable ipt-firewall.service systemctl enable ip6t-firewall.service ## - Reload systemd configuration ## - systemctl daemon-reload ## - Start Services ## - systemctl start ipt-firewall systemctl start ip6t-firewall