跳到主要內容

Cannot copy %filename%, network name no longer available under NAT / 在NAT複製檔案環境發生無法複製%filename%, 指定的網路名稱無法使用

最近因故把外單位的網路由直接連接VPN專線改成NAT連線,在網路磁碟(網路上的芳鄰) 複製檔案時發生 『無法複製[檔案名稱], 指定的網路名稱無法使用』的錯誤訊息,而且小檔案會過,複製大檔時才當,完全摸不著頭緒。

查了非常久,中文都沒有相同的問題,後來半猜半找,才發現 Cannot copy %filename%, network name no longer available.您不能將多個用戶端連線透過 NAT 裝置You cannot make more than one client connection over a NAT device

根據 Bhupinderk 的回答,造成問題是有第二個人連進來,NAT IP上前一個client的session就斷了。解法就是必須強制使用139 port連線,解法如下:
  1. 打開regedit.exe
  2. 編輯HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\NetBT\Parameters
  3. 增加一個DWORD值,名稱為 SmbDeviceEnabled ,值設為 0
You can establish no more than one direct hosting client connection across a NAT device. If you must have more than one simultaneous SMB session, disable either direct hosting on the Windows 2000 Server or Windows Server 2003 file server, on all clients behind the NAT device, or block TCP port 445 on the NAT device or firewall.

停用伺服器上的445 port:

  1. 啟動 「 登錄編輯程式 」。
  2. 找出並按一下下列登錄機碼:
    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\NetBT\Parameters
  3. 新增下列登錄值:
    值名稱: SmbDeviceEnabled
  4. 型別: REG_DWORD
    數值資料: 0


預設值為 1 (啟用)

To disable direct hosting on the server:
  1. Start Registry Editor.
  2. Locate and then click the following registry key:
    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\NetBT\Parameters
  3. Add the following registry value:
    Value Name : SmbDeviceEnabled
  4. Type : REG_DWORD
    Value Data : 0
The default setting is 1 (enabled)

微軟英文版有較多的說明: Note To permit multiple connections over the NAT device, Microsoft recommends that you use SMB2 or Web Distributed Authoring and Versioning (WebDAV). With these technologies, you can perform standard file operations on a remote share. SMB2 is a new protocol that was introduced in Windows Vista. Only systems running Windows Vista and later can use the SMB2 protocol.

看到我標紅字的部份了沒?直接block 445 port似乎是最快的解決方法呀,中文版又沒有寫 Orz

整個事件可以說成:NT 4.0的SMB用戶端可以在NAT環境正常運作,只需要139 port;到Win2K加入445 port提高安全性,卻不能在NAT環境下正常運作;到了Vista/2008之後再引進SMB2才能在NAT環境下正常運作。

Update: 只在Firewall擋445 port仍然不行,Server上仍然要設定SmbDeviceEnabled

Reference: 您不能將多個用戶端連線透過 NAT 裝置
You cannot make more than one client connection over a NAT device
What’s Port 445 in W2K/XP/2003? – SMB Over TCP

留言

這個網誌中的熱門文章

DBeaver 介面語言

DBeaver是我個人頗常用的一套跨平台Database管理工具,最近升級後發現Windows版本居然變成簡體中文,而且無法切換為英文。

自然人憑證讀卡機驅動程式

鳥毅用的是第一代的自然人憑證讀卡機,EZ100PU(後來有同事買EZmini可以讀SIM卡似乎更好),每年報稅時用一次。 本來只是要申請些政府業務,一時之間找不到光碟,沒想到在 驅動程式下載 居然看到Linux和Mac的驅動程式,剩下的就是政府單位的網頁和程式應該改版了吧!!!

如何將較高版本SQL Server複製到低版本SQL Server (降級為舊版)並保留權限及資料庫圖表

一般若是要將SQL Server裡的Database轉往其他Server時,最簡單的方式就是備份(Backup)後再還原(Restore),或者是䣃離(detach)後附加(attach)。 但是很不幸地,若是由較低版本(e.g. 2008)到較高版本(e.g. 2012)要怎麼辦呢?