All commands here should be run on the same terminal (because of the exported name variable).
export SERVICE_NAME_LO=multicast-lo.service
sudo nano /etc/systemd/system/$SERVICE_NAME_LO
Paste the following into the file:
[Unit]
Description=Enable Multicast on Loopback
[Service]
Type=oneshot
ExecStart=/usr/sbin/ip link set lo multicast on
[Install]
WantedBy=multi-user.target
Press following in order to save
Ctrl+X
Y
Enter
# Make it recognized
sudo systemctl daemon-reload
# Make it run on startup
sudo systemctl enable $SERVICE_NAME_LO
# Start it now
sudo systemctl start $SERVICE_NAME_LO
mfc@mfc-leo:~$ sudo systemctl status $SERVICE_NAME_LO
○ multicast-lo.service - Enable Multicast on Loopback
Loaded: loaded (/etc/systemd/system/multicast-lo.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Mon 2024-07-08 12:54:17 +03; 4s ago
Process: 22588 ExecStart=/usr/bin/ip link set lo multicast on (code=exited, status=0/SUCCESS)
Main PID: 22588 (code=exited, status=0/SUCCESS)
CPU: 1ms
Tem 08 12:54:17 mfc-leo systemd[1]: Starting Enable Multicast on Loopback...
Tem 08 12:54:17 mfc-leo systemd[1]: multicast-lo.service: Deactivated successfully.
Tem 08 12:54:17 mfc-leo systemd[1]: Finished Enable Multicast on Loopback.
mfc@mfc-leo:~$ ip link show lo
1: lo: <LOOPBACK,MULTICAST,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00