Difference between revisions of "Template:IP Range"

From Second Life Wiki
Jump to navigation Jump to search
(FIXED this! #log: does not exist in this Wiki; however #expr does evaluate natural logarithms, and with a bit of math, you can get it working!)
 
(14 intermediate revisions by one other user not shown)
Line 7: Line 7:
|{{{{PAGENAME}}<nowiki>|ip=255.255.255.255|npl=30}}</nowiki>
|{{{{PAGENAME}}<nowiki>|ip=255.255.255.255|npl=30}}</nowiki>
|{{{{PAGENAME}}|ip=255.255.255.255|npl=30}}
|{{{{PAGENAME}}|ip=255.255.255.255|npl=30}}
|-
|{{{{PAGENAME}}<nowiki>|ip=255.255.255.255|subnet=255.255.255.252}}</nowiki>
|{{{{PAGENAME}}||ip=255.255.255.255|subnet=255.255.255.252}}
|}
|}
</noinclude><includeonly>{{#if:{{#vardefine:ip-npl|{{#switch:{{{npl}}}
</noinclude><includeonly>{{#if:
{{#vardefine:ip-num|{{#switch:{{{npl|}}}
|32=1|31=2|30=4|29=8
|32=1|31=2|30=4|29=8
|28=16|27=32|26=64|25=128
|28=16|27=32|26=64|25=128
Line 17: Line 21:
|8=16777216|7=33554432|6=67108864|5=134217728
|8=16777216|7=33554432|6=67108864|5=134217728
|4=268435456|3=536870912|2=1073741824|1=2147483648
|4=268435456|3=536870912|2=1073741824|1=2147483648
|0=4294967296|1
|0=4294967296|{{#expr:4294967296 - {{IP_Range/IP2Int|{{{subnet|255.255.255.255}}}}}}}
}}}}
}}}}
{{#vardefine:ip|{{IP_Range/IP2Int|{{{ip|}}}}}}}
{{#vardefine:ip-npl|{{#expr:32 - ln{{#var:ip-num}}/ln2}}}}
{{#vardefine:ip-mod|{{mod|{{#var:ip}}|{{#var:ip-npl}}}}}}
{{#vardefine:ip-count|{{#expr: {{#var:ip-count}} + {{#var:ip-num}}}}}}
{{#vardefine:ip-start|{{#expr:{{#var:ip}} - {{#var:ip-mod}}}}}}
{{#vardefine:ip-start|{{IP_Range/IP2Int|{{{ip|}}}}}}}
{{#vardefine:ip-end|{{#expr:{{#var:ip-start}} + {{#var:ip-npl}} - 1}}}}
{{#vardefine:ip-start|{{#expr: {{#var:ip-start}} - {{mod|{{#var:ip-start}}|{{#var:ip-num}}}}}}}}
{{#vardefine:ip-end|{{IP Range/Int2IP|{{#var:ip-end}}}}}}
{{#vardefine:ip-end|{{IP Range/Int2IP|{{#expr: {{#var:ip-start}} + {{#var:ip-num}} - 1}}}}}}
{{#vardefine:ip-start|{{IP Range/Int2IP|{{#var:ip-start}}}}}}
{{#vardefine:ip-start|{{IP Range/Int2IP|{{#var:ip-start}}}}}}
}}{{HoverText|{{#var:ip-start}}/{{{npl}}}|{{#var:ip-start}} to {{#var:ip-end}}, mask {{IP Range/Int2IP|(4294967295 * {{#var:ip-npl}})}}}}</includeonly>
}}{{HoverText|{{#var:ip-start}}/{{#var:ip-npl}}|Start:&nbsp;{{#var:ip-start}}, End:&nbsp;{{#var:ip-end}}, Addresses:&nbsp;{{#var:ip-num}}, Subnet&nbsp;Mask:&nbsp;{{IP Range/Int2IP|(4294967295 * {{#var:ip-num}})}}}}</includeonly>

Latest revision as of 12:12, 20 June 2023

{{IP Range|ip=0.0.0.0|npl=30}} 0.0.0.0/30
{{IP Range|ip=255.255.255.255|npl=30}} 255.255.255.252/30
{{IP Range|ip=255.255.255.255|subnet=255.255.255.252}} 255.255.255.252/30