Jump to content

OpenWRT command line configuration guide


Recommended Posts

I wrote up a quick guide to configuring OpenWRT (the platform for Jasager) from the command line and thought I would share it here. It is available at http://alex.hrck.net/?p=64

OpenWRT comes with a program called uci, or Unified Configuration Interface. This utility allows you to temporary or permanently modify the system configuration files in the /etc/config/ directory. Also allows for easy scripting.

The syntax is broken into three parts. The first two are mandatory with the [arguments] field being optional depending on the [option]

uci options commands arguments

[commands] is also broken down into three parts: file.section.option. Section can be called by their name, such as lan, wan as in /etc/config/network or wifi0 in /etc/config/wireless. Sections that do not have names can be called their position in the array of sections. An example of this is wireless.@wifi-iface[0].ssid

To view a configuration file such as /etc/config/network:

uci export network

Making or adding a new value to a section, in this case the default gatway, is easy as typing:

uci set network.lan.gateway=10.168.1.1
OR
uci set network.@interface[1].gateway=10.168.1.1

To add and delete options use uci add or uci delete:

uci delete wireless.@wifi-iface[0].encryption

It is also possible to set DHCP options, such as the gateway or DNS servers to push to clients. Refer to this website to find the DHCP option codes.

uci add_list network.lan.dhcp_option="3,10.168.1.1"

When done making changes you must run:

uci commit [configuration]
example: uci commit network

It is possible to change the behavior of startup services.

root@OpenWRT:~#/etc/init.d/network
Syntax /etc/init.d/network [command]
Available commands:
start Start the service
stop Stop the service
restart Restart the service
reload Reload configuration files (or restart if that fails)
enable Enable service autostart
disable Disable service autostart

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...