[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: No ifconfig



On 08/21/2017 05:03 PM, Gene Heskett wrote:
> On Monday 21 August 2017 09:08:11 Christian Seiler wrote:
>> 2. Can't add multiple IP addresses to the same interface and
>>     (worse) even if multiple IP addresses are assigned to the
>>     same interfaces it only shows the primary address
> 
> I don't know as to how ifconfig sets it up, but its a piece of cake to 
> edit /etc/network/interfaces to do that. If I bring in a new router, I 
> uncomment this stanza in the interfaces file:
> ================
> #auto eth0:1
> 
> # to access reset to 192.168.0.1 routers/switches on the 2nd cat5 port
> #iface eth0:1 inet static
> #address 192.168.0.3
> #netmask 255.255.255.0
> ==============
> giving me an address I can use to talk to and configure the new router.

Yeah, that's the old way of doing this via an alias interface. I was
talking about the new-style way of doing so though.

For example:

auto eth0

iface eth0 inet static
  address 192.168.0.1/24
  address 192.168.0.42/24
  address 10.5.6.7/8

This will work, and it will assign all IPs to the interface (the first
one being the primary and the source IP of outgoing packets where the
program doesn't explicitly bind anything). And "ip a" will show all
three addresses, but "ifconfig -a" will only show the first.

Alias interfaes are kind of legacy, and while they still work, they do
have a couple of drawbacks: they aren't really an own interface because
they share options with the interface they are based on (which can be
confusing if you want to change interface options), there is no way to
automatically add a new IP to a given interface without probing first
which aliases have already been "used up", the alias namespace is
limited by both the max length of an interface name and the limitation
of the alias part itself.

But don't get me wrong: if it works for you with alias interfaces, I'm
certainly not going to tell you to change that - because those also do
work with the "ip" utility. The major issue I "ifconfig" has here is
that it doesn't see the additional IP addresses of interfaces added by
other tools - so that when you rely on ifconfig you _don't_ see the
actual entire network configuration of the system, but only a part of
it. So it's actually counter-productive when you're troubleshooting a
system.

>> (2) is really bad, especially the part where it does not show
>> all of the IPs that were assigned by other tools, for example
> 
> Huh? ifconfig doesn't even need a -a option to show me eth0:1 if ts 
> configured and up.

Yes, for alias interfaces it does. For the additional IPs added to the
interface itself it doesn't.

>> NetworkManager, or Debian's own ifupdown via
>> /etc/network/interfaces.
> 
> Please don't equate those two.

I was talking about how these configure multiple IPs when you use
them. Both use the newer kernel interface that allows you to specify
multiple IPs on the same interface, while ifconfig uses the old
interface that assumes a single IP per interface. And I just used
the most prominent programs in Debian as examples for this, but all
other management tools I know of (conman, systemd-networkd, ...)
also use the newer interface.

I really didn't want to discuss the merits or problems of each
individual software package.

Regards,
Christian


Reply to: