Reputation: 61
Due to several circumstances, I need to configure my windows client to be able to receive through another port than 445 or 139 with Samba communication. The idea is to avoid as much as possible having to install any additional program in windows 10, or if necessary, that it could be configured through code in c++. For my tests, the samba server is running on a Linux machine.
First of all, I’ve tried the samba communication without changing the port and it works perfectly, executing in windows (Start→Run): \\[Ip_Server]\
To change the port in the server, I've added the line smb ports = 2000
(this port number is just for the example) in the "/etc/samba/smb.conf" file and checked the change with:
netstat -an| grep -iE ":2000"
.
After that, in the client I've tried the following steps:
sc config lanmanserver start= delayed-auto
sc config iphlpsvc start= auto
netsh interface portproxy add v4tov4 listenaddress=[Ip_client] listenport=445 connectaddress=[Ip_client] connectport=2000
(I've tried this step with both IPs, client’s and server’s, and changing the order of the ports). After that, I try again the samba connection, and I'm not able to connect with the server.
If anyone knows what the problem might be and has a solution, it would be helpful.
Upvotes: 6
Views: 2467
Reputation: 7397
To force iphlpsvc
to start before lanmanserver
, this guide suggests making iphlpsvc
a dependency of lanmanserver
, using the following command:
sc config lanmanserver depend= samss/srv2/iphlpsvc
This should allow the port proxy to bind to 445, before lanmanserver binds 445 on all interfaces.
Upvotes: 0