Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
setup up "dummy network interface"
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
unknown2
n00b
n00b


Joined: 14 Aug 2012
Posts: 29

PostPosted: Thu Apr 02, 2015 3:30 am    Post subject: setup up "dummy network interface" Reply with quote

I would like to setup 2 "dummy network interface" using /etc/conf.d/net

http://infocenter.sybase.com/archive/index.jsp?topic=/com.sybase.dc30119_1250/html/aseiglnx/CHDDFIEH.htm

Do anyone knows that if it can be done at all? How?
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2583

PostPosted: Thu Apr 02, 2015 6:54 am    Post subject: Re: setup up "dummy network interface" Reply with quote

unknown2 wrote:
I would like to setup 2 "dummy network interface" using /etc/conf.d/net

http://infocenter.sybase.com/archive/index.jsp?topic=/com.sybase.dc30119_1250/html/aseiglnx/CHDDFIEH.htm

Without js and frames: http://infocenter.sybase.com/archive/topic/com.sybase.dc30119_1250/html/aseiglnx/CHDDFIEH.htm
It starts with # modprobe dummy without telling how to get that driver. As with all SAP documentation you need real expert knowledge about where to find some info.
Back to top
View user's profile Send private message
unknown2
n00b
n00b


Joined: 14 Aug 2012
Posts: 29

PostPosted: Thu Apr 02, 2015 7:31 am    Post subject: Re: setup up "dummy network interface" Reply with quote

charles17 wrote:
unknown2 wrote:
I would like to setup 2 "dummy network interface" using /etc/conf.d/net

http://infocenter.sybase.com/archive/index.jsp?topic=/com.sybase.dc30119_1250/html/aseiglnx/CHDDFIEH.htm

Without js and frames: http://infocenter.sybase.com/archive/topic/com.sybase.dc30119_1250/html/aseiglnx/CHDDFIEH.htm
It starts with # modprobe dummy without telling how to get that driver. As with all SAP documentation you need real expert knowledge about where to find some info.


The dummy network interface are part of Linux kernel

http://www.tldp.org/LDP/nag/node72.html
http://cateee.net/lkddb/web-lkddb/DUMMY.html
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2583

PostPosted: Thu Apr 02, 2015 7:44 am    Post subject: Re: setup up "dummy network interface" Reply with quote

unknown2 wrote:
The dummy network interface are part of Linux kernel

http://www.tldp.org/LDP/nag/node72.html
http://cateee.net/lkddb/web-lkddb/DUMMY.html
Good to know. And your question is about having two network interfaces using that same driver, correct?
Back to top
View user's profile Send private message
unknown2
n00b
n00b


Joined: 14 Aug 2012
Posts: 29

PostPosted: Thu Apr 02, 2015 7:47 am    Post subject: Re: setup up "dummy network interface" Reply with quote

charles17 wrote:
unknown2 wrote:
The dummy network interface are part of Linux kernel

http://www.tldp.org/LDP/nag/node72.html
http://cateee.net/lkddb/web-lkddb/DUMMY.html
Good to know. And your question is about having two network interfaces using that same driver, correct?


Yes, i want to know is it possible to create 2 dummy interface using /etc/conf.d/net ?
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2583

PostPosted: Thu Apr 02, 2015 7:55 am    Post subject: Re: setup up "dummy network interface" Reply with quote

unknown2 wrote:
charles17 wrote:
unknown2 wrote:
The dummy network interface are part of Linux kernel

http://www.tldp.org/LDP/nag/node72.html
http://cateee.net/lkddb/web-lkddb/DUMMY.html
Good to know. And your question is about having two network interfaces using that same driver, correct?


Yes, i want to know is it possible to create 2 dummy interface using /etc/conf.d/net ?
I don't think /etc/conf.d/net could create any interfaces. Maybe someone else knows better:
Back to top
View user's profile Send private message
unknown2
n00b
n00b


Joined: 14 Aug 2012
Posts: 29

PostPosted: Mon Apr 06, 2015 2:16 am    Post subject: Reply with quote

Finally done by adding scripts to /etc/conf.d/net, maybe someone knows how to do this in a better way

Code:


preup() {

    if [[ "${IFACE}" == dummy* ]] ; then
       ip link add "${IFACE}" type dummy || return 1
    fi

    #return 0 on success, 1 on fail
    return 0

}


postdown() {

    if [[ "${IFACE}" == dummy* ]] ; then
        ip link delete "${IFACE}"
    fi

   #always return 0 as no action can be taken
    return 0
}

Back to top
View user's profile Send private message
szatox
Veteran
Veteran


Joined: 27 Aug 2013
Posts: 1717

PostPosted: Tue Apr 07, 2015 5:06 pm    Post subject: Reply with quote

Your way is fine. Just a scripting detail here, your pre_up() doesn't have to check exit code and set it again. You can skip returns and you will get the same result:
do_something (gives some exit code)
check_exit_code: if true -> set exit to true; else -> set exit to false (redundant, you already had an exit code and you test it for the sole purpose of not changing it)
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