Re: 'RTNETLINK answers: File exists' error

Grant Taylor <[email protected]> Wed, 10 Mar 2021 10:19:12 -0700
Newsgroups gmane.linux.network.routing
Organization TNet Consulting
Message-ID <[email protected]>
On 3/10/21 1:52 AM, Marco Gaiarin wrote:
> Sometime in my firewall (based on debian), using my custom script 
> and with policy routing enabled, i hit this error:
> 
>   ifup vlan191
>   Set name-type for VLAN subsystem. Should be visible in /proc/net/vlan/config
>   Added VLAN with VID == 191 to IF -:eth2:-
>   RTNETLINK answers: File exists
>   Failed to bring up vlan191.

That means that the kernel thinks that the route / interface that you 
are, or the script on your behalf is, trying to create already exists.

> this typically happen when i 'play' with an interface (eg, i tear it 
> up and down many times for testing); after a bit of play (but something 
> suddenly) the interface go into a undefined state; interface is up (eg, 
> 'ifconfig' return the correct data) but routing is a mess.

*nod*

Been there.
Done that.

> Sometime the only thing to do is reboot the firewall.

Na.  You generally shouldn't need to reboot.

> Probably i do something wrong in my script, but... how can i 'cleanup'
> the mess without rebooting?

In between script invocations, check to make sure that any VLAN 
interfaces you are messing with have been removed and that any Ethernet 
interfaces are down.

Doing that should remove any routes associated with them and remove the 
interfaces so that you / the script can start anew when creating them.



-- 
Grant. . . .
unix || die
smime.p7s (application/pkcs7-signature, 3.9 KB) - not displayed