Linux rtnetlink file exist

Бывает так, что при настройке сети в Linux, например при добавлении дополнительного IP-адреса для сетевого интерфейса, может появиться следующая ошибка:

# ip addr add 192.168.1.95/24 dev enp5s0

RTNETLINK answers: File exists

Традиционно, текст ошибки указывает совершенно не на ту проблему, которая возникла на самом деле. При возникновении данной ошибки обычно рекомендуют перезагрузить компьютер или полностью сбросить конфигурацию сетевого интерфейса через команды:

# ip addr flush dev enp5s0

# ip route flush dev enp5s0

Предполагается, что некий загадочный конфигурирующий файл или файл устройства освободится и можно будет произвести настройку.

Так вот, этого делать не нужно. Лучше посмотреть на исходную команду, и понять, что в ней может быть не так. Вроде бы все в порядке? Да! Но что если посмотреть на выхлоп:

link/ether . brd ff:ff:ff:ff:ff:ff

inet 192.168.1.95/24 brd 192.168.1.255 scope global enp5s0

valid_lft forever preferred_lft forever

Оказывается, такой IP с такой маской уже существует. По запарке можно было этого и не заметить. То есть, проблема оказалась в неправильном применении команды.

По непроверенной информации, RTNETLINK расшифровывается как ROUTE NETWORK LINK (иногда используется наименование NETLINK_ROUTE ), и под этим «объектом» подразумевается сокет маршрутизации IPv4. Соответственно, если сокет уже существует, а пользователь пытается своей командой косвенно создать такой же сокет, то будет появляеться вышеуказанная ошибка. Так же, подобная ошибка будет появляться, если есть какие-то неполадки в настройках маршрутизации.

Ждем, когда команда ip станет более интеллектуальной, и будет точно говорить в чем проблема, чтобы можно было ее быстро решить.

Источник

Comments

rdavey228 commented Aug 8, 2018

Tried posting this on the already closed ticket with what seems to be the same issue but I guess that doesnt re open the ticket as its still showing as closed so I am submitting a new one.

Docker is installed on an old PC running Ubuntu 18.04 as the underlying OS. PureVPN is used as the configuration

I get the following error —

The text was updated successfully, but these errors were encountered:

rdavey228 commented Aug 10, 2018

haugene commented Aug 10, 2018

Hey. I haven’t seen this before, but I’m going to set up an old machine with Ubuntu 18.04 one of these days. Then I can try to fire up the container and see if I can reproduce it.

Читайте также:  Какие есть способы установки windows

Not sure when though. Hopefully I’ll get som play time on Sunday.

Have you installed openvpn on the host? You don’t need to configure or start it. This sets up the tun device. There are other ways to do it, but it’s the simplest I think.

haugene commented Aug 12, 2018

So. Just did a fresh install of ubuntu server on an old laptop and started the container without installing anything but Docker.

Running uname -r gives kernel version: 4.15.0-30-generic
Running docker -v : Docker version 18.06.0-ce, build 0ffa825

This is my docker run command:

This might not help a lot, but couldn’t reproduce your error.

haugene commented Aug 12, 2018

So this seems to be provider specific. And you’ve probably already seen this, and it makes sense of course that it has to do with the route configurations in the PureVPN configs: https://askubuntu.com/questions/920486/openvpn-config-client-ovpn-fail-rtnetlink-answers-file-exists

Have there been any updates to the PureVPN configs that haven’t been updated here yet. Can you download the current configs and compare to the ones in this project? If they’re still up to date you should compare the PureVPN configs to configs from other providers.

bobsupercow commented Aug 13, 2018

Differences:
File paths obviously.
.ovpn from PureVPN site has a trailing space and newline after final entry auth-nocache .

I can send you a PM or email with my PureVPN credentials if it will help you fully test. It’s my understanding that without a un/pw, it won’t get to the part that’s failing.

rdavey228 commented Aug 14, 2018

Ok — I realised why I wasnt able to ping out from the docker container.

I had mapped a port to 8.8.8.8 as well as specifying 8.8.8.8 in my DNS ooops! Changed that and I can now ping out and the VPN shows my IP address to be in switzerland as per the VPN config added.

