����Openwrt֮�޸�Ĭ��LAN IP

wangping
Mon, 30 Nov 2020 06:29:33 +0000
openwrt

Ŀ�ģ��޸�Ĭ�J��ꑵ�IP��ַ192.168.1.1

�汾��V17

�޸��ļ���./package/base-files/files/bin/config_generate

case "$protocol" in
        static)
            local ipad
            case "$1" in
                lan) ipad=${ipaddr:-"192.168.1.1"} ;;
                *) ipad=${ipaddr:-"192.168.$((addr_offset++)).1"} ;;
            esac

            netm=${netmask:-"255.255.255.0"}

            uci -q batch <<-EOF
                set network.$1.proto='static'
                set network.$1.ipaddr='$ipad'
                set network.$1.netmask='$netm'
            EOF
            [ -e /proc/sys/net/ipv6 ] && uci set network.$1.ip6assign='60'
        ;;