固定无线网卡interface名称为wlan0

需求:即使插入不同型号的无线网卡,生成的节点名称永远是wlan0,限制系统只能使用一个无线网卡,并且节点名称不变
1)rm /etc/udev/rules.d/70-persistent-net.rules

2)vi /lib/udev/write_net_rules,修改成如下

write_rule() {
    local match="$1"
    local name="$2"
    local comment="$3" 
    if [ ${name:0:4} = "wlan" ]; then
        name=wlan0
    fi
    {
    if [ "$PRINT_HEADER" ]; then
        PRINT_HEADER=
        echo "# This file was automatically generated by the $0"
        echo "# program, run by the persistent-net-generator.rules rules file."
        echo "#"
        echo "# You can modify it, as long as you keep each rule on a single"
        echo "# line, and change only the value of the NAME= key."
    fi

    echo ""
    [ "$comment" ] && echo "# $comment"
    echo "SUBSYSTEM==\"net\", ACTION==\"add\"$match, NAME=\"$name\""
    } >> $RULES_FILE
}

你可能感兴趣的:(cubieboard2)