I ran a DNS leak test and it brings back google DNS servers in switzerland and says my DNS could be leaking.

I am however still seeing the following line after the VPN comes up

haugene commented Aug 14, 2018

@bobsupercow If you could PM me some credentials that would be great. Then I can test it and try to figure out what is happening. You can send me a message on Gitter for example? https://gitter.im/docker-transmission-openvpn

bobsupercow commented Aug 14, 2018

PM sent in Gitter chat.

haugene commented Aug 15, 2018

Ok. So I don’t have all the answers yet, but here are some findings so far.
I’ve tried three different cases, and all the configs and logs plus iptables routes are pasted below.

Читайте также:  Что такое линукс контейнеры

Case 1:
Standard setup, original image, using LOCAL_NETWORK variable to try to make Transmission accessible on my local LAN.

Case 2:
Ditching the LOCAL_NETWORK variable

Case 3:
Same setup as case 2, but I removed the three route commands in the ovpn file.
For reference, the three consecutive lines starting with this one

Result:
In the first case we see two RTNETLINK errors. In the beginning RTNETLINK answers: Invalid argument and then at the end RTNETLINK answers: File exists . Transmission is not available on host:9091, the request just hangs. This is typical behaviour when the local network route is not added, also described in the README. As I also fired up the proxy container I tested connecting through that instead, and it works. So Transmission is running and using http://ipmagnet.services.cbcdn.com/ I could verify that the traffic was routed through the VPN.

But anyways, I figured that the first RTNETLINK error could be the LOCAL_NETWORK route. So I removed that from the config.

In the second case, without the local network settings, as expected the first error is gone.

In the third case, where I also removed the route options from the .ovpn file, the second error is also gone.

In all three cases Transmission is running and the IP check says that the traffic is routed through VPN. The route stuff probably need more investigation to know what’s needed and why PureVPN is different from others when it comes to the LOCAL_NETWORK variable and have the route options in their configs.

Later I’ll try to compare with PIA that I’m using, but this is as far as I came today. Maybe someone can do some more digging as well?

Config for Case 1:

Output from ip r :

Case 2:

docker-compose.yml:
Same as for Case 1, but without LOCAL_NETWORK line

Output from ip r :

Config for Case 3:

docker-compose.yml:
Same as for Case 2. Note that the image is changed as described.

Output from ip r :

Othou commented Aug 17, 2018

I got my container working with LOCAL_NETWORK after removing those three route commands from my Norway-tcp.ovpn, changing 4th line to remote vleu-no2-ovpn-tcp.pointtoserver.com 80 and replacing contents of ca.crt with

——BEGIN CERTIFICATE——
MIIE6DCCA9CgAwIBAgIJAMjXFoeo5uSlMA0GCSqGSIb3DQEBCwUAMIGoMQswCQYD
VQQGEwJISzEQMA4GA1UECBMHQ2VudHJhbDELMAkGA1UEBxMCSEsxGDAWBgNVBAoT
D1NlY3VyZS1TZXJ2ZXJDQTELMAkGA1UECxMCSVQxGDAWBgNVBAMTD1NlY3VyZS1T
ZXJ2ZXJDQTEYMBYGA1UEKRMPU2VjdXJlLVNlcnZlckNBMR8wHQYJKoZIhvcNAQkB
FhBtYWlsQGhvc3QuZG9tYWluMB4XDTE2MDExNTE1MzQwOVoXDTI2MDExMjE1MzQw
OVowgagxCzAJBgNVBAYTAkhLMRAwDgYDVQQIEwdDZW50cmFsMQswCQYDVQQH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DLSjp03NgGsCGW+cXnz6UBPM5FStFvG
dDeModeSUyoS9fjk+mYROvmiy5EiVDP91sKGcPLR7Ym0M7zl2aaqV7bb98HmMoBO
xpeZQinof67nKrCsgz/xjktWFgcmPl4/PQSsmqQD0fTtWxGuRX+FzwvF2OCMCAJg
p1RqJNlk2g50/kBIoJVPPCfjDFeDU5zGaWGSQ9+z1L6/z7VXdjUiHL0ouOcHwbiS
4ZjTr9nMn6WdAHU2
——END CERTIFICATE——

