network.tex 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. \begin{Verbatim}
  7. config interface "lan"
  8. option ifname "eth0"
  9. option proto "static"
  10. option ipaddr "192.168.1.1"
  11. option netmask "255.255.255.0"
  12. option gateway "192.168.1.254"
  13. option dns "192.168.1.254"
  14. \end{Verbatim}
  15. \texttt{ifname} specifies the Linux interface name.
  16. If you want to use bridging on one or more interfaces, set \texttt{ifname} to a list
  17. of interfaces and add:
  18. \begin{Verbatim}
  19. option type "bridge"
  20. \end{Verbatim}
  21. It is possible to use VLAN tagging on an interface simply by adding the VLAN IDs
  22. to it, e.g. \texttt{eth0.1}. These can be nested as well.
  23. This sets up a simple static configuration for \texttt{eth0}. \texttt{proto} specifies the
  24. protocol used for the interface. The default image usually provides \texttt{'none'}
  25. \texttt{'static'}, \texttt{'dhcp'} and \texttt{'pppoe'}. Others can be added by installing additional
  26. packages.
  27. When using the \texttt{'static'} method like in the example, the options \texttt{ipaddr} and
  28. \texttt{netmask} are mandatory, while \texttt{gateway} and \texttt{dns} are optional.
  29. DHCP currently only accepts \texttt{ipaddr} (IP address to request from the server)
  30. and \texttt{hostname} (client hostname identify as) - both are optional.
  31. PPP based protocols (\texttt{pppoe}, \texttt{pptp}, ...) accept these options:
  32. \begin{itemize}
  33. \item{username} \\
  34. The PPP username (usually with PAP authentication)
  35. \item{password} \\
  36. The PPP password
  37. \item{keepalive} \\
  38. Ping the PPP server (using LCP). The value of this option
  39. specifies the maximum number of failed pings before reconnecting.
  40. The ping interval defaults to 5, but can be changed by appending
  41. ",<interval>" to the keepalive value
  42. \item{demand} \\
  43. Use Dial on Demand (value specifies the maximum idle time.
  44. \item{server: (pptp)} \\
  45. The remote pptp server IP
  46. \end{itemize}
  47. For all protocol types, you can also specify the MTU by using the \texttt{mtu} option.
  48. \subsubsection{Setting up static routes}
  49. You can set up static routes for a specific interface that will be brought up
  50. after the interface is configured.
  51. Simply add a config section like this:
  52. \begin{Verbatim}
  53. config route foo
  54. option interface lan
  55. option target 1.1.1.0
  56. option netmask 255.255.255.0
  57. option gateway 192.168.1.1
  58. \end{Verbatim}
  59. The name for the route section is optional, the \texttt{interface}, \texttt{target} and
  60. \texttt{gateway} options are mandatory.
  61. Leaving out the \texttt{netmask} option will turn the route into a host route.
  62. \subsubsection{Setting up the switch (currently broadcom only)}
  63. The switch configuration is set by adding a \texttt{'switch'} config section.
  64. Example:
  65. \begin{Verbatim}
  66. config switch "eth0"
  67. option vlan0 "1 2 3 4 5*"
  68. option vlan1 "0 5"
  69. \end{Verbatim}
  70. On Broadcom hardware the section name needs to be eth0, as the switch driver
  71. does not detect the switch on any other physical device.
  72. Every vlan option needs to have the name vlan<n> where <n> is the VLAN number
  73. as used in the switch driver.
  74. As value it takes a list of ports with these optional suffixes:
  75. \begin{itemize}
  76. \item{\texttt{'*'}:}
  77. Set the default VLAN (PVID) of the Port to the current VLAN
  78. \item{\texttt{'u'}:}
  79. Force the port to be untagged
  80. \item{\texttt{'t'}:}
  81. Force the port to be tagged
  82. \end{itemize}
  83. The CPU port defaults to tagged, all other ports to untagged.
  84. On Broadcom hardware the CPU port is always 5. The other ports may vary with
  85. different hardware.