可取代 modprobe, insmod,rmmod,lsmod
kmod static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf
2016年10月11日 星期二
列出所有網路遮罩長度 IP
package main
import (
"fmt"
"math"
"net"
"encoding/binary"
)
func main() {
var ii uint32 = 0
for i:=1; i<33; i++ {
ii += uint32(math.Pow(2, float64(32-i)));
fmt.Print(i, " ", long2ip(ii), " ", ii, "\n")
}
}
func ip2long(ipstr string) uint32 {
ip := net.ParseIP(ipstr)
if ip == nil { return 0 }
return binary.BigEndian.Uint32(ip.To4())
}
func long2ip(ipLong uint32) string {
ipByte := make([]byte, 4)
binary.BigEndian.PutUint32(ipByte, ipLong)
return net.IP(ipByte).String()
}
import (
"fmt"
"math"
"net"
"encoding/binary"
)
func main() {
var ii uint32 = 0
for i:=1; i<33; i++ {
ii += uint32(math.Pow(2, float64(32-i)));
fmt.Print(i, " ", long2ip(ii), " ", ii, "\n")
}
}
func ip2long(ipstr string) uint32 {
ip := net.ParseIP(ipstr)
if ip == nil { return 0 }
return binary.BigEndian.Uint32(ip.To4())
}
func long2ip(ipLong uint32) string {
ipByte := make([]byte, 4)
binary.BigEndian.PutUint32(ipByte, ipLong)
return net.IP(ipByte).String()
}
列出所有網路遮罩長度 IP
$ip = 0;
for ($i=1; $i<33; $i++)
printf("%d %s %s\n\n", $i, $ip+= pow(2, 32-$i), long2ip($ip));
訂閱:
文章 (Atom)