openwrt 源碼更改IP,添加root 密碼、更改ssid、更改時區/主機名

更改IP 

 
一、更改:/package/base-files/files/lib/functions/uci-default.sh
ucidef_set_interface_lan() {
        local ifname=$1
        uci batch <<EOF
set network.lan='interface'
set network.lan.ifname='$ifname'
set network.lan.type='bridge'
#更改lan口獲取ip的方式爲static
set network.lan.proto='static'
#更改lan口ip爲10.1
set network.lan.ipaddr='192.168.8.1'
set network.lan.netmask='255.255.255.0'
set network.lan.ip6addr='fd04:bd3:80e8:1::1/64'
EOF
}

 


二、 15.05版本可能還須要更改 /package/base-files/files/bin/config_generate
 
  1.     [ -n "$vlan" ] && ifname=${ifname}.${vlan}
        uci -q batch <<EOF
    delete network.$1
    set network.$1='interface'
    set network.$1.ifname='$ifname'
    set network.$1.force_link=1
    set network.$1.proto='none'
    set network.$1.macaddr='$macaddr'
    EOF
        case $1 in
        lan) uci -q batch <<EOF
    set network.$1.type='bridge'
    set network.$1.proto='static'
    set network.$1.ipaddr='192.168.8.1'
    set network.$1.netmask='255.255.255.0'
    set network.$1.ip6assign='60'
    EOF

     


 

添加root 密碼

 
更改:/package/base-files/files/etc/shadow
 
  1. root:$1$w5bS7kS8$EdCLg/tPX6T8wv4VXWNtn.:0:0:99999:7:::

     

 
密碼採用linux用戶的加密方式
以冒號爲分隔符,第一個冒號以前爲用戶名
        
第一個冒號和第二個冒號中間的爲加密的密碼,此處列出的內容爲root
 
 
 

更改ssid

 
更改:/package/mac80211/files/lib/wifi/mac80211.sh
 
config wifi-device radio$devidx
option type mac80211
option channel ${channel}
option hwmode 11${mode_11n}${mode_band}$dev_id$ht_capab
# REMOVE THIS LINE TO ENABLE WIFI:
option disabled 1
#刪掉上面那一行或者將值從1改成0,則能夠開啓wifi
config wifi-iface
option device radio$devidx
option network lan
option mode ap
#option ssid OpenWrt
option ssid mywifi
#更改成你想要的ssid
option encryption none

 


 
 

更改時區/主機名

 
更改:/package/base-files/files/etc/config/system
 
  1. # add option zonename Asia/Shanghai by benlau
    # modify option timezone from UTC to CST-8 by benlau
    option hostname myhost
    option timezone CST-8
    option zonename Asia/Shanghai

     

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 



相關文章
相關標籤/搜索