[CentOS] netmask on aliases overriden by netmask on interface

Ulf Volmer u.volmer at u-v.de
Fri Feb 8 17:48:07 UTC 2019


On 08.02.19 15:08, James B. Byrne via CentOS wrote:

> # ifconfig eth1:192008001
> eth1:192008001 Link encap:Ethernet  HWaddr 00:25:90:61:74:C1
>           inet addr:192.168.8.1  Bcast:192.168.8.255 
> Mask:255.255.255.128
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           Interrupt:17 Memory:feae0000-feb00000
>
> Which shows that the network mask is determined by the interface mask
> and is not overridden by the alias definition.
>
> Is this expected behaviour?  Does this mean that a particular physical
> interface cannot belong to more than one network, or at least not to
> networks having differing cidr masks?

Interface aliases are evil from my point of view. I recommend to
configure the ip directly to the interface.

#ifcfg-eth2
[...]
IPADDR=192.168.200.1
NETMASK=255.255.255.0
IPADDR2=192.168.201.1
NETMASK2=255.255.255.192

ip addr show dev eth2
4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP qlen 1000
    link/ether 08:00:27:b0:c5:7c brd ff:ff:ff:ff:ff:ff
    inet 192.168.200.1/24 brd 192.168.200.255 scope global eth2
    inet 192.168.201.1/26 brd 192.168.201.63 scope global eth2
    inet6 fe80::a00:27ff:feb0:c57c/64 scope link
       valid_lft forever preferred_lft forever

Best regards
Ulf


More information about the CentOS mailing list