The network configuration in Kamikaze is stored in /etc/config/network and is divided into interface configurations. Each interface configuration either refers directly to an ethernet/wifi interface (eth0, wl0, ..) or to a bridge containing multiple interfaces. It looks like this:
config interface "lan"
option ifname "eth0"
option proto "static"
option ipaddr "192.168.1.1"
option netmask "255.255.255.0"
option gateway "192.168.1.254"
option dns "192.168.1.254"
ifname specifies the Linux interface name. If you want to use bridging on one or more interfaces, set ifname to a list of interfaces and add:
option type "bridge"
It is possible to use VLAN tagging on an interface simply by adding the VLAN IDs to it, e.g. eth0.1. These can be nested as well.
This sets up a simple static configuration for eth0. proto specifies the protocol used for the interface. The default image usually provides ’none’ ’static’, ’dhcp’ and ’pppoe’. Others can be added by installing additional packages.
When using the ’static’ method like in the example, the options ipaddr and netmask are mandatory, while gateway and dns are optional. You can specify more than one DNS server, separated with spaces.
DHCP currently only accepts ipaddr (IP address to request from the server) and hostname (client hostname identify as) - both are optional.
PPP based protocols (pppoe, pptp, ...) accept these options:
* username
The PPP username (usually with PAP authentication)
* password
The PPP password
* keepalive
Ping the PPP server (using LCP). The value of this option specifies the maximum number of failed pings before reconnecting. The ping interval defaults to 5, but can be changed by appending "," to the keepalive value
* demand
Use Dial on Demand (value specifies the maximum idle time.
* server: (pptp)
The remote pptp server IP
For all protocol types, you can also specify the MTU by using the mtu option.
Setting up static routes
You can set up static routes for a specific interface that will be brought up after the interface is configured.
Simply add a config section like this:
config route foo
option interface lan
option target 1.1.1.0
option netmask 255.255.255.0
option gateway 192.168.1.1
The name for the route section is optional, the interface, target and gateway options are mandatory. Leaving out the netmask option will turn the route into a host route.
Setting up the switch (currently broadcom only)
The switch configuration is set by adding a ’switch’ config section. Example:
config switch "eth0"
option vlan0 "1 2 3 4 5*"
option vlan1 "0 5"
On Broadcom hardware the section name needs to be eth0, as the switch driver does not detect the switch on any other physical device. Every vlan option needs to have the name vlan where is the VLAN number as used in the switch driver. As value it takes a list of ports with these optional suffixes:
* ’*’: Set the default VLAN (PVID) of the Port to the current VLAN
* ’u’: Force the port to be untagged
* ’t’: Force the port to be tagged
The CPU port defaults to tagged, all other ports to untagged. On Broadcom hardware the CPU port is always 5. The other ports may vary with different hardware.
For instance, if you wish to have 3 vlans, like one 3-port switch, 1 port in a DMZ, and another one as your WAN interface, use the following configuration :
config switch "eth0"
option vlan0 "1 2 3 5*"
option vlan1 "0 5"
option vlan2 "4 5"
Three interfaces will be automatically created using this switch layout : eth0.0 (vlan0), eth0.1 (vlan1) and eth0.2 (vlan2). You can then assign those interfaces to a custom network configuration name like lan, wan or dmz for instance.
Setting up IPv6 connectivity
OpenWrt supports IPv6 connectivity using PPP, Tunnel brokers or static assignment.
If you use PPP, IPv6 will be setup using IP6CP and there is nothing to configure.
To setup an IPv6 tunnel to a tunnel broker, you can install the 6scripts package and edit the /etc/config/6tunnel file and change the settings accordingly :
config 6tunnel
option tnlifname ’sixbone’
option remoteip4 ’1.0.0.1’
option localip4 ’1.0.0.2’
option localip6 ’2001::DEAD::BEEF::1’
option prefix ’/64’
* ’tnlifname’: Set the interface name of the IPv6 in IPv4 tunnel
* ’remoteip4’: IP address of the remote end to establish the 6in4 tunnel. This address is given by the tunnel broker
* ’localip4’: IP address of your router to establish the 6in4 tunnel. It will usually match your WAN IP address.
* ’localip6’: IPv6 address to setup on your tunnel side This address is given by the tunnel broker
* ’prefix’: IPv6 prefix to setup on the LAN.
Using the same package you can also setup an IPv6 bridged connection :
config 6bridge
option bridge ’br6’
By default the script bridges the WAN interface with the LAN interface and uses ebtables to filter anything that is not IPv6 on the bridge.
IPv6 static addressing is also supported using a similar setup as IPv4 but with the ip6 prefixing (when applicable).