How to allow incoming connections from specific ip address?

Page 2 of 2 FirstFirst 12

  1. Posts : 1,363
    Win7 pro x64
       #11

    peter7277 said:
    How to allow incoming connections for ip range? For example, for ip addresses from 198.168.0.101 to 198.168.0.120
    no idea. but try this:

    open notepad to a new file, call it openup.cmd, put a bunch of lines in it like this:
    ---------------------------------
    netsh advfirewall firewall add rule name="Allow from 192.0.0.101" dir=in action=allow protocol=ANY remoteip=192.0.0.101

    netsh advfirewall firewall add rule name="Allow from 192.0.0.102" dir=in action=allow protocol=ANY remoteip=192.0.0.102
    ---------------------

    up to 120. Save the file, add it to your startup folder. Make sure it is not a txt file, it has to be a cmd file.

    ---------------

    edit

    based on this page

    How to block IP ranges in Windows Firewall - gHacks Tech News

    the command

    netsh advfirewall firewall add rule name="Allow from 192.0.0.100/120" dir=in action=allow protocol=ANY remoteip=192.0.0.100/120

    might be the syntax that specifies the range from 100 to 120.
    Last edited by johnhoh; 11 Jan 2019 at 09:55.
      My Computer


  2. Posts : 83
    Windows 7 Ultimate x64
    Thread Starter
       #12

    johnhoh said:

    based on this page

    How to block IP ranges in Windows Firewall - gHacks Tech News

    the command

    netsh advfirewall firewall add rule name="Allow from 192.0.0.100/120" dir=in action=allow protocol=ANY remoteip=192.0.0.100/120

    might be the syntax that specifies the range from 100 to 120.
    It worked but for some reason if i use this ip range format '192.168.0.101/120' i get this error "A specified IP address or address keyword is not valid.". I had to use this format to make it work - '192.168.0.0/24'
      My Computer


  3. Posts : 1,363
    Win7 pro x64
       #13

    maybe it needs to start with 0. A dash instead of a slash might also work
      My Computer


 
Page 2 of 2 FirstFirst 12

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 07:47.
Find Us