Setting Default Configuration

8 posts / 0 new
Last post
raju
raju's picture
Setting Default Configuration

I am creating a custom build of OpenWRT and one of the things I'd like to do is automatically set some defaults configuration items.  The reason for this is that I'll be flashing a bunch of routers (several 100) and I don't want to have to configure each one individually.  In particular, I would like to:

1. Disable telnetd, enable sshd.

2. Set a root/admin password (not sure if setting this password will accomplish #1)

3. Enable wireless with a preset SSID, encryption and passwd.

I tried creating a /etc/config/wireless file in the firmware but it seems to get overwritten by /etc/init.d/network.

Any pointers on how to accomplish this?  In Tomato, there was a defaults.c file with the nvram code where I could pretty much do everything in one place, but I'm not what the equivilent is in OpenWrt.

Thanks

--raju 

Subhra
Subhra's picture
Though I am not much friendly

Though I am not much friendly with OpenWrt build system , I am trying to answer your quires ..

1. Do make menuconfig in packgae dir and do your own selection, save it, a .config file will be generated accordingly. Copy this .config file in another place. Use a script to copy this .config file to exact location when you want to build openwrt.

2. I guess to set the password you have to edit /etc/passwd file. You will find many good tutorials expalining how to do it. As per my knowledge concerns, in default case OpenWrt does not use any passwd for login.

3. As per my knowledge concern, in OpenWrt build system this wireless file is created during compilation, thats why your changes are being overwritten. You must find the exact location where it is created and do the changes accordingly.

raju
raju's picture
 Hi Subhra, thanks for the

 Hi Subhra, thanks for the response ...

I looked at /etc/password after I created the password there's what appears to be a crypt version of the password. thanks!  and yes, you are correct, there is no default password set.

So when i look in build_dir/target-*/root-*/etc/config/wireless the file I created is there, something else after compilation appears to overwrite it.  When I created a previous version of the firmware without the wireless file, it seemed to get autogenerated when i turned wifi on, so there's must be some other place where it get's it's configuration from.  Anyway, I have to do a bit more digging.

Thanks!

Subhra said: Though I am not much friendly with OpenWrt build system , I am trying to answer your quires .. 1. Do make menuconfig in packgae dir and do your own selection, save it, a .config file will be generated accordingly. Copy this .config file in another place. Use a script to copy this .config file to exact location when you want to build openwrt. 2. I guess to set the password you have to edit /etc/passwd file. You will find many good tutorials expalining how to do it. As per my knowledge concerns, in default case OpenWrt does not use any passwd for login.3. As per my knowledge concern, in OpenWrt build system this wireless file is created during compilation, thats why your changes are being overwritten. You must find the exact location where it is created and do the changes accordingly.

Subhra
Subhra's picture
Containts of build_dir/target

Containts of build_dir/target-*/root-*/ are regenerated every time you compile Openwrt distribution. So, you have to make the changes somewhere else.
I m using backfire and was able to customise wireless configuration by making some changes in package/mac80211. You can look into in this directory to make your changes.

raju
raju's picture
Sorry, meant to followup, I

Sorry, meant to followup, I did track down the script that generates the wireless config under mac80211, took a bit of `find`ing and `grep`ing :)

 

Thanks again

 

Subhra said: Containts of build_dir/target-*/root-*/ are regenerated every time you compile Openwrt distribution. So, you have to make the changes somewhere else. I m using backfire and was able to customise wireless configuration by making some changes in package/mac80211. You can look into in this directory to make your changes.

Subhra
Subhra's picture
So, are able to make it

So, are able to make it working??
I found an inetrseting thing at my end. There is a script in package/mac80211/files/lib/wifi/mac80211.sh when the details of wifi-interface can be set. In openwrt the default settings is like that. you can do your changes here. Hope this will do your job.

config wifi-iface
option device wlan$devidx
option network lan
option mode ap
option ssid OpenWrt
option encryption none

Suppose you want to have the following configuratios.... SSID = OpenWRT-ap, encryption = wep and password = password, then your configuration will something like that ...

config 'wifi-iface'
option device wlan$devidx
option network lan
option mode ap
option ssid OpenWRT-ap
option encryption wep
option key password

Try this and please let us know the result.

raju
raju's picture
yes that exactly what I had

yes that exactly what I had done and it does work. I was just a bit surprised that there wasn't a central place where a bunch of defaults could be set, but as yet, I have not found any. In any case, I think this works perfectly for what I was trying to do.

Thanks!

Subhra
Subhra's picture
Its good to hear things are

Its good to hear things are working properly at your end...