Multiple IPv4 addresses per NIC (w/o aliases, VLANs, etc.)

Kyle Smith askreet at gmail.com
Mon Sep 17 17:44:09 EDT 2018


Totally legitimate feature/functionality. I never understood why ifconfig
doesn't seem to support the full feature set of the kernel, probably just
to maintain legacy compatibility. IIRC it dates back to at least 2.2 and
predates IPv6 being compiled into most distros.

Having multi IP addresses on a single device is pretty critical to having
Linux act as a reasonably complex router, gateway, NAT gateway, etc.

- Kyle

On Mon, Sep 17, 2018 at 4:10 PM Ken D'Ambrosio <ken at jots.org> wrote:

> So, I didn't know this was "a thing."  And, apparently, "ifconfig"
> doesn't know it, either.  However, with "ip addr add", you can assign
> multiple IPv4 addresses to a given interface:
>
> methusalah # ifconfig tun0
> tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1500
>          inet 192.168.23.50  netmask 255.255.255.255  destination
> 192.168.23.49
>          inet6 fe80::6d4d:9731:4512:1f75  prefixlen 64  scopeid
> 0x20<link>
>          unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
> txqueuelen 100
> (UNSPEC)
>          RX packets 0  bytes 0 (0.0 B)
>          RX errors 0  dropped 0  overruns 0  frame 0
>          TX packets 9  bytes 432 (432.0 B)
>          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
>
> methuselah FAQ # ip addr add 10.20.30.40/32 dev tun0
>
> methuselah FAQ # ip addr show tun0
> 4: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc
> fq_codel
> state UNKNOWN group default qlen 100
>      link/none
>      inet 192.168.23.50 peer 192.168.23.49/32 scope global tun0
>         valid_lft forever preferred_lft forever
>      inet 10.20.30.40/32 scope global tun0
>         valid_lft forever preferred_lft forever
>
> And yet ifconfig doesn't even show the new info.  Note that this is
> dinstinct from "tun.0" or "tun:0" (VLAN and alias, respectively).
>
> Is the ability to have multiple v4 addresses against a given NIC a new
> feature?  Is it somehow bogus?  Maybe it's an extension of the way that
> v6 works, since v6 has always allowed multiple addresses/NIC -- perhaps
> aliases are deprecated?
>
> Just wondering if anyone else has noticed this...
>
> -Ken
>
> _______________________________________________
> gnhlug-discuss mailing list
> gnhlug-discuss at mail.gnhlug.org
> http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.gnhlug.org/pipermail/gnhlug-discuss/attachments/20180917/1a4aa967/attachment.html 


More information about the gnhlug-discuss mailing list