16e5571aed619b4750ec6fcb5bb5f0707ef3da57
[openwrt.git] / docs / network.tex
1 The network configuration in Kamikaze is stored in \texttt{/etc/config/network}
2 and is divided into interface configurations.
3 Each interface configuration either refers directly to an ethernet/wifi
4 interface (\texttt{eth0}, \texttt{wl0}, ..) or to a bridge containing multiple interfaces.
5 It looks like this:
6
7 \begin{Verbatim}
8 config 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.
18 If you want to use bridging on one or more interfaces, set \texttt{ifname} to a list
19 of interfaces and add:
20 \begin{Verbatim}
21 option type "bridge"
22 \end{Verbatim}
23
24 It is possible to use VLAN tagging on an interface simply by adding the VLAN IDs
25 to it, e.g. \texttt{eth0.1}. These can be nested as well.
26
27 This sets up a simple static configuration for \texttt{eth0}. \texttt{proto} specifies the
28 protocol used for the interface. The default image usually provides \texttt{'none'}
29 \texttt{'static'}, \texttt{'dhcp'} and \texttt{'pppoe'}. Others can be added by installing additional
30 packages.
31
32 When using the \texttt{'static'} method like in the example, the options \texttt{ipaddr} and
33 \texttt{netmask} are mandatory, while \texttt{gateway} and \texttt{dns} are optional.
34 DHCP currently only accepts \texttt{ipaddr} (IP address to request from the server)
35 and \texttt{hostname} (client hostname identify as) - both are optional.
36
37 PPP based protocols (\texttt{pppoe}, \texttt{pptp}, ...) accept these options:
38 \begin{itemize}
39 \item{username} \\
40 The PPP username (usually with PAP authentication)
41 \item{password} \\
42 The PPP password
43 \item{keepalive} \\
44 Ping the PPP server (using LCP). The value of this option
45 specifies the maximum number of failed pings before reconnecting.
46 The ping interval defaults to 5, but can be changed by appending
47 ",<interval>" to the keepalive value
48 \item{demand} \\
49 Use Dial on Demand (value specifies the maximum idle time.
50
51 \item{server: (pptp)} \\
52 The remote pptp server IP
53 \end{itemize}
54
55 For all protocol types, you can also specify the MTU by using the \texttt{mtu} option.
56
57 \subsubsection{Setting up static routes}
58
59 You can set up static routes for a specific interface that will be brought up
60 after the interface is configured.
61
62 Simply add a config section like this:
63
64 \begin{Verbatim}
65 config route foo
66 option interface lan
67 option target 1.1.1.0
68 option netmask 255.255.255.0
69 option gateway 192.168.1.1
70 \end{Verbatim}
71
72 The name for the route section is optional, the \texttt{interface}, \texttt{target} and
73 \texttt{gateway} options are mandatory.
74 Leaving out the \texttt{netmask} option will turn the route into a host route.
75
76 \subsubsection{Setting up the switch (currently broadcom only)}
77
78 The switch configuration is set by adding a \texttt{'switch'} config section.
79 Example:
80
81 \begin{Verbatim}
82 config switch "eth0"
83 option vlan0 "1 2 3 4 5*"
84 option vlan1 "0 5"
85 \end{Verbatim}
86
87 On Broadcom hardware the section name needs to be eth0, as the switch driver
88 does not detect the switch on any other physical device.
89 Every vlan option needs to have the name vlan<n> where <n> is the VLAN number
90 as used in the switch driver.
91 As value it takes a list of ports with these optional suffixes:
92
93 \begin{itemize}
94 \item{\texttt{'*'}:}
95 Set the default VLAN (PVID) of the Port to the current VLAN
96 \item{\texttt{'u'}:}
97 Force the port to be untagged
98 \item{\texttt{'t'}:}
99 Force the port to be tagged
100 \end{itemize}
101
102 The CPU port defaults to tagged, all other ports to untagged.
103 On Broadcom hardware the CPU port is always 5. The other ports may vary with
104 different hardware.
105
106 For instance, if you wish to have 3 vlans, like one 3-port switch, 1 port in a
107 DMZ, and another one as your WAN interface, use the following configuration :
108
109 \begin{Verbatim}
110 config switch "eth0"
111 option vlan0 "1 2 3 5*"
112 option vlan1 "0 5"
113 option vlan2 "4 5"
114 \end{Verbatim}
This page took 0.045056 seconds and 3 git commands to generate.