Monday, November 8, 2021

ACCESS SAMBA SERVER ON CUSTOM PORT / REDIRECT PORT - IPV4 PROXY PORT WITH NETSH

If you need to run a samba server with a custom port (on a linux server for example) and need to access it remotely.
Or even want to redirect a certain port to another in Windwos

1 - Run the Add Hardware wizard Open the execeutar (Windows + R) type hdwwiz.exe and run


Next to continue


Select Install the hardware I manually select from a list (advanced) Then click Next to continue


From the list select Network adapters Then click Next to continue


From the list on the left select Microsoft From the list on the right select Microsoft KM-TEST Loopback Adapter Then click Next to continue


At the end click Next and the test interface will be installed


If necessary, renamed to find more easily


Go to settings and select Internet Protocol Version 4 (TCP/IPv4) Then click Properties


Set any IP, just being careful not to be in the same IP range as your current network(s) and cause an IP conflict
In my case I used the ip 10.10.10.1

Open PowerShell or CMD as an administrator and type the command below

netsh interface portproxy add v4tov4 listenaddress=10.10.10.1 listenport=445 connectaddress=domain.com.br connectport=44518


Where
listenaddress - is the address defined in the previous steps, in this example 10.10.10.1
listenport - the original samba port (445, 137, 138, 139) usually only 445 will resolve
connectaddress - the remote address that will be proxied, can be a domain dominio.com.br or an ip 200.168.150.135
connectport - the custom port of the service, in the example I used the 44518


Restart your computer then!

Once this is done the port forwarding will already be working
In the case of the example accessible through \\10.10.10.1
Collected from : https://apolonioserafim.blogspot.com/2021/05/acessar-servidor-samba-em-porta.html

No comments:

YouTube Channel