# IP aliasing / multiple IP's on one interface

## rbr28

Can anyone tell me what I'm missing with trying to setup two IP addresses on one interface?  I've done this on Redhat before with no problem, but I can't seem to get it working on Gentoo.  I've tried using different syntax but my current /etc/conf.d/net is below.  I followed the net.example file that is installed in the same location, but when I restart eth0 I only get eth0, no eth0:0.

Also want to add that if I do something like dhcpcd eth0:0 , the aliased interface does come up.

Thanks,

Vern

/etc/conf.d/net

config_eth0=(

"192.168.x.x/24"

"192.168.x.x/24"

)

routes_eth0="default via 192.168.1.1"

dns_servers_eth0="192.168.1.1"

----------

## Hu

Please provide a reference to the example you used.  It is outdated and needs to be fixed.  Baselayout 1 used Bash arrays, but Baselayout 2 uses embedded newlines.  Also, interface aliases are not an expected result.  They were a workaround for ifconfig's inability to handle multiple addresses on one interface.  Both the kernel and iproute2 handle this correctly.

----------

## MrUlterior

Assuming you're using a recent baselayout ( ~ sys-apps/baselayout-2.2), then your /etc/conf.d/net should be

```

modules="iproute2"

config_eth0="192.168.x.x/24 192.168.x.x/24"

routes_eth0="default via 192.168.1.1"

dns_servers_eth0="192.168.1.1"

```

OFC you will first need to:

```

emerge -av sys-apps/iproute2

```

Then restart, and check it's working with:

```

$ sudo ip addr

...

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000

    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff

    inet 192.168.x.x/24 brd 192.168.x.255 scope global eth0

    inet 192.168.x.x/24 brd 192.168.x.255 scope global eth0

```

----------

