I needed a way to periodically update a named IP Range with a single address to customize the IP Range characteristics for a client with a dynamic IP address.
hmsUpdateRangeIP.exe was written to update a specific IP Range identified by hostname with the address that hostname resolves to in DNS.
To use hmsUpdateRangeIP.exe, edit the appropriate .reg file for your OS and populate the Nameserver, Username, and Password fields with the DNS server, and credentials to access HMS. Change the Logging level (0-2) if you want more or less verbosity in the event log. Copy hmsUpdateRangeIP.exe to your hMailServer\Bin directory and schedule it to run using Task Scheduler, passing the IP Range name as a parameter.
The named IP Range must already exist in HMS, with the same name as the hostname being looked up. Set the range characteristics to your preference. hmsUpdateRangeIP.exe only updates the Upper IP and Lower IP with the first address returned by DNS. All other properties of the range are unchanged.
Written in Delphi. Source included. Requires The Indy Project libraries to compile. Freeware under The MIT License.
Utility to update IP Range address
-
- Senior user
- Posts: 837
- Joined: 2016-12-08 02:21
Utility to update IP Range address
- Attachments
-
- hmsUpdateRangeIP.zip
- IP Range DDNS Updater
- (202.14 KiB) Downloaded 339 times
-
- Senior user
- Posts: 837
- Joined: 2016-12-08 02:21
Re: Utility to update IP Range address
Well, I'm bumping this thread myself because today I learned a powerful lesson and this utility is the answer to it not repeating.
I auto-banned myself and spent hours troubleshooting because auto-band connection drop actions are not logged in the Application log (maybe they are logged in the Debug log but I don't keep that enabled).
So I found another use for this utility...keep you own dynamic IP from being auto-banned accidentally.
Just create a range with your hostname as the Name, set the Priority higher that 20, and set the other settings to your preference.
See above for the rest of the implementation detail.
I auto-banned myself and spent hours troubleshooting because auto-band connection drop actions are not logged in the Application log (maybe they are logged in the Debug log but I don't keep that enabled).
So I found another use for this utility...keep you own dynamic IP from being auto-banned accidentally.
Just create a range with your hostname as the Name, set the Priority higher that 20, and set the other settings to your preference.
See above for the rest of the implementation detail.
- jimimaseye
- Moderator
- Posts: 10060
- Joined: 2011-09-08 17:48
Re: Utility to update IP Range address
Why are connections on the same wan address presented as the external address instead of an internal LAN address?
5.7 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829
Re: Utility to update IP Range address
In my case its a router that doesn't do hairpinning very well (or at all). I fixed that by changing my hosts file on the client machine to point to the LAN address of the server on my domains.jimimaseye wrote: ↑2021-10-14 08:58Why are connections on the same wan address presented as the external address instead of an internal LAN address?
Also, I excluded dynamic WAN IP from scripted filters like this:
Code: Select all
Function WANIP
With CreateObject("DNSLibrary.DNSResolver")
WANIP = .IPv4A("mydomain.tld")
End With
End Function
Sub OnClientConnect(oClient)
If oClient.IPAddress = WANIP Then Exit Sub
'
' etc
'
End Sub