Skip to content

Instantly share code, notes, and snippets.

@xmfcx
Last active July 8, 2024 10:07
Show Gist options
  • Save xmfcx/8363ff0a5c7814cfb93dedb0e13e88bd to your computer and use it in GitHub Desktop.
Save xmfcx/8363ff0a5c7814cfb93dedb0e13e88bd to your computer and use it in GitHub Desktop.

Enable multicast on lo on startup

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

  1. Ctrl+X
  2. Y
  3. 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

Validate

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment