Perhaps some basic troubleshooting? Forgive me if any of this insults your intelligence 
- Is the script executable?
- Have you tried creating a log to identify any errors?
- Would placing the script in
/rw/config/qvm-start.d/
work?
Would this work?
1. Create the Script
First, you need to create a script that will create the dummy interfaces. You can place this script in a suitable directory, such as /usr/local/bin/
. Here’s an example script:
bash
#!/bin/bash
# Create dummy interfaces
for i in {0..2}; do
ip link add name dummy$i type dummy
ip link set dummy$i up
done
Save this script as create_dummy_interfaces.sh
and make it executable:
bash
sudo chmod +x /usr/local/bin/create_dummy_interfaces.sh
2. Create a systemd Service
Next, you need to create a systemd service that will execute this script when the network is up. Create a new service file in /etc/systemd/system/
:
bash
sudo nano /etc/systemd/system/create-dummy-interfaces.service
Add the following content to the service file:
ini
[Unit]
Description=Create Dummy Network Interfaces
After=network.target
[Service]
Type=oneshot
ExecStart=/usr/local/bin/create_dummy_interfaces.sh
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
- Description: A brief description of what the service does.
- After: Ensures that the service runs after the network is up.
- Type=oneshot: Indicates that the service will perform a single task and then exit.
- ExecStart: The command to execute (your script).
- RemainAfterExit=yes: Keeps the service active after the script has run, which can be useful for tracking the service status.
- WantedBy: Specifies when the service should be started.
3. Enable the Service
After creating the service file, you need to enable it so that it starts automatically on boot:
bash
sudo systemctl enable create-dummy-interfaces.service
4. Start the Service Manually (Optional)
If you want to test the service immediately without rebooting, you can start it manually:
bash
sudo systemctl start create-dummy-interfaces.service
You can check the status of the service to ensure it ran successfully:
bash
sudo systemctl status create-dummy-interfaces.service
5. Verify the Dummy Interfaces
After starting the service, you can verify that the dummy interfaces have been created:
bash
ip link show
You should see interfaces named dummy0
, dummy1
, and dummy2
listed.
Additional Considerations
- Logging: If you want to log the output of your script, you can modify the script to redirect output to a log file. For example:
bash
echo "Created dummy interface dummy$i" >> /var/log/dummy_interfaces.log