Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #166074

Re: restarting network

From Reco <recoverym4n@gmail.com>
Newsgroups linux.debian.user
Subject Re: restarting network
Date 2016-03-29 19:20 +0200
Message-ID <ri5t8-Xc-1@gated-at.bofh.it> (permalink)
References (7 earlier) <ri37Y-7Fn-13@gated-at.bofh.it> <ri3KG-8bX-7@gated-at.bofh.it> <ri4np-iJ-21@gated-at.bofh.it> <ri4GL-pQ-37@gated-at.bofh.it> <ri4Qr-sQ-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, 29 Mar 2016 17:38:07 +0100
Tony van der Hoff <tony@vanderhoff.org> wrote:

> On 29/03/16 17:20, Reco wrote:
> > On Tue, 29 Mar 2016 17:08:01 +0100
> > Tony van der Hoff <tony@vanderhoff.org> wrote:
> >
> >> On 29/03/16 16:25, Reco wrote:
> >>> 	Hi.
> >>>
> >>> On Tue, 29 Mar 2016 15:44:16 +0100
> >>> Tony van der Hoff <tony@vanderhoff.org> wrote:
> >>>>> And - you have yet another default gateway for eth1.
> >>>>> No wonder that the kernel refuses to add the same route second time.
> >>>>>
> >>>>> Reco
> >>>>>
> >>>>
> >>>> Thanks, Reco.
> >>>> I've now commented out that line for eth1, but I still get
> >>>>
> >>>> Mar 29 15:37:47 tony-lx networking[24921]: Failed to bring up eth1.
> >>>> Mar 29 15:37:47 tony-lx networking[24921]: done.
> >>>
> >>> Now *that* requires actual investigation.
> >>>
> >>> What does the following sequence yield:
> >>>
> >>> ifdown -v eth1
> >>>
> >> root@tony-lx:~# ifdown -v eth1
> >> ifdown: interface eth1 not configured
> >
> > Ok, let's try it like this then:
> >
> > ifdown --force eth1
> > ip l s dev eth1 down
> > ip a d dev eth1 192.168.2.8/24
> > ip a d dev eth1 2001:8b0:ff60:6a91::8
> > ifup -v eth1
> >
> 
> root@tony-lx:~# ifdown --force eth1
> root@tony-lx:~# ip l s dev eth1 down
> root@tony-lx:~# ip a d dev eth1 192.168.2.8/24
> RTNETLINK answers: Cannot assign requested address
> root@tony-lx:~# ip a d dev eth1 2001:8b0:ff60:6a91::8
> RTNETLINK answers: Cannot assign requested address
> root@tony-lx:~# ifup -v eth1
> Configuring interface eth1=eth1 (inet)
> run-parts --exit-on-error --verbose /etc/network/if-pre-up.d
> run-parts: executing /etc/network/if-pre-up.d/wpasupplicant
> ip addr add 192.168.2.8/255.255.255.0 broadcast 192.168.2.255     dev 
> eth1 label eth1
> ip link set dev eth1   up
> 
> ip addr add dev eth1 2001:8b0:ff60:6a91::8
> ip route add default via fe80::1 dev eth0
> RTNETLINK answers: File exists
> Failed to bring up eth1.

Haha, bullseye! The whole mess is caused by exotic 'ip route' "up" hook.
So, first things first:

ifdown --force eth1
ip l s dev eth1 down
ip a d dev eth1 192.168.2.8/24
ip a d dev eth1 2001:8b0:ff60:6a91::8

And then modify your /etc/network/interfaces like this:

auto eth1
iface eth1 inet static
	address 192.168.2.8
	netmask 255.255.255.0
	network 192.168.2.0
	broadcast 192.168.2.255
	up /sbin/ip addr add dev eth1 2001:8b0:ff60:6a91::8/128
	up /sbin/ip -6 route add default via fe80::1 dev eth1

'ifup -v eth1' should configure the interface cleanly then.
As should conventional 'ifup eth1'.


