Keeping ebtables Rules After a Reboot
- Make sure the iptables-persistent package is installed on your system. If it is not, install it with the following command (for Debian/Ubuntu):
or for RHEL/CentOS/Fedora:sudo apt-get install iptables-persistentsudo yum install iptables-services - Create the /etc/ebtables directory if it does not exist yet:
sudo mkdir -p /etc/ebtables - Create a rules file in the /etc/ebtables directory:
sudo touch /etc/ebtables/rules - Save the current ebtables rules to the file:
sudo ebtables-save > /etc/ebtables/rules - Create a new systemd service file (for example, /etc/systemd/system/ebtables.service) with the following contents:
[Unit] Description=Ebtables rules loader After=network.target [Service] Type=oneshot ExecStart=/sbin/ebtables-restore /etc/ebtables/rules RemainAfterExit=yes [Install] WantedBy=multi-user.target - Reload the systemd configuration and enable the new service:
sudo systemctl daemon-reload sudo systemctl enable ebtables.service - Check that the service works correctly by starting it manually:
sudo systemctl start ebtables.service