1The network configuration is stored in \texttt{/etc/config/network} 2and is divided into interface configurations. 3Each interface configuration either refers directly to an ethernet/wifi 4interface (\texttt{eth0}, \texttt{wl0}, ..) or to a bridge containing multiple interfaces. 5It looks like this: 6 7\begin{Verbatim} 8config interface "lan" 9 option ifname "eth0" 10 option proto "static" 11 option ipaddr "192.168.1.1" 12 option netmask "255.255.255.0" 13 option gateway "192.168.1.254" 14 option dns "192.168.1.254" 15\end{Verbatim} 16 17\texttt{ifname} specifies the Linux interface name. 18If you want to use bridging on one or more interfaces, set \texttt{ifname} to a list 19of interfaces and add: 20\begin{Verbatim} 21 option type "bridge" 22\end{Verbatim} 23 24It is possible to use VLAN tagging on an interface simply by adding the VLAN IDs 25to it, e.g. \texttt{eth0.1}. These can be nested as well. See the switch section for 26this. 27 28\begin{Verbatim} 29config inter 30\end{Verbatim} 31 32This sets up a simple static configuration for \texttt{eth0}. \texttt{proto} specifies the 33protocol used for the interface. The default image usually provides \texttt{'none'} 34\texttt{'static'}, \texttt{'dhcp'} and \texttt{'pppoe'}. Others can be added by installing additional 35packages. 36 37When using the \texttt{'static'} method like in the example, the options \texttt{ipaddr} and 38\texttt{netmask} are mandatory, while \texttt{gateway} and \texttt{dns} are optional. 39You can specify more than one DNS server, separated with spaces: 40 41\begin{Verbatim} 42config interface "lan" 43 option ifname "eth0" 44 option proto "static" 45 ... 46 option dns "192.168.1.254 192.168.1.253" (optional) 47\end{Verbatim} 48 49DHCP currently only accepts \texttt{ipaddr} (IP address to request from the server) 50and \texttt{hostname} (client hostname identify as) - both are optional. 51 52\begin{Verbatim} 53config interface "lan" 54 option ifname "eth0" 55 option proto "dhcp" 56 option ipaddr "192.168.1.1" (optional) 57 option hostname "openwrt" (optional) 58\end{Verbatim} 59 60PPP based protocols (\texttt{pppoe}, \texttt{pptp}, ...) accept these options: 61\begin{itemize} 62 \item{username} \\ 63 The PPP username (usually with PAP authentication) 64 \item{password} \\ 65 The PPP password 66 \item{keepalive} \\ 67 Ping the PPP server (using LCP). The value of this option 68 specifies the maximum number of failed pings before reconnecting. 69 The ping interval defaults to 5, but can be changed by appending 70 ",<interval>" to the keepalive value 71 \item{demand} \\ 72 Use Dial on Demand (value specifies the maximum idle time. 73 74 \item{server: (pptp)} \\ 75 The remote pptp server IP 76\end{itemize} 77 78For all protocol types, you can also specify the MTU by using the \texttt{mtu} option. 79A sample PPPoE config would look like this: 80 81\begin{Verbatim} 82config interface "lan" 83 option ifname "eth0" 84 option proto "pppoe" 85 option username "username" 86 option password "openwrt" 87 option mtu 1492 (optional) 88\end{Verbatim} 89 90\subsubsection{Setting up static routes} 91 92You can set up static routes for a specific interface that will be brought up 93after the interface is configured. 94 95Simply add a config section like this: 96 97\begin{Verbatim} 98config route foo 99 option interface lan 100 option target 1.1.1.0 101 option netmask 255.255.255.0 102 option gateway 192.168.1.1 103\end{Verbatim} 104 105The name for the route section is optional, the \texttt{interface}, \texttt{target} and 106\texttt{gateway} options are mandatory. 107Leaving out the \texttt{netmask} option will turn the route into a host route. 108 109\subsubsection{Setting up the switch (currently broadcom only)} 110 111The switch configuration is set by adding a \texttt{'switch'} config section. 112Example: 113 114\begin{Verbatim} 115config switch "eth0" 116 option vlan0 "1 2 3 4 5*" 117 option vlan1 "0 5" 118\end{Verbatim} 119 120On Broadcom hardware the section name needs to be eth0, as the switch driver 121does not detect the switch on any other physical device. 122Every vlan option needs to have the name vlan<n> where <n> is the VLAN number 123as used in the switch driver. 124As value it takes a list of ports with these optional suffixes: 125 126\begin{itemize} 127 \item{\texttt{'*'}:} 128 Set the default VLAN (PVID) of the Port to the current VLAN 129 \item{\texttt{'u'}:} 130 Force the port to be untagged 131 \item{\texttt{'t'}:} 132 Force the port to be tagged 133\end{itemize} 134 135The CPU port defaults to tagged, all other ports to untagged. 136On Broadcom hardware the CPU port is always 5. The other ports may vary with 137different hardware. 138 139For instance, if you wish to have 3 vlans, like one 3-port switch, 1 port in a 140DMZ, and another one as your WAN interface, use the following configuration : 141 142\begin{Verbatim} 143config switch "eth0" 144 option vlan0 "1 2 3 5*" 145 option vlan1 "0 5" 146 option vlan2 "4 5" 147\end{Verbatim} 148 149Three interfaces will be automatically created using this switch layout : 150\texttt{eth0.0} (vlan0), \texttt{eth0.1} (vlan1) and \texttt{eth0.2} (vlan2). 151You can then assign those interfaces to a custom network configuration name 152like \texttt{lan}, \texttt{wan} or \texttt{dmz} for instance. 153 154\subsubsection{Setting up IPv6 connectivity} 155 156OpenWrt supports IPv6 connectivity using PPP, Tunnel brokers or static 157assignment. 158 159If you use PPP, IPv6 will be setup using IP6CP and there is nothing to 160configure. 161 162To setup an IPv6 tunnel to a tunnel broker, you can install the 163\texttt{6scripts} package and edit the \texttt{/etc/config/6tunnel} 164file and change the settings accordingly : 165 166\begin{Verbatim} 167config 6tunnel 168 option tnlifname 'sixbone' 169 option remoteip4 '1.0.0.1' 170 option localip4 '1.0.0.2' 171 option localip6 '2001::DEAD::BEEF::1' 172\end{Verbatim} 173 174\begin{itemize} 175 \item{\texttt{'tnlifname'}:} 176 Set the interface name of the IPv6 in IPv4 tunnel 177 \item{\texttt{'remoteip4'}:} 178 IP address of the remote end to establish the 6in4 tunnel. 179 This address is given by the tunnel broker 180 \item{\texttt{'localip4'}:} 181 IP address of your router to establish the 6in4 tunnel. 182 It will usually match your WAN IP address. 183 \item{\texttt{'localip6'}:} 184 IPv6 address to setup on your tunnel side 185 This address is given by the tunnel broker 186\end{itemize} 187 188Using the same package you can also setup an IPv6 bridged connection : 189 190\begin{Verbatim} 191config 6bridge 192 option bridge 'br6' 193\end{Verbatim} 194 195By default the script bridges the WAN interface with the LAN interface 196and uses ebtables to filter anything that is not IPv6 on the bridge. 197This configuration is particularly useful if your router is not 198IPv6 ND proxy capable (see: http://www.rfc-archive.org/getrfc.php?rfc=4389). 199 200 201IPv6 static addressing is also supported using a similar setup as 202IPv4 but with the \texttt{ip6} prefixing (when applicable). 203 204\begin{Verbatim} 205config interface "lan" 206 option ifname "eth0" 207 option proto "static" 208 option ip6addr "fe80::200:ff:fe00:0/64" 209 option ip6gw "2001::DEAF:BEE:1" 210\end{Verbatim} 211