Unit iptables.service failed to load: No such file or directory.
Posted: 2023 May 03, 21:23
Error
Install iptables.service
Disable and stop firewalld
Check if iptables is printing any output
Enable iptables.service
Code: Select all
[root @ fedora ~]$ service iptables restart
Redirecting to /bin/systemctl restart iptables.service
Failed to restart iptables.service: Unit iptables.service failed to load: Noa such file or directory.
Code: Select all
[root @ fedora ~]$ yum install iptables-services -y
Yum command has been deprecated, redirecting to '/usr/bin/dnf install iptables-services'.
See 'man dnf' and 'man yum2dnf' for more information.
To transfer transaction metadata from yum to DNF, run:
'dnf install python-dnf-plugins-extras-migrate && dnf-2 migrate'
Last metadata expiration check performed 1:11:53 ago on Tue Sep 15 17:40:53 2015.
Dependencies resolved.
=====================================================================
Package Arch Version Repository Size
=====================================================================
Installing:
iptables-services x86_64 1.4.21-14.fc22 fedora 53 k
Transaction Summary
=====================================================================
Install 1 Package
Total download size: 53 k
Installed size: 19 k
Is this ok [y/N]: y
Downloading Packages:
iptables-services-1.4.21-14.fc22.x86_64.rpm 744 kB/s | 53 kB 00:00
-----------------------------------------------------------------------------------------------
Total 45 kB/s | 53 kB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Installing : iptables-services-1.4.21-14.fc22.x86_64 1/1
Verifying : iptables-services-1.4.21-14.fc22.x86_64 1/1
Installed:
iptables-services.x86_64 1.4.21-14.fc22
Complete!
Code: Select all
[root @ fedora ~]$ systemctl disable firewalld.service
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
[root @ fedora ~]$ systemctl stop firewalld.service
Code: Select all
[root @ fedora ~]$ iptables -vnL
Chain INPUT (policy ACCEPT 18 packets, 1616 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 16 packets, 1712 bytes)
pkts bytes target prot opt in out source destination
Code: Select all
[root @ fedora ~]$ systemctl enable iptables.service
Created symlink from /etc/systemd/system/basic.target.wants/iptables.service to /usr/lib/systemd/system/iptables.service.