# setup up "dummy network interface"

## unknown2

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?

----------

## charles17

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

----------

## unknown2

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

 

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

----------

## charles17

 *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?

----------

## unknown2

 *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 ?

----------

## charles17

 *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? 
> ...

 I don't think /etc/conf.d/net could create any interfaces.  Maybe someone else knows better:

----------

## unknown2

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

```

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

}

```

----------

## szatox

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)

----------