According to http://ipmagnet.services.cbcdn.com, my traffic is routed through PureVPN and atleast Transmission Remote GUI is working correctly.

And no RTNETLINK answers: File exists error!

So for me it works now like it used to!

Читайте также:  Центр обновления windows 0 процентов

I hope this information is helpful for you @haugene 🙂

haugene commented Aug 17, 2018 •

That’s great @Othou, and thanks for sharing. But if you’re changing host address and certificate, does that mean there are updated config files for PureVPN? Thought @bobsupercow checked that earlier in this thread.

Othou commented Aug 17, 2018

I haven’t found any config files yet with that host address, i got that address and certificate from PureVPN’s support team today. For example if i download linux configs from here, 4th line in Norway-tcp.ovpn is remote vleu-no1-ovpn-tcp.pointtoserver.com 80 and i got this vleu-no2-ovpn-tcp.pointtoserver.com address from PureVPN support along with the certificate that just works fine. If i understood correctly, that is an address for a new server.

I got total 14 new addresses to different locations for both TCP and UDP:

United Kingdom | ukl2-ovpn-tcp.pointtoserver.com | ukl2-ovpn-udp.pointtoserver.com
Netherland | nl2-ovpn-tcp.pointtoserver.com | nl2-ovpn-udp.pointtoserver.com
United States | us2.ovpn-tcp.pointtoserver.com | us2.ovpn-udp.pointtoserver.com
Sweden | se2-ovpn-tcp.pointtoserver.com | se2-ovpn-udp.pointtoserver.com
Canada | ca2-ovpn-tcp.pointtoserver.com | ca2-ovpn-udp.pointtoserver.com
Germany | de2-ovpn-tcp.pointtoserver.com | de2-ovpn-udp.pointtoserver.com
Australia | au2-ovpn-tcp.pointtoserver.com | au2-ovpn-udp.pointtoserver.com
Belgium | vleu-be2-ovpn-tcp.pointtoserver.com | vleu-be2-ovpn-udp.pointtoserver.com
France | fr2-ovpn-tcp.pointtoserver.com | fr2-ovpn-udp.pointtoserver.com
Italy | it2-ovpn-tcp.pointtoserver.com | it2-ovpn-udp.pointtoserver.com
Norway | vleu-no2-ovpn-tcp.pointtoserver.com | vleu-no2-ovpn-udp.pointtoserver.com
Panama | vlus-pa2-ovpn-tcp.pointtoserver.com | vlus-pa2-ovpn-udp.pointtoserver.com
Taiwan | tw2-ovpn-tcp.pointtoserver.com | tw2-ovpn-udp.pointtoserver.com

haugene commented Aug 17, 2018

Sweet. If the new servers work better we should consider adding them. Also more folks should test dropping the route lines. If that works better then we could do a bulk update of the existing configs.

Источник

I have a fresh new install of Ubuntu Server 16.04. After installation, network connectivity was fine.

I installed QuickBox, it’s a seeding/torrent server software (https://quickbox.io).

After the installation it was still fine; I could SSH in and out no problem. The installation however recommended I restart the server for some files to finish installation.

After restarting the server I lost all network connectivity; I continued getting the error:

The interfaces file looked fine, had the correct networking information. No duplicate gateways were set in interfaces configuration either.

I ran the following command to get some feedback and got this:

I tried flushing the device as well that didn’t work. I tried restart networking service, still fails. There are no extra configs in interfaces.d directory.

My interfaces file looks like this:

Also, when I do a «route -n» nothing comes up in the kernel routing table, its just completely blank.

Same thing when I run a «netstat -rn»; the routing table is completely blank.

Is it the routing table? I tried adding the routing info manually but I still got the same error.

I flushed the device as well and tried again and that didn’t work either.

What is this RTNETLINK? I googled around and tried all the previous solutions people posted but none of them worked and still couldn’t find a straight answer as to what this file is.

Источник

Оцените статью