LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Containers (https://www.linuxquestions.org/questions/linux-containers-122/)
-   -   Docker didn't update arp table (https://www.linuxquestions.org/questions/linux-containers-122/docker-didnt-update-arp-table-4175713394/)

marozsas 06-14-2022 09:40 AM

Docker didn't update arp table
 
Hi, I am new to docker, so this is new to me.

I am trying to port an app of my own to run in docker.
My app do an auto-discovery on the network to automatically identify target devices on the network.
I use "nmap -v0 -sn <ip/cidr>" and the new founded hosts are added to arp table.
Next, I search the arp table by opening /proc/net/arp and parse the lines looking for target mac addresses.

This works in the standalone app, but not when in the docker.
Looks like the docker start with a copy of host arp table and it is immutable, I mean, pinging a host inside the docker environment, did not change the arp table.

I got this conclusion by running my docker as "docker run -it --network host miguel/tst bash" and found the arp table (ip neig) already populated with the same content than the host. Also, running nmap -sn did not add new entries to the arp table.

How can I run a docker app that scans the same host network ?

pan64 06-14-2022 11:01 AM

docker uses a virtual network, but it actually depends on how is it configured.
https://docs.docker.com/network/
I guess you need the "host network".

marozsas 06-14-2022 11:46 AM

Quote:

Originally Posted by pan64 (Post 6360896)
docker uses a virtual network, but it actually depends on how is it configured.
https://docs.docker.com/network/
I guess you need the "host network".

Yes, I already use it as you can see in the original post when I wrote '...running my docker as "docker run -it --network host miguel/tst bash" '

sundialsvcs 06-14-2022 08:31 PM

Please bear in mind that containers present an entirely synthetic version of the world to their clients. This includes "network resources." Clients can use these possibly-imaginary resources, but they cannot manipulate them. "Pay no attention to the little man behind the curtain ... which curtain you cannot see."

Everything(!) about containers is "a carefully-prepared and fully-functional ... illusion."


All times are GMT -5. The time now is 09:08 PM.