Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
macvlan support in init scripts
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
totatis
n00b
n00b


Joined: 14 Jan 2006
Posts: 9

PostPosted: Sun Feb 13, 2011 10:13 am    Post subject: macvlan support in init scripts Reply with quote

Hi,

I've configured my box to use macvlans, which work great. However, I'd like to make it static, thus declaring them in init scripts. I haven't been able to find how to declare them in /etc/conf.d/net, the net.example file doesn't mention them. Is there a way to declare macvlans in standard /etc/conf.d/net ? If so, how ? I've searched the forums but top no avail.

Thanks.
Back to top
View user's profile Send private message
gerdesj
l33t
l33t


Joined: 29 Sep 2005
Posts: 621
Location: Yeovil, Somerset, UK

PostPosted: Sun Feb 13, 2011 2:53 pm    Post subject: Re: macvlan support in init scripts Reply with quote

totatis wrote:
Hi,

I've configured my box to use macvlans, which work great. However, I'd like to make it static, thus declaring them in init scripts. I haven't been able to find how to declare them in /etc/conf.d/net, the net.example file doesn't mention them. Is there a way to declare macvlans in standard /etc/conf.d/net ? If so, how ? I've searched the forums but top no avail.

Thanks.


I've just had a quick look around (never heard of macvlans before) but it seems to allow you to create fake additional nics from a base one each with its own mac address. As you say there seems to be no direct support in net.

However assuming that you want to do this with eth0, simply put in a postup and postdown script, put these in net:

Code:

postup() {
   
    if [ "${IFACE}" = "eth0" ]; then
       einfo " ${IFACE} up"
    fi
   
    return 0
}
postdown() {

    if [ "${IFACE}" = "eth0" ]; then
      einfo " ${IFACE} down"
    fi
    return 0
}


Put your commands in where I've put einfo. Something like:

ip link add link eth0 address xx:xx:xx:xx:xx:xx macvlan0 type macvlan

Now I have no idea if you could get away with making a normal init.d symlink for this thing and then use net to configure it. Put in a dependency on eth0 though! If not just put the additional ip commands in the up/down scripts.

Make sure the module gets loaded as well (/etc/conf.d/modules)

Cheers
Jon
Back to top
View user's profile Send private message
totatis
n00b
n00b


Joined: 14 Jan 2006
Posts: 9

PostPosted: Tue Feb 15, 2011 10:07 pm    Post subject: Reply with quote

Thanks for your reply !

Actually, it's the way i've done it at the moment : putting myself some bit of scripts. I was wondering if there was an "official" ie direct way of doing it in net confs.

As you summed up, i've used macvlan to create fake nics on a single physical one, each with its own mac. One good thing about macvlan is that it works as expected with respect to iptables ou iproute2.
Back to top
View user's profile Send private message
gerdesj
l33t
l33t


Joined: 29 Sep 2005
Posts: 621
Location: Yeovil, Somerset, UK

PostPosted: Tue Feb 15, 2011 11:20 pm    Post subject: Reply with quote

totatis wrote:
Thanks for your reply !

Actually, it's the way i've done it at the moment : putting myself some bit of scripts. I was wondering if there was an "official" ie direct way of doing it in net confs.

As you summed up, i've used macvlan to create fake nics on a single physical one, each with its own mac. One good thing about macvlan is that it works as expected with respect to iptables ou iproute2.


And thank you for introducing me to it.

It looks ideal for proper firewalling with only one NIC and a ADSL router that can't do 802.1Q 8)

Perhaps I will submit a feature request bug against OpenRC ...

Cheers
Jon
Back to top
View user's profile Send private message
Gregoire
Apprentice
Apprentice


Joined: 15 Apr 2006
Posts: 292

PostPosted: Sat Nov 03, 2012 10:54 am    Post subject: Re: macvlan support in init scripts Reply with quote

totatis wrote:
Hi,

I've configured my box to use macvlans, which work great. However, I'd like to make it static, thus declaring them in init scripts. I haven't been able to find how to declare them in /etc/conf.d/net, the net.example file doesn't mention them. Is there a way to declare macvlans in standard /etc/conf.d/net ? If so, how ? I've searched the forums but top no avail.

Thanks.


Could you be kind enough to share how you did it ?

I am trying to do something similar whithout much success : dhcp with macvlan ?

Thank you very much.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum