0

I did try to initialize a dummy interface in shell manually without no problem. In order to bring up this interface at every boot up process, then i tried to add it to /etc/bashrc or /etc/profile as below:

ip link set name eth0 dev dummy0
ip link set eth0 address d0:17:c2:a9:a5:5e
ifconfig eth0 hw ether d0:17:c2:a9:a5:5e

‌I also added below config to /etc/modules-load.d/dummy.conf but it did not worked as well.

/sbin/ip link set name eth0 dev dummy0
  • you can't if your not root – Kiwy Aug 23 '18 at 18:12
  • @Kiwy does /etc/bashrc run in root user? – VSB Aug 23 '18 at 18:22
1

In most of the distros the answer for executing commands at the boot is /etc/rc.local (today this includes redhat and new versions of debian, but you need to create the rc.local file first). So create a script as /etc/rc.local (if it does not exists - if it is already there, just include the lines before exit 0).

The file contents must have an exit 0 on the end.

#!/bin/bash

ip link set name eth0 dev dummy0
ip link set eth0 address d0:17:c2:a9:a5:5e
ifconfig eth0 hw ether d0:17:c2:a9:a5:5e 

exit 0 

and after that remember to make it executable with:

chmod +x /etc/rc.local

If that works for you please mark this as the correct answer.

In the most of cases you don't want to create a service or to use another solution that can change the peace with your boot system, as rc.local is a "user place" for doing things like that.

Good Lucky!

  • chmod +x etc/rc.d/rc.local is also required. – VSB Aug 24 '18 at 23:30
0

Surely not /etc/bashrc or /etc/profile This is for bash session or login profile. Used when you start bash or log in

Depends on your linux distro. But in red hat you would create file in /etc/sysconfig/network-scripts Look documentation for detail

  • 1
    Is it possible to bring up a dummy interface in /etc/sysconfig/network-scrips during boot up? I could not find a good solution yet – VSB Aug 23 '18 at 18:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.