[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Iptables at boot



On 21/01/18 16:05, Mark Fletcher wrote:
To get you started [addressing the OP], here is the service file I use:

Mine is slightly different and has the commands inline:


$ cat /etc/iptables/iptables.service
[Unit]
Description=iptables rules
After=network.target

[Service]
Type=oneshot
ExecStart=/bin/bash -c "/sbin/iptables-restore < /etc/iptables/iptables.rules" ExecStart=/bin/bash -c "/sbin/ip6tables-restore < /etc/iptables/ip6tables.rules"
RemainAfterExit=yes
ExecStop=/sbin/iptables -F
ExecStop=/sbin/ip6tables -F

[Install]
WantedBy=multi-user.target


You can make your initial rules file with iptables-save.

Kind regards,

--
Ben Caradoc-Davies <ben@transient.nz>
Director
Transient Software Limited <https://transient.nz/>
New Zealand


Reply to: