# persitent virtual interface

## exeral

Hi everybody

I'm trying to setup a persistent virtual interface to add another private IP.

manually it works:

```
ifconfig eth0:0 192.168.10.10/24 up
```

"ip a" output the new ip adress on eth0

I edit /etc/conf.d/net to make it persistent:

```

config_eth0="my.pub.lic.ip/24 192.168.10.10/24"

routes_eth0=(

        "192.168.104.51/32 via aa.bb.cc.dd"

        "default gw xx.yy.yy.zz"

)

```

then I do : "/etc/init.d/net.eth0 restart"

some net dependend services restart but nothing about a new virtual interface happens.

"ip a" doesn't show anything about this virtual adress

on another server, It works with the same steps.

The difference is kernel version.

3.8.13 on working server

2.6.38.2 on non-working server

Is it related to kernel? do I have to take a look about a specific package ?

thanks

----------

## _______0

interface alias is not at all recomendable. Use tap or macvlan better. I think some of the problems where due to iptables not being able to work with interface alias. Nobody is using this anymore.

----------

## exeral

It's still documented in handbook

http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=4&chap=2

I know as described:

 *Quote:*   

> You cannot do anything special with these interfaces as the kernel and other programs will just treat eth0:1 and eth0:2 as eth0

 

but it doesn't matter for me. I'll not use iptables on this address

----------

## Hu

Since you have the ip command installed, openrc will prefer that for configuring interfaces.  The use of interface aliases is a workaround for limitations in ifconfig.  The ip command can add extra addresses without the use of interface aliases.

----------

## exeral

I could add

```
/sbin/ip address add 192.168.10.10/24 dev eth0
```

to /etc/rc.local but i think it's not the best way

----------

## massimo

What routes are there after restarting eth0?

----------

## _______0

Just a quick question an interface can use TWO addresses simultaneously with the ip command way??

thanks

----------

## papahuhn

Yes.

----------

