Hello,
On my local network I have two Internet gateways :
. 192.168.1.2 as default (fiber speed)
. and 192.168.1.1 as spare (dsl speed)
My Windows 10 operating system can switch automatically between gateways at any time. When 192.168.1.2 is down, all my Internet requests pass throught 192.168.1.1. And 192.168.1.1 becomes the favorite gateway. Just I used metrics values to define priority in the IPv4 interface of the network adapter.
But "SysInfoType=GATEWAY_ADDRESS" doesn't detect the current used gateway.
It always return 192.168.1.2 instead of 192.168.1.1 when 192.168.1.2 is down.
It seems the SysInfo.dll only reads the Gateway's IP set as first IP.
It doesn't take care about the working Gateway's IP.
I didn't find alternative tips to get the expect value with Windows dynamic gateway.
So I would inform you.
It is currently March 29th, 2024, 2:28 pm
Dynamic gateway IP address not updated in Rainmeter
-
- Posts: 7
- Joined: September 1st, 2018, 10:01 pm
Dynamic gateway IP address not updated in Rainmeter
Last edited by Andearoid on September 2nd, 2018, 11:48 pm, edited 1 time in total.
-
- Developer
- Posts: 22628
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Dynamic gateway IP address not updated in Rainmeter
Did you try setting DynamicVariables=1 on the measure?Andearoid wrote:Hello,
On my local network I have two Internet gateways :
. 192.168.1.2 as default (fiber speed)
. and 192.168.1.1 as spare (dsl speed)
My Windows 10 operating system can switch automatically between gateways at any time. When 192.168.1.2 is down, all my Internet requests pass throught 192.168.1.1. And 192.168.1.1 becomes the favorite gateway. Just I used metrics values to define priority in the IPv4 interface of the network adapter.
But "SysInfoType=GATEWAY_ADDRESS" doesn't detect the current used gateway.
It always return 192.168.1.2 instead of 192.168.1.1 when 192.168.1.2 is down.
It seems the SysInfo.dll only reads the Gateway's IP set as first IP.
It doesn't take care about the working Gateway's IP.
I didn't find alternative tips to get the expect value with Windows dynamic gateway.
So I would inform you.
-
- Posts: 7
- Joined: September 1st, 2018, 10:01 pm
Re: Dynamic gateway IP address not updated in Rainmeter
I just did the test with "DynamicVariables=1"
Like this :
And no. When I stop manualy 192.168.1.2 the gateway value stay on 192.168.1.2 in Rainmeter. But my Web traffic pass throught 192.168.1.1.
It doesn't matter for me. I can use the external IP address to know wich gateway is in use. Each Internet connection have a different public IP. Then I deduce the route.
If you're interested about this multiple gateway feature :
. https://support.microsoft.com/en-us/help/299540/an-explanation-of-the-automatic-metric-feature-for-ipv4-routes
. http://www.atechnote.com/2012/05/how-to-add-multi-gateways-to-multiple.html
It's better to define your metric value for each gateway instead of using automatic mode. The lowest metric value define the favourite route.
Like this :
Code: Select all
[MeasureGatewayLAN]
Measure=Plugin
Plugin=SysInfo.dll
SysInfoType=GATEWAY_ADDRESS
SysInfoData=#IDInterface#
DynamicVariables=1
Substitute="":"N/A"
[DisplayGatewayLAN]
Meter=String
MeasureName=MeasureGatewayLAN
Text="%1"
It doesn't matter for me. I can use the external IP address to know wich gateway is in use. Each Internet connection have a different public IP. Then I deduce the route.
If you're interested about this multiple gateway feature :
. https://support.microsoft.com/en-us/help/299540/an-explanation-of-the-automatic-metric-feature-for-ipv4-routes
. http://www.atechnote.com/2012/05/how-to-add-multi-gateways-to-multiple.html
It's better to define your metric value for each gateway instead of using automatic mode. The lowest metric value define the favourite route.
-
- Posts: 7
- Joined: September 1st, 2018, 10:01 pm
Re: Dynamic gateway IP address not updated in Rainmeter
Here is the trick I use to get the current Gateway and update the value automatically :
I launch a Tracert command with the RunCommand plugin every minutes.
I consider the first node I found is the gateway I use to join my favourite domain name.
Then I parse the result and grab the IP of this first node.
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=50,50,50,150
[ScheduleMesureGatewayLAN]
Measure=Calc
Formula=0
OnUpdateAction=[!CommandMeasure MeasureGatewayLAN "Run"]
UpdateDivider=60
[MeasureGatewayLAN]
Measure=Plugin
Plugin=RunCommand
Parameter=tracert -h 1 -4 microsoft.com
State=Hide
OutputType=ANSI
RegExpSubstitute=1
Substitute="":"N/A","#CRLF#":"","^.*\[(?!.*\[)":"","\](?!.*\]).*$":""
[MeterDisplayGatewayText]
Meter=String
X=10
Y=10R
W=135
H=20
Text="Gateway = "
FontColor=255,255,255
FontFace=Tahoma
FontSize=10
AntiAlias=1
[MeterDisplayGatewayLAN]
Meter=String
MeasureName=MeasureGatewayLAN
StringAlign=Right
X=200
Y=-20R
H=20
Text="%1"
FontColor=255,255,255
FontFace=Tahoma
FontSize=10
AntiAlias=1
I consider the first node I found is the gateway I use to join my favourite domain name.
Then I parse the result and grab the IP of this first node.
-
- Posts: 7
- Joined: September 1st, 2018, 10:01 pm
Re: Dynamic gateway IP address not updated in Rainmeter
Here is a fix. I had to modify my Regexp to grab the first IP. Because on my Windows 2016 Server the tracert doesn't resolve hosts names and the syntax result is different.
This versions works properly on my Windows 10 and 2016 Server at now.
This versions works properly on my Windows 10 and 2016 Server at now.
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=50,50,50,150
[ScheduleMesureGatewayLAN]
Measure=Calc
Formula=0
OnUpdateAction=[!CommandMeasure MeasureGatewayLAN "Run"]
UpdateDivider=60
[MeasureGatewayLAN]
Measure=Plugin
Plugin=RunCommand
Parameter=tracert -d -h 1 -4 microsoft.com
State=Hide
OutputType=ANSI
RegExpSubstitute=1
Substitute="":"N/A","#CRLF#":""," ":"","^.*ms(?!.*ms)":"","[a-zA-Z].*$":""
[MeterDisplayGatewayText]
Meter=String
X=10
Y=10R
W=135
H=20
Text="Gateway = "
FontColor=255,255,255
FontFace=Tahoma
FontSize=10
AntiAlias=1
[MeterDisplayGatewayLAN]
Meter=String
MeasureName=MeasureGatewayLAN
StringAlign=Right
X=200
Y=-20R
H=20
Text="%1"
FontColor=255,255,255
FontFace=Tahoma
FontSize=10
AntiAlias=1