Save ip link macvlan interfaces after reboot

hello,

i created the macvlan Ethernet ports as follows:

ip link add link eth0 name veth0 type macvlan
ifconfig veth0 up
ip link add link eth0 name veth1 type macvlan
ifconfig veth1 up

The problem is that when reboot the router, these ports get deleted and have to recreate.

Is there a way to save them so they don't get deleted when power is lost or when the router is rebooted?

Hey there.

You can just add exactly this as startup script.
In LuCI, go to "System > Startup" and scroll to the bottom of the page.

But: What are you trying to do? I get the feeling you're holding it wrong :).

Regards,
Stephan.

1 Like

Or use hotplug script. "/etc/hotplug.d/iface/18-macvlan"
rc.local only execute once after boot.

Add this to /etc/config/network:

config device 'veth0'
	option name 'veth0'
	option type 'macvlan'
	option ifname 'eth0'

config device 'veth1'
	option name 'veth1'
	option type 'macvlan'
	option ifname 'eth0'

And run /etc/init.d/network reload or reboot.

3 Likes

thanks works great!