Difference between revisions of "Template:IP Range"
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!) |
|||
(One intermediate revision by one other user not shown) | |||
Line 12: | Line 12: | ||
|} | |} | ||
</noinclude><includeonly>{{#if: | </noinclude><includeonly>{{#if: | ||
{{#vardefine:ip- | {{#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 23: | Line 23: | ||
|0=4294967296|{{#expr:4294967296 - {{IP_Range/IP2Int|{{{subnet|255.255.255.255}}}}}}} | |0=4294967296|{{#expr:4294967296 - {{IP_Range/IP2Int|{{{subnet|255.255.255.255}}}}}}} | ||
}}}} | }}}} | ||
{{#vardefine:ip-count|{{#expr:{{#var:ip-count}}+{{#var:ip- | {{#vardefine:ip-npl|{{#expr:32 - ln{{#var:ip-num}}/ln2}}}} | ||
{{#vardefine:ip-count|{{#expr: {{#var:ip-count}} + {{#var:ip-num}}}}}} | |||
{{#vardefine:ip-start|{{IP_Range/IP2Int|{{{ip|}}}}}}} | {{#vardefine:ip-start|{{IP_Range/IP2Int|{{{ip|}}}}}}} | ||
{{#vardefine:ip-start|{{#expr:{{#var:ip-start}} - {{mod|{{#var:ip-start}}|{{#var:ip- | {{#vardefine:ip-start|{{#expr: {{#var:ip-start}} - {{mod|{{#var:ip-start}}|{{#var:ip-num}}}}}}}} | ||
{{#vardefine:ip-end|{{IP Range/Int2IP|{{#expr:{{#var:ip-start}} + {{#var:ip- | {{#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}}/ | }}{{HoverText|{{#var:ip-start}}/{{#var:ip-npl}}|Start: {{#var:ip-start}}, End: {{#var:ip-end}}, Addresses: {{#var:ip-num}}, Subnet Mask: {{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 |