Next, ifup (and ifdown for that matter) is kind of paranoid.
Every time you tell ifup to do something - it executes each and every
'pre-up' and 'up' in succession and all it takes is one faulty hook to
get (in)famous 'Failed to bring up foo' message.
The interface in question may be in UP state, and even have some IPs
assigned, *but* since something went wrong - the interface must be
absent from /run/network/ifstate.
ifdown should only proceed if the interface is listed in the ifstate
file (unless you supply --force of course).


PS To answer your original query.
'/sbin/service networking restart' is a valid way of changing network
interface configuration *if* the network interface is configured
correctly *before* and *after* the change.

Else it's more-or-less required to do things a hard way - by manual
reconfiguration via iproute (or ifconfig).

Reco

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

restarting network Tony van der Hoff <tony@vanderhoff.org> - 2016-03-28 11:50 +0200
  Re: restarting network Brian <ad44@cityscape.co.uk> - 2016-03-28 15:40 +0200
    Re: restarting network Joe <joe@jretrading.com> - 2016-03-28 20:50 +0200
      Re: restarting network Brian <ad44@cityscape.co.uk> - 2016-03-28 21:10 +0200
        Re: restarting network Joe <joe@jretrading.com> - 2016-03-28 21:50 +0200
    Re: restarting network Andrew McGlashan <andrew.mcglashan@affinityvision.com.au> - 2016-03-28 23:30 +0200
      Re: restarting network "Andrew M.A. Cater" <amacater@galactic.demon.co.uk> - 2016-03-29 00:10 +0200
        Re: restarting network Joe <joe@jretrading.com> - 2016-03-29 09:30 +0200
          Re: restarting network Reco <recoverym4n@gmail.com> - 2016-03-29 09:50 +0200
  Re: restarting network Jörg-Volker Peetz <jvpeetz@web.de> - 2016-03-29 11:10 +0200
  Re: restarting network Tony van der Hoff <tony@vanderhoff.org> - 2016-03-29 12:20 +0200
    Re: restarting network pedantsunited <ad44@cityscape.co.uk> - 2016-03-29 14:00 +0200
      Re: restarting network Tony van der Hoff <tony@vanderhoff.org> - 2016-03-29 14:40 +0200
        Re: restarting network Brian <ad44@cityscape.co.uk> - 2016-03-29 15:10 +0200
          Re: restarting network Tony van der Hoff <tony@vanderhoff.org> - 2016-03-29 15:20 +0200
            Re: restarting network Dan Ritter <dsr@randomstring.org> - 2016-03-29 16:00 +0200
            Re: restarting network Reco <recoverym4n@gmail.com> - 2016-03-29 16:40 +0200
              Re: restarting network Tony van der Hoff <tony@vanderhoff.org> - 2016-03-29 16:50 +0200
                Re: restarting network Reco <recoverym4n@gmail.com> - 2016-03-29 17:30 +0200
                Re: restarting network Tony van der Hoff <tony@vanderhoff.org> - 2016-03-29 18:10 +0200
                Re: restarting network Reco <recoverym4n@gmail.com> - 2016-03-29 18:30 +0200
                Re: restarting network Tony van der Hoff <tony@vanderhoff.org> - 2016-03-29 18:40 +0200
                Re: restarting network Reco <recoverym4n@gmail.com> - 2016-03-29 19:20 +0200
                Re: restarting network Tony van der Hoff <tony@vanderhoff.org> - 2016-03-30 14:20 +0200
                Re: restarting network Nemeth Gyorgy <friczy@freemail.hu> - 2016-03-29 18:50 +0200
            Re: restarting network Darac Marjal <mailinglist@darac.org.uk> - 2016-03-30 18:40 +0200
              Re: restarting network [SOLVED] Tony van der Hoff <tony@vanderhoff.org> - 2016-04-04 16:20 +0200
                RE: restarting network [SOLVED] Bonno Bloksma <b.bloksma@tio.nl> - 2016-04-05 13:30 +0200
  RE: restarting network Bonno Bloksma <b.bloksma@tio.nl> - 2016-03-29 13:20 +0200

csiph-web