Router (Raspbian): Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
| Zeile 41: | Zeile 41: | ||
auto eth0 | auto eth0 | ||
iface eth0 inet static | iface eth0 inet static | ||
address 10.1.0.1 | address 10.1.0.1 | ||
netmask 255.255.255.0 | netmask 255.255.255.0 | ||
auto wlan0 | |||
allow-hotplug wlan0 | |||
iface wlan0 inet static | iface wlan0 inet static | ||
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf | wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf | ||
| Zeile 62: | Zeile 63: | ||
up sysctl -w net.ipv4.ip_forward=1 | up sysctl -w net.ipv4.ip_forward=1 | ||
up sysctl -w net.ipv6.conf.all.forwarding=1 | up sysctl -w net.ipv6.conf.all.forwarding=1 | ||
</pre> | </pre> | ||
Version vom 5. Mai 2016, 11:38 Uhr
Noch in Bearbeitung
Netzwerkkarten einrichten siehe Netzwerk Wireless (Raspbian) bzw. Netzwerk mit Kabel (Raspbian).
DHCP-Server
Als Server wird dnsmasq verwendet:
sudo apt-get install dnsmasq
sudo nano /etc/dnsmasq.conf
# DHCP-Server aktiv für Kabel-Interface interface=eth0 # DHCP-Server nicht aktiv für Wireless-Interface no-dhcp-interface=wlan0 # IPv4-Adressbereich und Lease-Time dhcp-range=10.1.0.2,10.1.0.254,24h # DNS dhcp-option=option:dns-server,10.1.0.1
Router Konfiguration
sudo nano /etc/network/interfaces
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 10.1.0.1
netmask 255.255.255.0
auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
address 10.0.0.98
netmask 255.255.255.0
gateway 10.0.0.138
dns-nameservers 10.0.0.138
# NAT und Masquerading aktivieren
up /sbin/iptables -A FORWARD -o wlan0 -i eth0 -m conntrack --ctstate NEW -j ACCEPT
up /sbin/iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
up /sbin/iptables -t nat -F POSTROUTING
up /sbin/iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
# IP-Forwarding aktivieren
up sysctl -w net.ipv4.ip_forward=1
up sysctl -w net.ipv6.conf.all.forwarding=1
DHCP-Client-Dämon deaktivieren
sudo service dhcpcd stop sudo systemctl disable dhcpcd
Links
https://www.elektronik-kompendium.de/sites/raspberry-pi/2002171.htm
https://wiki.ubuntuusers.de/Router/
https://wiki.ubuntuusers.de/iptables2/
http://manpages.ubuntu.com/manpages/wily/man8/iptables.8.html
Zurück zu Raspbian