# Save ip link macvlan interfaces after reboot

**URL:** <https://forum.openwrt.org/t/save-ip-link-macvlan-interfaces-after-reboot/5215>\
**Category:** Installing and Using OpenWrt\
**Created:** [July 22, 2017, 1:38pm UTC](https://forum.openwrt.org/t/save-ip-link-macvlan-interfaces-after-reboot/5215 "2017-07-22T13:38:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![steom](https://forum.openwrt.org/letter_avatar/steom/32/5_5575768a8748004e209b776fc1b2916d.png) [@steom](https://forum.openwrt.org/u/steom)\
**Post date:** [July 22, 2017, 1:38pm UTC](https://forum.openwrt.org/t/save-ip-link-macvlan-interfaces-after-reboot/5215/1 "2017-07-22T13:38:15Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![golialive](https://forum.openwrt.org/user_avatar/forum.openwrt.org/golialive/32/816_2.png) [@golialive](https://forum.openwrt.org/u/golialive)\
**Post date:** [July 24, 2017, 2:05pm UTC](https://forum.openwrt.org/t/save-ip-link-macvlan-interfaces-after-reboot/5215/2 "2017-07-24T14:05:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![trismo](https://forum.openwrt.org/letter_avatar/trismo/32/5_5575768a8748004e209b776fc1b2916d.png) [@trismo](https://forum.openwrt.org/u/trismo)\
**Post date:** [July 24, 2017, 6:55pm UTC](https://forum.openwrt.org/t/save-ip-link-macvlan-interfaces-after-reboot/5215/3 "2017-07-24T18:55:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![azuwis](https://forum.openwrt.org/user_avatar/forum.openwrt.org/azuwis/32/1004_2.png) [@azuwis](https://forum.openwrt.org/u/azuwis)\
**Post date:** [July 25, 2017, 5:19am UTC](https://forum.openwrt.org/t/save-ip-link-macvlan-interfaces-after-reboot/5215/4 "2017-07-25T05:19:42Z")

</div>

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`.

---

<div class="post-metadata">

**Author:** ![steom](https://forum.openwrt.org/letter_avatar/steom/32/5_5575768a8748004e209b776fc1b2916d.png) [@steom](https://forum.openwrt.org/u/steom)\
**Post date:** [July 25, 2017, 11:44am UTC](https://forum.openwrt.org/t/save-ip-link-macvlan-interfaces-after-reboot/5215/5 "2017-07-25T11:44:41Z")

</div>

> [@azuwis](#):
>
> 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`.

thanks works great!
