A linux client mounts a Windows share resolved by FQDN configured in /etc/fstab like this:

//fqdn.windows.share/theShare /local/mount/point cifs [...]

Due to infrastructure changes the IP address of the share has changed.

I expected the locally mounted share to resolve the IP address at access time, but it doesn't. The attempt to list the contents of the local resource like

ls -lah /local/mount/point

fails due to connection problems (sorry, can't reproduce the error message).

Now I wanted to list the currently used ip address of the mounted share, but I couldn't figure out how to do. So the question is

How do I list the currently used IP address of an already mounted CIFS share (... or details of active mount point containing the IP address)?

Commands like mount, findmnt or inspecting /proc/mounts didn't help (did I miss an option?).

To be clear: I don't want to query the currently active IP address of the share, which I can query from DNS at any time. Even there is no problem while remounting the share using the new IP address.



netstat -an --inet | grep "445 "

you will get someting like

tcp        0      0          ESTABLISHED


  • 445 is port number for cifs (you need to quote to include a space)
  • netstat --inet -an will display tcp connection (-n is for numeric)

Edit : you may need to use df or mount before.

Edit2 :

to get IPs

netstat -an --inet | awk '$5 ~ /:445$/ { split($5,A,":") ; print A[1] ; }'
  • Great answer, completely missed to inspect open sockets. Based on your answer: I use lsof instead of netstat, because it's missing on some systems. While I couldn't get lsof get to display the connected IP address (maybe you do and add it to your answer?), the command ss -at '( dport = :445 )' (whitespaces inside brackets are important!) does. – ChristophS Mar 10 '20 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.