[[PageOutline]] = OpenWrt Network Configuration = OpenWrt completely replaces the conventional Linux distribution methods of network configuration. The various config files are replaced with the Unified Configuration Interface or [http://wiki.openwrt.org/doc/uci UCI]. OpenWrt manages its own 'virtual' network interface names in /etc/config/network. See Also: * [http://wiki.openwrt.org/doc/uci/wireless OpenWrt Wiki for Wireless] * [http://wiki.openwrt.org/doc/uci OpenWrt UCI] * [wiki:OpenWrt/wireless OpenWrt Wireless] == UCI and config files == You can use the {{{uci}}} command-line utility to get/set configuration or edit the files directly under /system/config (if you know what your doing). Often we will provide uci command-line examples because these can be easily cut-n-pasted into a shell. UCI configuration can be edited in the files in /etc/config directly or by using {{{uci}}} commands. Often we will provide uci command-line examples because these can be easily cut-n-pasted into a shell. Network configuration is contained in /etc/config/network. Example configuration for a single ENET interface: * looking at /etc/config/network {{{ root@OpenWrt:/# cat /etc/config/network config interface 'loopback' option ifname 'lo' option proto 'static' option ipaddr '127.0.0.1' option netmask '255.0.0.0' config interface 'lan' option ifname 'eth0' option type 'bridge' option proto 'static' option ipaddr '192.168.1.1' option netmask '255.255.255.0' option ip6assign '60' config interface 'wan6' option ifname '@wan' option proto 'dhcpv6' config globals 'globals' option ula_prefix 'fda7:b97b:37b2::/48' }}} * using UCI: {{{ root@OpenWrt:/# uci show network network.loopback=interface network.loopback.ifname=lo network.loopback.proto=static network.loopback.ipaddr=127.0.0.1 network.loopback.netmask=255.0.0.0 network.lan=interface network.lan.ifname=eth0 network.lan.type=bridge network.lan.proto=static network.lan.ipaddr=192.168.1.1 network.lan.netmask=255.255.255.0 network.lan.ip6assign=60 network.wan6=interface network.wan6.ifname=@wan network.wan6.proto=dhcpv6 network.globals=globals network.globals.ula_prefix=fda7:b97b:37b2::/48 }}} To change the IP address of the '''lan''' network which is configured as a bridge containing the '''eth0''' interface using UCI: {{{ uci set network.lan.ipaddr=192.168.1.2 uci commit }}} You can restart the networking by typing the following command: {{{ /etc/init.d/network restart }}} [=#stp] == Spanning Tree Protocol - STP == The Spanning Tree Protocol (STP) is a network protocol that builds a logical loop-free topology for Ethernet networks. The basic function of STP is to prevent bridge loops and the broadcast radiation that results from them. By default bridges are configured without STP thus if you connected multiple ports in a bridge to a LAN you would create a bridge loop. You can enable STP to avoid bridge loops if you do want to connect multiple ports in a bridge to a LAN for redundancy purposes. To do so, edit {{{/etc/config/network}}} and add an {{{option stp 1}}} to the interface. For example: {{{ config interface 'lan' option ifname 'eth0' option force_link '1' option type 'bridge' option proto 'static' option ipaddr '192.168.1.1' option netmask '255.255.255.0' option ip6assign '60' option stp 1 }}} Verify with the brctl show command: {{{ root@OpenWrt:/# brctl show bridge name bridge id STP enabled interfaces br-lan 7fff.00d0127af035 yes eth0 }}}