# [SOLVED] multiple IP aliases per ethernet interface

## yolabingo

I am trying to set up multiple IP addresses (aliases) on a single ethernet interface, so I'll have, for example,

enp4s0f1:     192.168.100.1/24

enp4s0f1:0:  192.168.100.33/24

Hardware is Ethernet controller: Intel Corporation 80003ES2LAN Gigabit Ethernet Controller (Copper) (rev 01)

Kernel driver in use: e1000e

net.example says:

```
# If you need more than one address, you can use something like this

# NOTE: ifconfig creates an aliased device for each extra IPv4 address

#       (eth0:1, eth0:2, etc)

#       iproute2 does not do this as there is no need to

# WARNING: You cannot mix multiple addresses on a line with other parameters!

#config_eth0="192.168.0.2/24 192.168.0.3/24 192.168.0.4/24"

# However, that only works with CIDR addresses, so you can't use netmask.
```

I have this line in /etc/conf.d/net

```
config_enp4s0f1="192.168.100.1/24 192.168.100.33/24"

```

but when I start /etc/init.d/net.enp4s0f1, ifconfig shows just a single interface comes up

```
enp4s0f1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.100.1  netmask 255.255.255.0  broadcast 192.168.100.255
```

It _looks_ like it is trying to do the right thing:

```
# /etc/init.d/net.enp4s0f1 -v start 

 * Bringing up interface enp4s0f1

 *   Skipping module adsl due to missing program: /usr/sbin/adsl-start /usr/sbin/pppoe-start

 *   Skipping module br2684ctl due to missing program: br2684ctl

 *   Skipping module bridge due to missing program: brctl

 *   Skipping module clip due to missing program: /usr/sbin/atmsigd

 *   Skipping module ethtool due to missing program: ethtool

 *   Skipping module netplugd due to missing program: /sbin/netplugd

 *   Skipping module ifplugd due to missing program: /usr/sbin/ifplugd

 *   Skipping module ipppd due to missing program: /usr/sbin/ipppd

 *   Skipping module iwconfig due to missing program: /sbin/iwconfig

 *   Skipping module firewalld due to missing program: firewall-cmd

 *   Skipping module pppd due to missing program: /usr/sbin/pppd

 *   Skipping module dhclient due to missing program: /sbin/dhclient

 *   Skipping module pump due to missing program: /sbin/pump

 *   Skipping module dhcpcd due to missing program: dhcpcd

 *   Loaded modules: apipa arping bonding tuntap ccwgroup macvlan macchanger macnet wpa_supplicant ssidnet iproute2 system vlan udhcpc ip6rd ip6to4

 *   Configuring enp4s0f1 for MAC address 00:30:48:8E:7F:2F ...                                        [ ok ]

 *   192.168.100.1/24 ...

 *     ip addr add 192.168.100.1/24 broadcast + dev enp4s0f1                                           [ ok ]

 *   192.168.100.33/24 ...

 *     ip addr add 192.168.100.33/24 broadcast + dev enp4s0f1                                          [ ok ]
```

Thanks in advanceLast edited by yolabingo on Tue Mar 29, 2016 3:15 am; edited 1 time in total

----------

## Hu

That output seems to show that it added both addresses.  What is the output of ip addr?  What symptoms make you think that it failed?

----------

## yolabingo

You are correct. I was relying on the output of ifconfig to show ethernet aliases, which it apparently no longer does. 

```
ip addr
```

 does show both interfaces, and they behave as expected.

Thank you.

----------

## khayyam

 *yolabingo wrote:*   

> [...] so I'll have, for example,
> 
> enp4s0f1:     192.168.100.1/24
> 
> enp4s0f1:0:  192.168.100.33/24

 

yolabingo ... that is ifconfig/net-tools notation, as 'net.example' states "iproute2 does not do this as there is no need to". You could however add a 'label' (ie, 'label enp4s0f1:0' ... see the section on "pass[ing] parameters" in net.example) but there isn't any need to, unless you absolutely must use the obsolete 'ifconfig' for viewing interface names, and if that were the case you could set modules="!iproute2" and have netifrc use ifconfig for creating the virtuals.

HTH & best ... khay

----------

## yolabingo

@khayyam - yes that definitely helps.

I must confess that while net.example is a great resource, I have not fully digested all 1200 lines of it.

Thanks all - the Gentoo community has always been remarkably helpful and patient.

----------

