source: trunk/debian/packages/debwrt-net/tags/0.8~debwrtSTRETCH+1/etc/network/interfaces.ar71xx @ 893

Last change on this file since 893 was 893, checked in by amain, 21 months ago

debwrt-net: tag 0.8~debwrtSTRETCH+1

File size: 4.9 KB
Line 
1# DebWrt ar71xx interfaces file
2#
3# Tweaking may be required to match your hardware. This file is
4# provided as an example. Use ifup/down -va (--no-scripts) to
5# debug.
6#
7# * ifup   runs the commands/sections top-down
8# * ifdown runs the commands/sections bottom-up
9#
10# Johan van Zoomeren <amain@debwrt.net>, November 2016
11
12auto lo
13iface lo inet loopback
14
15# Rename interfaces to wan/lan/wifi and create
16# the required vlans.
17auto pre
18iface pre inet manual
19    pre-up    /etc/firewall/firewall.sh start
20    pre-up    /sbin/ip link set dev eth0 down
21    pre-up    /sbin/ip link set dev wlan0 down
22    pre-up    /sbin/ip link add link eth0 name wan type vlan id 1
23    pre-up    /sbin/ip link add link eth0 name lan type vlan id 2
24    pre-up    /sbin/ip link set wlan0 name wifi
25    post-down /sbin/ip link set wifi  name wlan0
26    post-down /sbin/ip link del dev wan
27    post-down /sbin/ip link del dev lan
28    post-down /etc/firewall/firewall.sh stop
29
30# Switch configuration
31#
32# Use swconfig list to see available switches. Use swconfig dev <switch-name> show
33# to show actual switch configuration. Use swconfig dev <switch-name> help to show
34# available features. More information:
35# https://wiki.openwrt.org/doc/techref/swconfig
36#
37# This example assumes:
38#
39# CPU   5      - swconfig dev switch0 help | grep "cpu @"
40# -------
41# LAN   4      - vlan 1
42# LAN   3      - vlan 1
43# LAN   2      - vlan 1
44# LAN   1      - vlan 1
45# WAN   0      - vlan 2
46#
47# The 't' in vlan ports make sure that a vlan tag is set and
48# visibile on the virtual network device in linux. Each switch
49# device (like switch0) has a virtual network interface counter-
50# part in Linux (eth0 for example).
51auto pre-switch
52iface pre-switch inet manual
53    pre-up    /usr/sbin/swconfig dev switch0 set reset
54    pre-up    /usr/sbin/swconfig dev switch0 set enable_vlan 1
55    pre-up    /usr/sbin/swconfig dev switch0 vlan 1 set ports "0 5t"
56    pre-up    /usr/sbin/swconfig dev switch0 vlan 2 set ports "1 2 3 4 5t"
57    pre-up    /usr/sbin/swconfig dev switch0 set apply
58    pre-up    /sbin/ip link set dev eth0 up
59    post-down /sbin/ip link set dev eth0 down
60    post-down /usr/sbin/swconfig dev switch0 set reset
61    post-down /usr/sbin/swconfig dev switch0 set enable_vlan 1
62    post-down /usr/sbin/swconfig dev switch0 vlan 1 set ports "0 1 2 3 4 5t"
63    post-down /usr/sbin/swconfig dev switch0 set apply
64
65auto lan
66iface lan inet manual
67    pre-up    /sbin/ifconfig lan up
68    post-down /sbin/ifconfig lan down
69
70# Starting DHCP daemon manually to prevent long delays
71# during boot in case an unplugged networkd cable or non
72# responsive DHCP server.
73auto wan
74iface wan inet manual
75    pre-up    /sbin/ifconfig wan up
76    pre-up    start-stop-daemon --start  \
77                                --oknodo \
78                                --quiet  \
79                                --pidfile /var/run/dhclient.wan.pid \
80                                --exec /sbin/dhclient \
81                                  -- -v -pf /var/run/dhclient.wan.pid -lf /var/lib/dhcp/dhclient.wan.leases -nw wan
82    post-down /sbin/ifconfig wan down
83    post-down start-stop-daemon --stop \
84                                --signal HUP \
85                                --pidfile /var/run/dhclient.wan.pid \
86                                --exec /sbin/dhclient
87
88
89# Try to add wifi interface to bridge manually, though at boot
90# the interface won't be available yet. This is mainly useful
91# when bringing down/up the bridge without down/up on wifi.
92auto br-lan
93iface br-lan inet static
94    bridge-ports   lan
95    bridge-stp     off
96    bridge-maxwait 0
97    address        192.168.1.1
98    netmask        255.255.255.0
99    post-up   brctl addif br-lan wifi &>/dev/null | true
100    post-up   start-stop-daemon --start  \
101                                --oknodo \
102                                --quiet  \
103                                --pidfile /var/run/dnsmasq.br-lan.pid \
104                                --exec /usr/sbin/dnsmasq \
105                                  -- --pid-file=/var/run/dnsmasq.br-lan.pid \
106                                     --conf-file=/etc/dnsmasq-debwrt.conf
107    pre-down  start-stop-daemon --stop \
108                                --pidfile /var/run/dnsmasq.br-lan.pid \
109                                --exec /usr/sbin/dnsmasq
110
111# Hostapd will add wifi interface to bridge. Hence this section
112# appears after the br-lan section. To experiment with more
113# channels and more power, uncomment below. Please note that
114# regulations are there for a reason; setting different region
115# and/or increasing power might now be allowed.
116auto wifi
117iface wifi inet manual
118    hostapd   /etc/hostapd/hostapd-wpa.conf
119    #pre-up    /sbin/ip link set dev wifi address 02:ec:38:dd:9a:00
120    pre-up    /sbin/ip link set dev wifi up
121    #pre-up /usr/sbin/iw reg set BO           # set channel and power options
122    #pre-up /sbin/iwconfig wifi txpower 23dbm # 20 = 100mw, 21 = 125mw, 22 = 185, 23 = 200 (max 27)
123    post-down /sbin/ip link set dev wifi down
124
Note: See TracBrowser for help on using the repository browser.