:: Re: [DNG] ifconfig vs ip
トップ ページ
このメッセージを削除
このメッセージに返信
著者: Adam Borowski
日付:  
To: dng
題目: Re: [DNG] ifconfig vs ip
On Fri, Jun 03, 2016 at 08:56:50AM +0900, Simon Walter wrote:
> I am working on some cdist scripts for setting up some network interfaces.
>
> So far I am modifying the /etc/network/interfaces and then bring down
> and up the interfaces. For a while now /etc/init.d/networking has a
> warning that it is deprecated.


/etc/init.d/networking is not deprecated, only calling it with the argument
"restart" (="force-reload") is. There's no real way to do that reliably in
any non-static setup.

> So I issue:
> # ip address flush dev xxx && ip link set xxx down
>
> Which seems to work fine. However, when I try to bring the device back
> up with the new config with "ifup xxx"
> It fails. If I first issue a "ifdown xxx" then it works.


ifupdown keeps its state in /run/network/ifstate, if you bring devices up or
down using low-level tools then ifupdown may get confused. Use --force to
override the saved state.

> So I have couple questions for those who know about the situation in De*an:
>
> 1. Is there a plan to move away from ipconfig?


ipconfig is a Windows thing, I assume you mean ifconfig.

If so, it's a legacy thing on Linux because of a number of limitations that
can't be overcome without breaking compatibility. The replacement is "ip"
since a long long time ago. The only reason to keep using ifconfig is
portability -- there's no "ip" on kfreebsd nor hurd.

> 2. Is there a plan to write a /etc/init.d/networking script that works
> properly?


What do you mean by "properly"? What's your problem with it?

> 3. Is ifup unrelated to ifconfig and will continue to live and be used
> in the De*an ecosystem?


Yes, ifup is in a different layer than ifconfig -- in fact, the former uses
the latter to do it's work.

There's a plan from the systemd crowd to replace ifupdown with our
unfavourite init cancer's networking facilities, so there might be problems
in the long term, but as for now, ifupdown is the default, and on
kfreebsd/hurd, the only option. And I have an inkling of suspiction that
systemd-networkd might have some issues getting to Devuan.

There's also ifupdown2, a rewrite in Python, but that's meant for massive
setups with hundreds of dynamic interfaces with little heed for regular
systems.

> 3. For my project: How does one bring up and down interfaces with ip in
> coordination with /etc/network/interfaces? Or shall I use ifup?


Don't try to mix the two -- or rather, you may use ip safely for
configuration (like, changing addresses, routes, etc) but not bringing an
interface up or down. If ifupdown doesn't fit your needs you can simply
omit that interface in /etc/network/interfaces or let it bring it up during
boot and never touch it again. Unlike, say, network-manager, ifupdown will
not mess with the interface unless either you or udev explicitely tell it
so.


Meow!
--
An imaginary friend squared is a real enemy.