1

In the effort to lock down a new Centos box I am building I am installing iptables. I would like to be able to put this in a script so I can do this to other boxes but I am getting some odd errors and the roll back requires a reboot? Installing with

yum install iptables

which works fine, but before reboot:

[root@ip-10-0-0-132 ~]# systemctl start iptables
Failed to issue method call: Unit iptables.service failed to load: No such file or directory.
[root@ip-10-0-0-132 ~]# systemctl enable iptables
Failed to issue method call: Access denied
[root@ip-10-0-0-132 ~]#

and after

[root@ip-10-0-0-132 ~]# systemctl enable iptables
ln -s '/usr/lib/systemd/system/iptables.service' '/etc/systemd/system/basic.target.wants/iptables.service'
[root@ip-10-0-0-132 ~]# systemctl start iptables
[root@ip-10-0-0-132 ~]#

I am new to systemd and if this is completely trivial please point me to a man page/guide/wiki so I can research this. I just haven't found anything obvious as yet.

Acyclic Tau
  • 111
  • 1
  • 1
  • 4
  • Is there a reason you are using `iptables` instead of `firewalld`? – Vasili Syrakis Apr 21 '15 at 13:27
  • yes. I don't need any of the complexity at all – Acyclic Tau Apr 21 '15 at 14:06
  • Often times uniformity is the ideal. I know we're disabling `firewalld` for RHEL7 and going with iptables just because we also have a lot of RHEL5 and RHEL6. Once we start deploying RHEL 8 we'll probably re-visit using firewalld in production. Until then it's an idiosyncrasy we can just disable to make RHEL7 look as much like RHEL6 as possible. – Bratchley Dec 22 '15 at 16:16

1 Answers1

3

You may need to reload systemd after adding\updating services ("units" on systemd language).

See

daemon-reload

Reload systemd manager configuration. This will rerun all generators (see systemd.generator(7)), reload all unit files, and recreate the entire dependency tree. While the daemon is being reloaded, all sockets systemd listens on behalf of user configuration will stay accessible.

http://www.freedesktop.org/software/systemd/man/systemctl.html

Alex
  • 31
  • 1