# IPv4/IPv6 cheat sheet ######################################## # Set variables set page_width 157 set page_height 208 set menu_width 11.8 set top 4 set lcol [expr $menu_width + 4] set vlx [expr $menu_width + 70 ] set rcol1 [expr $vlx + 5] set rcol2 [expr $rcol1 + 26] set rcol3 [expr $rcol1 + 65] set footer_height 6 set footer_top [expr $page_height - $footer_height] ######################################## # Set variables related to text set font_name "Lines" set text_size 3 set title_size 5 # Illustrating a problem with drawj2d - sometimes the 'font' command doesn't # handle "$title_size" or "$text_size" correctly, instead of setting the size # it sets the font to a truetype font. Once that issue is figured out, this # variable (and the "if" blocks which use it) will no longer be needed. set fsvar 0 ############################################################################### # # Mark out the area on the left pen black 0.25 solid hatch -30 2 hatchrect 0 0 $menu_width 208 line $menu_width 0 $menu_width 208 ######################################## # Numbers set yt [expr $top + $title_size] moveto $lcol $yt if { > $fsvar 0 } { font $font_name bold $title_size } else { font $font_name bold 5 } text "Address Fragments" if { > $fsvar 0 } { font $font_name bold $text_size } else { font $font_name bold 3 } set ly [expr $yt + 1] set lr [expr $vlx - 5] line $lcol $ly $lr $ly moveto $lcol [expr $ly + $text_size + 1] text " 0 32 64 96 128 160 192 224" text " 1 33 65 97 129 161 193 225" text " 2 34 66 98 130 162 194 226" text " 3 35 67 99 131 163 195 227" text " 4 36 68 100 132 164 196 228" text " 5 37 69 101 133 165 197 229" text " 6 38 70 102 134 166 198 230" text " 7 39 71 103 135 167 199 231" text " 8 40 72 104 136 168 200 232" text " 9 41 73 105 137 169 201 233" text " 10 42 74 106 138 170 202 234" text " 11 43 75 107 139 171 203 235" text " 12 44 76 108 140 172 204 236" text " 13 45 77 109 141 173 205 237" text " 14 46 78 110 142 174 206 238" text " 15 47 79 111 143 175 207 239" text " 16 48 80 112 144 176 208 240" text " 17 49 81 113 145 177 209 241" text " 18 50 82 114 146 178 210 242" text " 19 51 83 115 147 179 211 243" text " 20 52 84 116 148 180 212 244" text " 21 53 85 117 149 181 213 245" text " 22 54 86 118 150 182 214 246" text " 23 55 87 119 151 183 215 247" text " 24 56 88 120 152 184 216 248" text " 25 57 89 121 153 185 217 249" text " 26 58 90 122 154 186 218 250" text " 27 59 91 123 155 187 219 251" text " 28 60 92 124 156 188 220 252" text " 29 61 93 125 157 189 221 253" text " 30 62 94 126 158 190 222 254" set letters_y [Y [here]] text " 31 63 95 127 159 191 223 255" text "" ######################################## # CIDR masks part 1 set fy [Y [here]] text "/0 /1 /2 /3 /4 /5 /6 /7 /8" text "/9 /10 /11 /12/ 13 /14 /15 /16" text "/17 /18 /19 /20 /21 /22 /23 /24" text "/25 /26 /27 /28 /29 /30 /31 /32" text "" text "/33 /34 /35 /36 /37 /38 /39 /40" text "/41 /42 /43 /44 /45 /46 /47 /48" text "/49 /50 /51 /52 /53 /54 /55 /56" text "/57 /58 /59 /60 /61 /62 /63 /64" ######################################## # Vertical line down the middle line $vlx 0 $vlx $footer_top ############################################################ # IPv4 refrence set ty [expr $top + $title_size] set ly [expr $ty + 1] set by [expr $ty + $text_size + 2] moveto $rcol1 $ty if { > $fsvar 0 } { font $font_name bold $title_size } else { font $font_name bold 5 } text "IPv4 Reference" if { > $fsvar 0 } { font $font_name bold $text_size } else { font $font_name bold 3 } line $rcol1 $ly $rcol3 $ly moveto $rcol1 $by text "Localhost" text "Link-local" text "Shared" text "" text "RFC-1918" text "" text "" text "" text "Documentation" moveto $rcol2 $by text "127.0.0.1/32" text "169.254.0.0/16" text "100.64.0.0/10" text "" text "10.0.0.0/8" text "172.16.0.0/12" text "192.168.0.0/16" text "" text "192.0.2.0/24" text "198.51.100.0/24" text "203.0.113.0/24" ############################################################ # IPv6 reference set py [Y [here]] set ty [expr $py + $title_size] set ly [expr $ty + 1] set by [expr $ty + $text_size + 2] moveto $rcol1 $ty if { > $fsvar 0 } { font $font_name bold $title_size } else { font $font_name bold 5 } text "IPv6 Reference" if { > $fsvar 0 } { font $font_name bold $text_size } else { font $font_name bold 3 } line $rcol1 $ly $rcol3 $ly moveto $rcol1 $by text "Localhost" text "Link-local" text "Discard-only" text "" text "Documentation" text " (includes)" moveto $rcol2 $by text "::1/128" text "fe80::/10" text "100::/64" text "" text "2001:db8::/32" text " 2001:db8:c0:ffee::/64" text " 2001:db8:dead:beef::/64" ######################################## # CIDR masks part 2 #set py [Y [here]] #moveto $rcol1 $py moveto $rcol1 $letters_y text "A B C D E F a b c d e f :: ::/ \[ \]" moveto $rcol1 $fy text "/65 /66 /67 /68 /69 /70 /71 /72" text "/73 /74 /75 /76 /77 /78 /79 /80" text "/81 /82 /83 /84 /85 /86 /87 /88" text "/89 /90 /91 /92 /93 /94 /95 /96" text "/97 /98 /99 /100 /101 /102 /103" text "/104 /105 /106 /107 /108 /109 /110" text "/111 /112 /113 /114 /115 /116 /117" text "/118 /119 /120 /121 /122 /123 /124" text "/125 /126 /127 /128" ######################################## # Footer line $menu_width $footer_top $page_width $footer_top font Lines bold 2 moveto 137 [expr $footer_top + 2] text "/path/to/ipv4.hcl"