Gateway mit Openwrt: Unterschied zwischen den Versionen

Aus Freifunk Franken
Wechseln zu:Navigation, Suche
(Die Seite wurde neu angelegt: „ = Gateway mit OpenWrt einrichten = Eine Anleitung, ein dezentrales/lokales Gateway mit OpenWrt einzurichten. Hier am Beispiel eines TP-Link c2600. Der Rout…“)
 
Keine Bearbeitungszusammenfassung
Zeile 20: Zeile 20:
=== Firewall ===
=== Firewall ===


Wir tauschen als erstes die Firewall aus. Dazu holen wir uns die Config
Erst mal ausschalten. Kann Probleme beim Testen und Konfigurieren machen.
 
/etc/init.d/firewall stop
/etc/init.d/firewall disable
 


=== Routingtabelle deklarieren ===
=== Routingtabelle deklarieren ===
Zeile 27: Zeile 31:


  10    fff
  10    fff
== Konfiguration ==
* Ip Adressen Reservieren. Siehe Gatewayanleutung [[Freifunk-Gateway_aufsetzen#Konfigurieren_des_Freifunk-Gateways]]
=== Netzwerkinterfaces ===
Die Konfiguration der Interfaces, Routing und des Switches erfolgt in /etc/config/network und die wifi-interfaces in /etc/config/wireless
Hier ein Beispiel mit Freifunk und Heimnetz auf dem c2600. Freifunk hier nur auf 2,4GHz.
* Die /etc/config/wireless
<pre>
config wifi-device 'radio0'
option type 'mac80211'
option hwmode '11a'
option path 'soc/1b500000.pci/pci0000:00/0000:00:00.0/0000:01:00.0'
option country 'DE'
option legacy_rates '1'
option disabled '0'
option channel '40'
option htmode 'VHT40'
option txpower '16'
config wifi-iface 'w5home'
option device 'radio0'
option mode 'ap'
option encryption 'psk2'
option ifname 'w5home'
option network 'lan'
option ssid 'Homenetz5'
option key 'xxxxxxxxxxxxxxx'
config wifi-device 'radio1'
option type 'mac80211'
option hwmode '11g'
option path 'soc/1b700000.pci/pci0001:00/0001:00:00.0/0001:01:00.0'
option htmode 'HT20'
option country 'DE'
option legacy_rates '1'
option disabled '0'
option channel '13'
option txpower '16'
config wifi-iface 'w2home'
option device 'radio1'
option mode 'ap'
option encryption 'psk2'
option ifname 'w2home'
option network 'lan'
option ssid 'Homenetz2'
option key 'xxxxxxxxxxx'
config wifi-iface 'w2ap'
option device 'radio1'
option ifname 'w2ap'
option mode 'ap'
option ssid 'freifunk.mainberg.net'
option encryption 'none'
option hidden '0'
option network 'mesh'
config wifi-iface 'w2mesh'
option device 'radio1'
option network 'w2mesh'
option ifname 'w2mesh'
option mode 'mesh'
option mesh_id 'mesh.mainberg.freifunk.net'
option encryption 'none'
option mesh_fwding '0'
config wifi-iface 'w2configap'
option device 'radio1'
option network 'configap2'
option ifname 'w2configap'
option mode 'ap'
option ssid 'config.franken.freifunk.net'
option encryption 'none'
option hidden '1'
</pre>
* Die /etc/config/network . Hier die Grundkonfiguration
<pre>
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fdff:0::/64'
config interface 'lan'
option type 'bridge'
option proto 'static'
option ipaddr '192.168.100.66'
option netmask '255.255.255.0'
option ip6assign '64'
option gateway '192.168.100.1'
option dns '192.168.100.1 9.9.9.9'
option ifname 'eth1.1'
config interface 'mesh'
option type 'bridge'
option macaddr 'ec:08:6b:27:02:cb'
option proto 'static'
option ipaddr '10.83.85.1'
option netmask '255.255.255.192'
option broadcast '10.83.85.255'
list ip6addr 'fd43:5602:29bd:27::1/64'
list ip6addr 'fe80::1/64'
option ifname 'bat0 eth0.1'
config interface 'ethmesh'
option mtu '1528'
option proto 'batadv'
option mesh 'bat0'
option ifname 'eth0.3'
option macaddr 'ec:08:6b:27:02:cd'
config interface 'w2mesh'
option mtu '1528'
option proto 'batadv'
option mesh 'bat0'
config interface 'wan6'
option proto 'dhcpv6'
option ifname 'eth1.1'
option reqaddress 'try'
option reqprefix 'auto'
config interface 'configap2'
option proto 'static'
option ip6addr 'fe80::1/64'
</pre>
* Die Switchkonfiguration (Hier hängen alle Ports an vlan1, da ich den "nur" als Switch im Heimnetz nutze)
<pre>
config switch
option name 'switch0'
option reset '1'
option enable_vlan '1'
config switch_vlan
option device 'switch0'
option vlan '1'
option vid '1'
option ports '1 2 3 4 5 6t'
config switch_vlan
option device 'switch0'
option vlan '2'
option ports '0t'
option vid '2'
config switch_vlan 'eth0_3'
option device 'switch0'
option vlan '3'
option vid '3'
option ports '0t'
</pre>
=== Batman-adv ===
* Kernelmodul und batctl installieren
opkg install kmod-batman-adv
opkg install batctl
* Batman konfigurieren in /etc/config/batman
<pre>
config mesh 'bat0'
option gw_mode 'server'
option bridge_loop_avoidance '0'
option network_coding '0'
option aggregated_ogms '1'
option ap_isolation '0'
option bonding '0'
option fragmentation '1'
option orig_interval '1000'
option distributed_arp_table '1'
option hop_penalty '30'
</pre>
* Batman devices hängt in der Bridge mesh, die oben schon konfiguriert ist.

Version vom 5. September 2018, 01:54 Uhr

Gateway mit OpenWrt einrichten

Eine Anleitung, ein dezentrales/lokales Gateway mit OpenWrt einzurichten.

Hier am Beispiel eines TP-Link c2600.

Der Router wird Gateway für eine Dezentrale Hood.

Wir können viel aus der Anleitung Freifunk-Gateway aufsetzen ableiten.

Grundinstallation

  • Als erstes ein aktuelles OpenWrt flashen.
  • Am Webinterface anmelden und ein Rootpasswort vergeben. Ev. ssh an allen Devices erlauben, macht es leichter drauf zu kommen, während wir konfigurieren. Man kann auch gleich seinen ssh-key hinterlegen.
  • Hostname festlegen, Zeitzone

Jetzt sollte man sich via ssh am Router einloggen können.

Firewall

Erst mal ausschalten. Kann Probleme beim Testen und Konfigurieren machen.

/etc/init.d/firewall stop
/etc/init.d/firewall disable


Routingtabelle deklarieren

Tabellennummer und Name in /etc/iproute2/rt_tables eintragen:

10     fff

Konfiguration


Netzwerkinterfaces

Die Konfiguration der Interfaces, Routing und des Switches erfolgt in /etc/config/network und die wifi-interfaces in /etc/config/wireless

Hier ein Beispiel mit Freifunk und Heimnetz auf dem c2600. Freifunk hier nur auf 2,4GHz.

  • Die /etc/config/wireless
config wifi-device 'radio0'
	option type 'mac80211'
	option hwmode '11a'
	option path 'soc/1b500000.pci/pci0000:00/0000:00:00.0/0000:01:00.0'
	option country 'DE'
	option legacy_rates '1'
	option disabled '0'
	option channel '40'
	option htmode 'VHT40'
	option txpower '16'

config wifi-iface 'w5home'
	option device 'radio0'
	option mode 'ap'
	option encryption 'psk2'
	option ifname 'w5home'
	option network 'lan'
	option ssid 'Homenetz5'
	option key 'xxxxxxxxxxxxxxx'

config wifi-device 'radio1'
	option type 'mac80211'
	option hwmode '11g'
	option path 'soc/1b700000.pci/pci0001:00/0001:00:00.0/0001:01:00.0'
	option htmode 'HT20'
	option country 'DE'
	option legacy_rates '1'
	option disabled '0'
	option channel '13'
	option txpower '16'

config wifi-iface 'w2home'
	option device 'radio1'
	option mode 'ap'
	option encryption 'psk2'
	option ifname 'w2home'
	option network 'lan'
	option ssid 'Homenetz2'
	option key 'xxxxxxxxxxx'

config wifi-iface 'w2ap'
	option device 'radio1'
	option ifname 'w2ap'
	option mode 'ap'
	option ssid 'freifunk.mainberg.net'
	option encryption 'none'
	option hidden '0'
	option network 'mesh'

config wifi-iface 'w2mesh'
	option device 'radio1'
	option network 'w2mesh'
	option ifname 'w2mesh'
	option mode 'mesh'
	option mesh_id 'mesh.mainberg.freifunk.net'
	option encryption 'none'
	option mesh_fwding '0'

config wifi-iface 'w2configap'
	option device 'radio1'
	option network 'configap2'
	option ifname 'w2configap'
	option mode 'ap'
	option ssid 'config.franken.freifunk.net'
	option encryption 'none'
	option hidden '1'
  • Die /etc/config/network . Hier die Grundkonfiguration
config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fdff:0::/64'

config interface 'lan'
	option type 'bridge'
	option proto 'static'
	option ipaddr '192.168.100.66'
	option netmask '255.255.255.0'
	option ip6assign '64'
	option gateway '192.168.100.1'
	option dns '192.168.100.1 9.9.9.9'
	option ifname 'eth1.1'

config interface 'mesh'
	option type 'bridge'
	option macaddr 'ec:08:6b:27:02:cb'
	option proto 'static'
	option ipaddr '10.83.85.1'
	option netmask '255.255.255.192'
	option broadcast '10.83.85.255'
	list ip6addr 'fd43:5602:29bd:27::1/64'
	list ip6addr 'fe80::1/64'
	option ifname 'bat0 eth0.1'

config interface 'ethmesh'
	option mtu '1528'
	option proto 'batadv'
	option mesh 'bat0'
	option ifname 'eth0.3'
	option macaddr 'ec:08:6b:27:02:cd'

config interface 'w2mesh'
	option mtu '1528'
	option proto 'batadv'
	option mesh 'bat0'

config interface 'wan6'
	option proto 'dhcpv6'
	option ifname 'eth1.1'
	option reqaddress 'try'
	option reqprefix 'auto'

config interface 'configap2'
	option proto 'static'
	option ip6addr 'fe80::1/64'

  • Die Switchkonfiguration (Hier hängen alle Ports an vlan1, da ich den "nur" als Switch im Heimnetz nutze)
config switch
	option name 'switch0'
	option reset '1'
	option enable_vlan '1'

config switch_vlan
	option device 'switch0'
	option vlan '1'
	option vid '1'
	option ports '1 2 3 4 5 6t'

config switch_vlan
	option device 'switch0'
	option vlan '2'
	option ports '0t'
	option vid '2'

config switch_vlan 'eth0_3'
	option device 'switch0'
	option vlan '3'
	option vid '3'
	option ports '0t'


Batman-adv

  • Kernelmodul und batctl installieren
opkg install kmod-batman-adv
opkg install batctl
  • Batman konfigurieren in /etc/config/batman
config mesh 'bat0'
	option gw_mode 'server'
	option bridge_loop_avoidance '0'
	option network_coding '0'
	option aggregated_ogms '1'
	option ap_isolation '0'
	option bonding '0'
	option fragmentation '1'
	option orig_interval '1000'
	option distributed_arp_table '1'
	option hop_penalty '30'
  • Batman devices hängt in der Bridge mesh, die oben schon konfiguriert ist.