Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] multiple IP aliases per ethernet 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
yolabingo
n00b
n00b


Joined: 19 Feb 2009
Posts: 12
Location: New Mexico

PostPosted: Mon Mar 28, 2016 8:01 pm    Post subject: [SOLVED] multiple IP aliases per ethernet interface Reply with quote

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:

Code:
# 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
Code:
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
Code:
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:

Code:
# /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 advance


Last edited by yolabingo on Tue Mar 29, 2016 3:15 am; edited 1 time in total
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14169

PostPosted: Tue Mar 29, 2016 1:18 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
yolabingo
n00b
n00b


Joined: 19 Feb 2009
Posts: 12
Location: New Mexico

PostPosted: Tue Mar 29, 2016 2:23 am    Post subject: Reply with quote

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

Code:
ip addr
does show both interfaces, and they behave as expected.

Thank you.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6228
Location: Room 101

PostPosted: Tue Mar 29, 2016 2:27 am    Post subject: Re: multiple IP aliases per ethernet interface not working Reply with quote

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
Back to top
View user's profile Send private message
yolabingo
n00b
n00b


Joined: 19 Feb 2009
Posts: 12
Location: New Mexico

PostPosted: Tue Mar 29, 2016 3:14 am    Post subject: Reply with quote

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