Closed ClaZu closed 5 months ago
That's because the two network interfaces are on the same subnet. If you want to have two IP addresses on the same subnet, they should be on the same interface. Look for the ip address add
command to see how to add an address to an existing interface, it should give you the information you need!
First of all, thank you very much for you prompt answer
But, if I want to add two real nics to the container, having the virtual level (I mean without --direct-phys flag), how can I do?
I have tried using: pipework eth1 dockerID 0/0 pipework eth2 dockerID 10.0.0.1/24
And also using: pipework eth1 dockerID 10.0.0.1/24 pipework eth2 dockerID 10.2.0.1/24
But the result is the same. Where I am wrong?
Just to explain better what I want to do: I need to create a tunnel between the two real interfaces entering the container trough one interface and going out trough the second one.
I'm sorry, I don't understand what you are trying to do :-(
If you do this:
pipework eth1 dockerID 10.0.0.1/24
pipework eth2 dockerID 10.0.0.2/24
The kernel will be confused because it will not know which interface to use when sending packets to 10.0.0.0/24
(which is maybe why you got the RTNETLINK
error).
The following, however, should work:
pipework eth1 dockerID 10.0.0.1/24
pipework eth2 dockerID 10.2.0.1/24
Because you are using two different networks.
You might want to make sure that Docker's internal networks do not conflict with this, however.
(You can easily see that by running ip addr ls
from within the container.)
Thank you again and sorry for my late answer to your suggestion. At the end, I found the best way is to add "physical" interfaces to the container (they are virtual interfaces I add as physical). But, at this point, it would be great if I could rename the interface within the container: if my NIC in the host is pipe1, I would to add it in the container as eth0. Is it possible using pipework or in another way?
Thank you in advance
Hi @ClaZu, got the same issue. It fails because it tries to assign the internal interface to eth1 by default if not specified (so the first one works, but not the second one).
So this does not work:
pipework eth1 dockerID 10.0.0.1/24
pipework eth2 dockerID 10.2.0.1/24
But this one does:
pipework eth1 -i eth1 dockerID 10.0.0.1/24
pipework eth2 -i eth2 dockerID 10.2.0.1/24
Btw, having two interfaces with ip on the same subnet should not be an issue. The routing will be non-deterministic.
Cheers!
But, at this point, it would be great if I could rename the interface within the container: if my NIC in the host is pipe1, I would to add it in the container as eth0. Is it possible using pipework or in another way?
Would the -i
option shown in the comment just above do the trick?
I have tried to add two network interfaces to a container, but, for the second, I received the error: RTNETLINK answers file exists
Both the interfaces I try to add are real and I used the command: pipework eth1 dockerID 10.0.0.1/24 pipework eth2 dockerID 10.0.0.2/24
Thanks in advance