Reputation: 181
I try for two or three hours , to exec a command with a script during the boot of fedora 23.
I see some tutorials with chkconfig but on my fedora, i have only systemctl, chkconfig is too old no ?.
I try to create a service but even when i exec : systemctl enable my_service
after the reboot , that does not exec my service. manually systemctl start my_service
works.
But more weird it's that the service starts because when i write systemctl list-unit-files –type=service
, i see my iptablesvpn.service enable . So really i don't understand why the command inside the script is not executed or maybe to soon, i don't know :/
So i trieda other solution which is to add a script in /etc/init.d/script.sh
with a chmod +x on it. But even that does not work.
I just want to restore iptables after the reboot. So i want something like: /sbin/iptables-restore /etc/firewall.rules
. After the boot, if i write this command in a terminal, that work and my vpn is happy but if don't write this command my vpn does not work.
So if you can help me to exec this command line , i will be happy because that seems to be very simple but it's not for me :/. Thank you
Upvotes: 1
Views: 1763
Reputation: 181
This is my process which work even if it's not optimized with the script shell at the boot :
1)
iptables -F
iptables -P INPUT ACCEPT
iptables -F
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp –dport 22 -j ACCEPT
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
iptables -L -v
2) Edit /etc/sysconfig/iptables-config and put "yes" instead of "no" about iptables save options on Fedora stop and restart
3) Create a script shell in /etc/rc.d/rc.local where i write service iptables restart
and it's good :)
You see something useless or weird in this process ?
Upvotes: 1