ubuntuusers.de

router mit raspberry pi (b) ?

Status: Ungelöst | Ubuntu-Version: Lubuntu 12.04 (Precise Pangolin)
Antworten |

Farinet

(Themenstarter)

Anmeldungsdatum:
17. Juni 2009

Beiträge: 611

Wäre zu schön gewesen ☹ Es klappt leider immer noch nicht. Hier noch einmal der entsprechende Auszug aus dem Logfile von wicd:

2013/08/03 20:36:10 :: attempting to set hostname with dhclient
2013/08/03 20:36:10 :: using dhcpcd or another supported client may work better
2013/08/03 20:36:11 :: attempting to set hostname with dhclient
2013/08/03 20:36:11 :: using dhcpcd or another supported client may work better
2013/08/03 20:36:11 :: Putting interface down
2013/08/03 20:36:11 :: Releasing DHCP leases...
2013/08/03 20:36:11 :: attempting to set hostname with dhclient
2013/08/03 20:36:11 :: using dhcpcd or another supported client may work better
2013/08/03 20:36:11 :: Setting false IP...
2013/08/03 20:36:12 :: Stopping wpa_supplicant
2013/08/03 20:36:12 :: Flushing the routing table...
2013/08/03 20:36:12 :: Putting interface up...
2013/08/03 20:36:14 :: Generating psk...
2013/08/03 20:36:14 :: Attempting to authenticate...
2013/08/03 20:36:15 :: Running DHCP with hostname mycomputer
2013/08/03 20:36:15 :: attempting to set hostname with dhclient
2013/08/03 20:36:15 :: using dhcpcd or another supported client may work better
2013/08/03 20:36:15 :: Internet Systems Consortium DHCP Client 4.2.4
2013/08/03 20:36:15 :: Copyright 2004-2012 Internet Systems Consortium.
2013/08/03 20:36:15 :: All rights reserved.
2013/08/03 20:36:15 :: For info, please visit https://www.isc.org/software/dhcp/
2013/08/03 20:36:15 :: 
2013/08/03 20:36:15 :: Listening on LPF/wlan1/00:00:00:00:00:00
2013/08/03 20:36:15 :: Sending on   LPF/wlan1/00:00:00:00:00:00
2013/08/03 20:36:15 :: Sending on   Socket/fallback
2013/08/03 20:36:15 :: DHCPDISCOVER on wlan1 to 255.255.255.255 port 67 interval 5
2013/08/03 20:36:20 :: DHCPDISCOVER on wlan1 to 255.255.255.255 port 67 interval 12
2013/08/03 20:36:32 :: DHCPDISCOVER on wlan1 to 255.255.255.255 port 67 interval 8
2013/08/03 20:36:40 :: DHCPDISCOVER on wlan1 to 255.255.255.255 port 67 interval 8
2013/08/03 20:36:48 :: DHCPDISCOVER on wlan1 to 255.255.255.255 port 67 interval 11
2013/08/03 20:36:59 :: DHCPDISCOVER on wlan1 to 255.255.255.255 port 67 interval 11
2013/08/03 20:37:10 :: DHCPDISCOVER on wlan1 to 255.255.255.255 port 67 interval 6
2013/08/03 20:37:16 :: No DHCPOFFERS received.
2013/08/03 20:37:16 :: No working leases in persistent database - sleeping.
2013/08/03 20:37:26 :: DHCP connection failed
2013/08/03 20:37:26 :: exiting connection thread
2013/08/03 20:37:26 :: Sending connection attempt result dhcp_failed
2013/08/03 20:37:26 :: attempting to set hostname with dhclient
2013/08/03 20:37:26 :: using dhcpcd or another supported client may work better
2013/08/03 20:37:27 :: attempting to set hostname with dhclient
2013/08/03 20:37:27 :: using dhcpcd or another supported client may work better

Nun bin ich noch einmal die drei relevanten Dateien durchgegangen und habe dabei dieses setting in /etc/network/interfaces gefunden, was mir nicht kongruent zu den anderen erscheint:

# Maskieren der LAN-Schnittstelle, Port-Forwarding & Nat aktivieren
up iptables -A FORWARD -o eth0 -i wlan0 -s 192.168.0.0/24 -m conntrack --ctstate NEW -j ACCEPT

Müsste es nicht heissen: 192.168.1.10/100 ?

duesentriebchen

Avatar von duesentriebchen

Anmeldungsdatum:
10. Februar 2012

Beiträge: 713

Wohnort: Im Inntal

Poste mal bitte die Ausgaben von

sudo which dnsmasq
sudo which dhclient
sudo lsof -nPi | grep LISTEN
ifconfig -a
route -n
ping -c 3 goolge.com

Ja, die iptables regeln sind etwas, naja, nicht so ganz die besten.

Versuch mal diese...

/etc/network/interfaces

# loopback-Interface nicht löschen
auto lo
iface lo inet loopback

# LAN / automatische Konfiguration über DHCP
auto eth0
iface eth0 inet dhcp

# WLAN mit statischer Konfiguration
auto wlan0
iface wlan0 inet static
address 192.168.1.112
netmask 255.255.255.0
broadcast 192.168.1.255

# Forwarding zulassen
sysctl -w net.ipv4.ip_forward=1

# Kernelmodule laden
modprobe ip_tables
modprobe ip_nat_ftp
modprobe ip_nat_irc
modprobe ip_conntrack
modprobe ipt_limit
modprobe ipt_multiport
modprobe iptable_mangle
modprobe ipt_state
modprobe iptable_filter
modprobe iptable_nat
modprobe ipt_REJECT
modprobe ipt_LOG
modprobe xt_recent
modprobe ipt_mac

# Vorhandene Regeln und Ketten zuerst löschen (Restart-Funktionalität)
/sbin/iptables -F
/sbin/iptables -X
/sbin/iptables -t nat -F

# Default Verhalten festlegen
/sbin/iptables -P INPUT DROP
/sbin/iptables -P OUTPUT ACCEPT
/sbin/iptables -P FORWARD DROP

# ALLOW ESTABLISHED and RELATED incoming connections
/sbin/iptables -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -A INPUT -i wlan0 -m state --state ESTABLISHED,RELATED -j ACCEPT
 
# ALLOW self communication
/sbin/iptables -A INPUT -i lo -j ACCEPT
/sbin/iptables -A OUTPUT -o lo -j ACCEPT

# FORWARDING rules for our WirelessLAN on wlan0 to the WAN
/sbin/iptables -A FORWARD -i eth0 -o wlan0 -d 192.168.1.0/24 -m state --state ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -A FORWARD -i wlan0 -s 192.168.1.0/24 -o eth0 -j ACCEPT

# ALLOW incomming connections on our internal interfaces
iptables -A INPUT -i wlan0 -j ACCEPT

# ALLOW ssh
iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT

# Do MASQUERADING for every OUTPUT package
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

# hostapd und dnsmasq neu starten
/etc/init.d/hostapd restart
/etc/init.d/dnsmasq restart

Müsste es nicht heissen: 192.168.1.10/100 ?

Nö, weil das nicht der CIDR Adressblock ist den du brauchst.

EDIT: Warum hast du wlan1...

2013/08/03 20:36:15 :: 2013/08/03 20:36:15 :: Listening on LPF/wlan1/00:00:00:00:00:00 2013/08/03 20:36:15 :: Sending on LPF/wlan1/00:00:00:00:00:00 2013/08/03 20:36:15 :: Sending on Socket/fallback 2013/08/03 20:36:15 :: DHCPDISCOVER on wlan1 to 255.255.255.255 port 67 interval 5 2013/08/03 20:36:20 :: DHCPDISCOVER on wlan1 to 255.255.255.255 port 67 interval 12 2013/08/03 20:36:32 :: DHCPDISCOVER on wlan1 to 255.255.255.255 port 67 interval 8 2013/08/03 20:36:40 :: DHCPDISCOVER on wlan1 to 255.255.255.255 port 67 interval 8 2013/08/03 20:36:48 :: DHCPDISCOVER on wlan1 to 255.255.255.255 port 67 interval 11 2013/08/03 20:36:59 :: DHCPDISCOVER on wlan1 to 255.255.255.255 port 67 interval 11 2013/08/03 20:37:10 :: DHCPDISCOVER on wlan1 to 255.255.255.255 port 67 interval 6 2013/08/03 20:37:16 :: No DHCPOFFERS received.

Farinet

(Themenstarter)

Anmeldungsdatum:
17. Juni 2009

Beiträge: 611

Die letzte Frage zuerst: Als ich das OS auf den Rechner gespielt habe, musste ich einen Usb-wlanstick (D-Link 140) benutzen, denn die eingebaute Broadcom Karte wurde nicht "out of the box" erkannt. Ich glaube, das wird dann so in den udev regeln eingetragen (und ich wollte das nicht gross ändern; elektronenblitz hat mir mal sehr geholfen, wie man zwischen verschiedenen Sticks und der eingebauten Karte hin- und herwechselt, und ich meine mich zu erinnern, dass ob nun wlan0 oder wlan1 im Kern ziemlich unerheblich ist (??) ).

Achtung: wlan1 bezieht sich auf den einloggenden Rechner. Und, die ganzen Abfragen mache ich per ssh auf dem raspberry (das seinerseits per ethernet am Router hängt).

sudo which dnsmasq

/usr/sbin/dnsmasq

sudo which dhclient

/sbin/dhclient

sudo lsof -nPi | grep LISTEN

dnsmasq  7512 dnsmasq    7u  IPv4   5313      0t0  TCP *:53 (LISTEN)
sshd     7557    root    3u  IPv4   5389      0t0  TCP *:22 (LISTEN)

ifconfig -a

eth0      Link encap:Ethernet  Hardware Adresse b8:27:eb:70:d2:d6  
          inet Adresse:192.168.1.112  Bcast:192.168.1.255  Maske:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1
          RX packets:19190 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4296 errors:0 dropped:0 overruns:0 carrier:0
          Kollisionen:0 Sendewarteschlangenlänge:1000 
          RX bytes:2723841 (2.5 MiB)  TX bytes:624461 (609.8 KiB)

lo        Link encap:Lokale Schleife  
          inet Adresse:127.0.0.1  Maske:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metrik:1
          RX packets:27 errors:0 dropped:0 overruns:0 frame:0
          TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
          Kollisionen:0 Sendewarteschlangenlänge:0 
          RX bytes:5732 (5.5 KiB)  TX bytes:5732 (5.5 KiB)

mon.wlan0 Link encap:UNSPEC  Hardware Adresse A0-F3-C1-29-DB-77-00-00-00-00-00-00-00-00-00-00  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1
          RX packets:1860545 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          Kollisionen:0 Sendewarteschlangenlänge:1000 
          RX bytes:535461919 (510.6 MiB)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  Hardware Adresse a0:f3:c1:29:db:77  
          inet Adresse:192.168.1.112  Bcast:192.168.1.255  Maske:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1
          RX packets:213 errors:0 dropped:89 overruns:0 frame:0
          TX packets:205 errors:0 dropped:0 overruns:0 carrier:0
          Kollisionen:0 Sendewarteschlangenlänge:1000 
          RX bytes:42971 (41.9 KiB)  TX bytes:45669 (44.5 KiB)

route -n

Kernel-IP-Routentabelle
Ziel            Router          Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0

ping -c 3 goolge.com (← ein Buchstabendreher, den ich korrigiert habe)

PING google.com (173.194.113.164) 56(84) bytes of data.
64 bytes from ham02s12-in-f4.1e100.net (173.194.113.164): icmp_req=1 ttl=58 time=27.5 ms
64 bytes from ham02s12-in-f4.1e100.net (173.194.113.164): icmp_req=2 ttl=58 time=27.4 ms
64 bytes from ham02s12-in-f4.1e100.net (173.194.113.164): icmp_req=3 ttl=58 time=27.8 ms

--- google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 27.485/27.625/27.856/0.252 ms

elektronenblitz63

Avatar von elektronenblitz63

Anmeldungsdatum:
16. Januar 2007

Beiträge: 29307

Wohnort: NRW

Hallo,

Müsste es nicht heissen: 192.168.1.10/100 ?

es sollte lauten

up iptables -A FORWARD -o eth0 -i wlan0 -s 192.168.1.0/24 -m conntrack --ctstate NEW -j ACCEPT

So sieht das hier aus.

Auf dem Laptop welcher den AP über Skript erzeugt...

Hardware TP-Link TL-WN821N Stick mit identischem Chipsatz:

lsusb
...
Bus 003 Device 002: ID 0a5c:2110 Broadcom Corp. Bluetooth Controller
Bus 003 Device 003: ID 147e:2016 Upek Biometric Touchchip/Touchstrip Fingerprint Sensor
Bus 002 Device 003: ID 0cf3:7015 Atheros Communications, Inc. TP-Link TL-WN821N v3 802.11n [Atheros AR7010+AR9287]

Konfiguration:

WLAN-Schnittstelle initialisieren ...

deaktiviere Stromsparmechanismen für wlan0 ...

Starte hostapd-Service ...

Configuration file: /etc/hostapd.conf
Using interface wlan0 with hwaddr 02:ab:cd:ef:12:30 and ssid 'WLAN_AP-SSID'
starte IP-Forward, Masquerading und NAT

net.ipv4.ip_forward = 1
starte dnsmasq-base

DHCP-Range dnsmasq-base - Startadresse: 192.168.3.2 Endadresse: 192.168.3.11
nameserver 192.168.178.1
DNS-Konfiguration

nameserver 192.168.178.1

Kernel-IP-Routentabelle
Ziel            Router          Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.178.1   0.0.0.0         UG    0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth0
192.168.3.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0
192.168.178.0   0.0.0.0         255.255.255.0   U     1      0        0 eth0

Konfiguration LAN:

eth0      Link encap:Ethernet  Hardware Adresse 00:1e:37:23:a3:fc  
          inet Adresse:192.168.178.30  Bcast:192.168.178.255  Maske:255.255.255.0

Konfiguration WLAN:
wlan0     Link encap:Ethernet  Hardware Adresse 02:ab:cd:ef:12:30  
          inet Adresse:192.168.3.1  Bcast:192.168.3.255  Maske:255.255.255.0

wlan0     IEEE 802.11bgn  Mode:Master  Frequency:2.412 GHz  Tx-Power=20 dBm   
          Power Management:off

mon.wlan0  IEEE 802.11bgn  Mode:Monitor  Tx-Power=20 dBm   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Power Management:off

dnsmasq lauscht:

ps aux | grep [d]ns
nobody    2582  0.0  0.0  34520  1024 ?        S    10:18   0:00 /usr/sbin/dnsmasq -i wlan0 -I eth0 -F 192.168.3.2,192.168.3.11,infinite

sudo lsof -nPi | grep LISTEN
cupsd      946   root    8u  IPv6   9433      0t0  TCP [::1]:631 (LISTEN)
cupsd      946   root    9u  IPv4   9434      0t0  TCP 127.0.0.1:631 (LISTEN)
dnsmasq   2582 nobody    7u  IPv4  14125      0t0  TCP *:53 (LISTEN)
dnsmasq   2582 nobody    9u  IPv6  14127      0t0  TCP *:53 (LISTEN)

Filter:

sudo iptables -t filter -n -L -v 
Chain INPUT (policy ACCEPT 6330 packets, 7922K bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
   16   992 ACCEPT     all  --  wlan0  eth0    192.168.3.0/24       0.0.0.0/0            ctstate NEW
  552  333K ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
    0     0 ACCEPT     all  --  wlan0  eth0    192.168.3.0/24       0.0.0.0/0            ctstate NEW
    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED

Chain OUTPUT (policy ACCEPT 4307 packets, 418K bytes)
 pkts bytes target     prot opt in     out     source               destination   

Syslog nach erfolgreichem Verbindungsversuch eines anderen Rechners (Zuweisung der IP):

egrep 'dnsmsq|wlan' /var/log/syslog

Aug  4 10:18:49 ThinkPad-R61 avahi-daemon[933]: Joining mDNS multicast group on interface wlan0.IPv4 with address 192.168.3.1.
Aug  4 10:18:49 ThinkPad-R61 avahi-daemon[933]: New relevant interface wlan0.IPv4 for mDNS.
Aug  4 10:18:49 ThinkPad-R61 avahi-daemon[933]: Registering new address record for 192.168.3.1 on wlan0.IPv4.
Aug  4 10:18:50 ThinkPad-R61 avahi-daemon[933]: Joining mDNS multicast group on interface wlan0.IPv6 with address fe80::ab:cdff:feef:1230.
Aug  4 10:18:50 ThinkPad-R61 avahi-daemon[933]: New relevant interface wlan0.IPv6 for mDNS.
Aug  4 10:18:50 ThinkPad-R61 avahi-daemon[933]: Registering new address record for fe80::ab:cdff:feef:1230 on wlan0.*.
Aug  4 10:19:43 ThinkPad-R61 hostapd: wlan0: STA 00:15:af:72:78:ff IEEE 802.11: authenticated
Aug  4 10:19:43 ThinkPad-R61 hostapd: wlan0: STA 00:15:af:72:78:ff IEEE 802.11: associated (aid 1)
Aug  4 10:19:43 ThinkPad-R61 hostapd: wlan0: STA 00:15:af:72:78:ff RADIUS: starting accounting session 51FE0E69-00000000
Aug  4 10:19:43 ThinkPad-R61 hostapd: wlan0: STA 00:15:af:72:78:ff WPA: pairwise key handshake completed (RSN)
Aug  4 10:19:43 ThinkPad-R61 dnsmasq-dhcp[2582]: DHCPDISCOVER(wlan0) 192.168.3.11 00:15:af:72:78:ff 
Aug  4 10:19:43 ThinkPad-R61 dnsmasq-dhcp[2582]: DHCPOFFER(wlan0) 192.168.3.11 00:15:af:72:78:ff 
Aug  4 10:19:43 ThinkPad-R61 dnsmasq-dhcp[2582]: DHCPREQUEST(wlan0) 192.168.3.11 00:15:af:72:78:ff 
Aug  4 10:19:43 ThinkPad-R61 dnsmasq-dhcp[2582]: DHCPACK(wlan0) 192.168.3.11 00:15:af:72:78:ff Quadcore

00:15:af:72:78:ff ist die MAC-Adresse der WLAN-Karte des Clients. Verbindung mit WPA2-Verschlüsselung und die IP-Adresse 192.168.3.11 wurde zugewiesen.

Auf dem Client:

grep wlan /var/log/syslog
...
Aug  4 10:39:04 Quadcore NetworkManager[978]: <info> (wlan0): supplicant interface state: disconnected -> scanning
Aug  4 10:39:06 Quadcore NetworkManager[978]: <info> (wlan0): supplicant interface state: scanning -> authenticating
Aug  4 10:39:06 Quadcore kernel: [ 1565.024914] wlan0: authenticate with 02:ab:cd:ef:12:30 (try 1)
Aug  4 10:39:06 Quadcore kernel: [ 1565.026422] wlan0: authenticated
Aug  4 10:39:06 Quadcore NetworkManager[978]: <info> (wlan0): supplicant interface state: authenticating -> associating
Aug  4 10:39:06 Quadcore kernel: [ 1565.044039] wlan0: associate with 02:ab:cd:ef:12:30 (try 1)
Aug  4 10:39:06 Quadcore kernel: [ 1565.046171] wlan0: RX ReassocResp from 02:ab:cd:ef:12:30 (capab=0x411 status=0 aid=1)
Aug  4 10:39:06 Quadcore kernel: [ 1565.046175] wlan0: associated
Aug  4 10:39:06 Quadcore NetworkManager[978]: <info> (wlan0): supplicant interface state: associating -> completed

ifconfig wlan0

wlan0     Link encap:Ethernet  Hardware Adresse 00:15:af:72:78:ff  
          inet Adresse:192.168.3.11  Bcast:192.168.3.255  Maske:255.255.255.0
          inet6-Adresse: fe80::215:afff:fe72:78ff/64 Gültigkeitsbereich:Verbindung
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1
          RX packets:59 errors:0 dropped:0 overruns:0 frame:0
          TX packets:146 errors:0 dropped:0 overruns:0 carrier:0
          Kollisionen:0 Sendewarteschlangenlänge:1000 
          RX-Bytes:9023 (9.0 KB)  TX-Bytes:22390 (22.3 KB)

duesentriebchen

Avatar von duesentriebchen

Anmeldungsdatum:
10. Februar 2012

Beiträge: 713

Wohnort: Im Inntal

Hallo Farinet, elektronenblitz63.

Halt, stop.
Jetzt wirds etwas unübersichtlich.
Farinet
1.) Bitte diese Scripte auf dem pi verwenden.
/etc/dnsmasq.conf

# Configuration file for dnsmasq.
#
# Format is one option per line, legal options are the same
# as the long options legal on the command line. See
# "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details.

# Listen on this specific port instead of the standard DNS port
# (53). Setting this to zero completely disables DNS function,
# leaving only DHCP and/or TFTP.
#port=5353

# The following two options make you a better netizen, since they
# tell dnsmasq to filter out queries which the public DNS cannot
# answer, and which load the servers (especially the root servers)
# unnecessarily. If you have a dial-on-demand link they also stop
# these requests from bringing up the link unnecessarily.

# Never forward plain names (without a dot or domain part)
#domain-needed
# Never forward addresses in the non-routed address spaces.
#bogus-priv


# Uncomment this to filter useless windows-originated DNS requests
# which can trigger dial-on-demand links needlessly.
# Note that (amongst other things) this blocks all SRV requests,
# so don't use it if you use eg Kerberos, SIP, XMMP or Google-talk.
# This option only affects forwarding, SRV records originating for
# dnsmasq (via srv-host= lines) are not suppressed by it.
#filterwin2k

# Change this line if you want dns to get its upstream servers from
# somewhere other that /etc/resolv.conf
#resolv-file=

# By  default,  dnsmasq  will  send queries to any of the upstream
# servers it knows about and tries to favour servers to are  known
# to  be  up.  Uncommenting this forces dnsmasq to try each query
# with  each  server  strictly  in  the  order  they   appear   in
# /etc/resolv.conf
#strict-order

# If you don't want dnsmasq to read /etc/resolv.conf or any other
# file, getting its servers from this file instead (see below), then
# uncomment this.
#no-resolv

# If you don't want dnsmasq to poll /etc/resolv.conf or other resolv
# files for changes and re-read them then uncomment this.
#no-poll

# Add other name servers here, with domain specs if they are for
# non-public domains.
#server=/localnet/192.168.0.1

# Example of routing PTR queries to nameservers: this will send all
# address->name queries for 192.168.3/24 to nameserver 10.1.2.3
#server=/3.168.192.in-addr.arpa/10.1.2.3

# Add local-only domains here, queries in these domains are answered
# from /etc/hosts or DHCP only.
#local=/localnet/

# Add domains which you want to force to an IP address here.
# The example below send any host in double-click.net to a local
# web-server.
#address=/double-click.net/127.0.0.1

# --address (and --server) work with IPv6 addresses too.
#address=/www.thekelleys.org.uk/fe80::20d:60ff:fe36:f83

# You can control how dnsmasq talks to a server: this forces
# queries to 10.1.2.3 to be routed via eth1
# server=10.1.2.3@eth1

# and this sets the source (ie local) address used to talk to
# 10.1.2.3 to 192.168.1.1 port 55 (there must be a interface with that
# IP on the machine, obviously).
# server=10.1.2.3@192.168.1.1#55

# If you want dnsmasq to change uid and gid to something other
# than the default, edit the following lines.
#user=
#group=

# If you want dnsmasq to listen for DHCP and DNS requests only on
# specified interfaces (and the loopback) give the name of the
# interface (eg eth0) here.
# Repeat the line for more than one interface.
interface=lo
interface=wlan0
# Or you can specify which interface _not_ to listen on
#except-interface=
# Or which to listen on by address (remember to include 127.0.0.1 if
# you use this.)
#listen-address=
# If you want dnsmasq to provide only DNS service on an interface,
# configure it as shown above, and then use the following line to
# disable DHCP and TFTP on it.
no-dhcp-interface=eth0

# On systems which support it, dnsmasq binds the wildcard address,
# even when it is listening on only some interfaces. It then discards
# requests that it shouldn't reply to. This has the advantage of
# working even when interfaces come and go and change address. If you
# want dnsmasq to really bind only the interfaces it is listening on,
# uncomment this option. About the only time you may need this is when
# running another nameserver on the same machine.
#bind-interfaces

# If you don't want dnsmasq to read /etc/hosts, uncomment the
# following line.
#no-hosts
# or if you want it to read another file, as well as /etc/hosts, use
# this.
#addn-hosts=/etc/banner_add_hosts

# Set this (and domain: see below) if you want to have a domain
# automatically added to simple names in a hosts-file.
#expand-hosts

# Set the domain for dnsmasq. this is optional, but if it is set, it
# does the following things.
# 1) Allows DHCP hosts to have fully qualified domain names, as long
#     as the domain part matches this setting.
# 2) Sets the "domain" DHCP option thereby potentially setting the
#    domain of all systems configured by DHCP
# 3) Provides the domain part for "expand-hosts"
#domain=thekelleys.org.uk

# Set a different domain for a particular subnet
#domain=wireless.thekelleys.org.uk,192.168.2.0/24

# Same idea, but range rather then subnet
#domain=reserved.thekelleys.org.uk,192.68.3.100,192.168.3.200

# Uncomment this to enable the integrated DHCP server, you need
# to supply the range of addresses available for lease and optionally
# a lease time. If you have more than one network, you will need to
# repeat this for each network on which you want to supply DHCP
# service.
dhcp-range=interface:wlan0,192.168.1.10,192.168.1.100,255.255.255.0,infinite

# This is an example of a DHCP range where the netmask is given. This
# is needed for networks we reach the dnsmasq DHCP server via a relay
# agent. If you don't know what a DHCP relay agent is, you probably
# don't need to worry about this.
#dhcp-range=192.168.0.50,192.168.0.150,255.255.255.0,12h

# This is an example of a DHCP range which sets a tag, so that
# some DHCP options may be set only for this network.
#dhcp-range=set:red,192.168.0.50,192.168.0.150

# Use this DHCP range only when the tag "green" is set.
#dhcp-range=tag:green,192.168.0.50,192.168.0.150,12h

# Specify a subnet which can't be used for dynamic address allocation,
# is available for hosts with matching --dhcp-host lines. Note that
# dhcp-host declarations will be ignored unless there is a dhcp-range
# of some type for the subnet in question.
# In this case the netmask is implied (it comes from the network
# configuration on the machine running dnsmasq) it is possible to give
# an explicit netmask instead.
#dhcp-range=192.168.0.0,static

# Enable DHCPv6. Note that the prefix-length does not need to be specified
# and defaults to 64 if missing/
#dhcp-range=1234::2, 1234::500, 64, 12h

# Do Router Advertisements, BUT NOT DHCP for this subnet.
#dhcp-range=1234::, ra-only 

# Do Router Advertisements, BUT NOT DHCP for this subnet, also try and
# add names to the DNS for the IPv6 address of SLAAC-configured dual-stack 
# hosts. Use the DHCPv4 lease to derive the name, network segment and 
# MAC address and assume that the host will also have an
# IPv6 address calculated using the SLAAC alogrithm.
#dhcp-range=1234::, ra-names

# Do Router Advertisements, BUT NOT DHCP for this subnet.
# Set the lifetime to 46 hours. (Note: minimum lifetime is 2 hours.)
#dhcp-range=1234::, ra-only, 48h

# Do DHCP and Router Advertisements for this subnet. Set the A bit in the RA
# so that clients can use SLAAC addresses as well as DHCP ones.
#dhcp-range=1234::2, 1234::500, slaac

# Do Router Advertisements and stateless DHCP for this subnet. Clients will
# not get addresses from DHCP, but they will get other configuration information.
# They will use SLAAC for addresses.
#dhcp-range=1234::, ra-stateless

# Do stateless DHCP, SLAAC, and generate DNS names for SLAAC addresses
# from DHCPv4 leases.
#dhcp-range=1234::, ra-stateless, ra-names

# Do router advertisements for all subnets where we're doing DHCPv6
# Unless overriden by ra-stateless, ra-names, et al, the router 
# advertisements will have the M and O bits set, so that the clients
# get addresses and configuration from DHCPv6, and the A bit reset, so the 
# clients don't use SLAAC addresses.
#enable-ra

# Supply parameters for specified hosts using DHCP. There are lots
# of valid alternatives, so we will give examples of each. Note that
# IP addresses DO NOT have to be in the range given above, they just
# need to be on the same network. The order of the parameters in these
# do not matter, it's permissible to give name, address and MAC in any
# order.

# Always allocate the host with Ethernet address 11:22:33:44:55:66
# The IP address 192.168.0.60
#dhcp-host=11:22:33:44:55:66,192.168.0.60

# Always set the name of the host with hardware address
# 11:22:33:44:55:66 to be "fred"
#dhcp-host=11:22:33:44:55:66,fred

# Always give the host with Ethernet address 11:22:33:44:55:66
# the name fred and IP address 192.168.0.60 and lease time 45 minutes
#dhcp-host=11:22:33:44:55:66,fred,192.168.0.60,45m

# Give a host with Ethernet address 11:22:33:44:55:66 or
# 12:34:56:78:90:12 the IP address 192.168.0.60. Dnsmasq will assume
# that these two Ethernet interfaces will never be in use at the same
# time, and give the IP address to the second, even if it is already
# in use by the first. Useful for laptops with wired and wireless
# addresses.
#dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.60

# Give the machine which says its name is "bert" IP address
# 192.168.0.70 and an infinite lease
#dhcp-host=bert,192.168.0.70,infinite

# Always give the host with client identifier 01:02:02:04
# the IP address 192.168.0.60
#dhcp-host=id:01:02:02:04,192.168.0.60

# Always give the host with client identifier "marjorie"
# the IP address 192.168.0.60
#dhcp-host=id:marjorie,192.168.0.60

# Enable the address given for "judge" in /etc/hosts
# to be given to a machine presenting the name "judge" when
# it asks for a DHCP lease.
#dhcp-host=judge

# Never offer DHCP service to a machine whose Ethernet
# address is 11:22:33:44:55:66
#dhcp-host=11:22:33:44:55:66,ignore

# Ignore any client-id presented by the machine with Ethernet
# address 11:22:33:44:55:66. This is useful to prevent a machine
# being treated differently when running under different OS's or
# between PXE boot and OS boot.
#dhcp-host=11:22:33:44:55:66,id:*

# Send extra options which are tagged as "red" to
# the machine with Ethernet address 11:22:33:44:55:66
#dhcp-host=11:22:33:44:55:66,set:red

# Send extra options which are tagged as "red" to
# any machine with Ethernet address starting 11:22:33:
#dhcp-host=11:22:33:*:*:*,set:red

# Give a fixed IPv6 address and name to client with 
# DUID 00:01:00:01:16:d2:83:fc:92:d4:19:e2:d8:b2
# Note the MAC addresses CANNOT be used to identify DHCPv6 clients.
# Note also the they [] around the IPv6 address are obilgatory.
#dhcp-host=id:00:01:00:01:16:d2:83:fc:92:d4:19:e2:d8:b2, fred, [1234::5] 

# Ignore any clients which are not specified in dhcp-host lines
# or /etc/ethers. Equivalent to ISC "deny unknown-clients".
# This relies on the special "known" tag which is set when
# a host is matched.
#dhcp-ignore=tag:!known

# Send extra options which are tagged as "red" to any machine whose
# DHCP vendorclass string includes the substring "Linux"
#dhcp-vendorclass=set:red,Linux

# Send extra options which are tagged as "red" to any machine one
# of whose DHCP userclass strings includes the substring "accounts"
#dhcp-userclass=set:red,accounts

# Send extra options which are tagged as "red" to any machine whose
# MAC address matches the pattern.
#dhcp-mac=set:red,00:60:8C:*:*:*

# If this line is uncommented, dnsmasq will read /etc/ethers and act
# on the ethernet-address/IP pairs found there just as if they had
# been given as --dhcp-host options. Useful if you keep
# MAC-address/host mappings there for other purposes.
#read-ethers

# Send options to hosts which ask for a DHCP lease.
# See RFC 2132 for details of available options.
# Common options can be given to dnsmasq by name:
# run "dnsmasq --help dhcp" to get a list.
# Note that all the common settings, such as netmask and
# broadcast address, DNS server and default route, are given
# sane defaults by dnsmasq. You very likely will not need
# any dhcp-options. If you use Windows clients and Samba, there
# are some options which are recommended, they are detailed at the
# end of this section.

# Override the default route supplied by dnsmasq, which assumes the
# router is the same machine as the one running dnsmasq.
#dhcp-option=3,1.2.3.4

# Do the same thing, but using the option name
#dhcp-option=option:router,1.2.3.4

# Override the default route supplied by dnsmasq and send no default
# route at all. Note that this only works for the options sent by
# default (1, 3, 6, 12, 28) the same line will send a zero-length option
# for all other option numbers.
#dhcp-option=3

# Set the NTP time server addresses to 192.168.0.4 and 10.10.0.5
#dhcp-option=option:ntp-server,192.168.0.4,10.10.0.5

# Send DHCPv6 option. Note [] around IPv6 addresses.
#dhcp-option=option6:dns-server,[1234::77],[1234::88]

# Send DHCPv6 option for namservers as the machine running 
# dnsmasq and another.
#dhcp-option=option6:dns-server,[::],[1234::88]

# Set the NTP time server address to be the same machine as
# is running dnsmasq
#dhcp-option=42,0.0.0.0

# Set the NIS domain name to "welly"
#dhcp-option=40,welly

# Set the default time-to-live to 50
#dhcp-option=23,50

# Set the "all subnets are local" flag
#dhcp-option=27,1

# Send the etherboot magic flag and then etherboot options (a string).
#dhcp-option=128,e4:45:74:68:00:00
#dhcp-option=129,NIC=eepro100

# Specify an option which will only be sent to the "red" network
# (see dhcp-range for the declaration of the "red" network)
# Note that the tag: part must precede the option: part.
#dhcp-option = tag:red, option:ntp-server, 192.168.1.1

# The following DHCP options set up dnsmasq in the same way as is specified
# for the ISC dhcpcd in
# http://www.samba.org/samba/ftp/docs/textdocs/DHCP-Server-Configuration.txt
# adapted for a typical dnsmasq installation where the host running
# dnsmasq is also the host running samba.
# you may want to uncomment some or all of them if you use
# Windows clients and Samba.
#dhcp-option=19,0           # option ip-forwarding off
#dhcp-option=44,0.0.0.0     # set netbios-over-TCP/IP nameserver(s) aka WINS server(s)
#dhcp-option=45,0.0.0.0     # netbios datagram distribution server
#dhcp-option=46,8           # netbios node type

# Send an empty WPAD option. This may be REQUIRED to get windows 7 to behave.
#dhcp-option=252,"\n"

# Send RFC-3397 DNS domain search DHCP option. WARNING: Your DHCP client
# probably doesn't support this......
#dhcp-option=option:domain-search,eng.apple.com,marketing.apple.com

# Send RFC-3442 classless static routes (note the netmask encoding)
#dhcp-option=121,192.168.1.0/24,1.2.3.4,10.0.0.0/8,5.6.7.8

# Send vendor-class specific options encapsulated in DHCP option 43.
# The meaning of the options is defined by the vendor-class so
# options are sent only when the client supplied vendor class
# matches the class given here. (A substring match is OK, so "MSFT"
# matches "MSFT" and "MSFT 5.0"). This example sets the
# mtftp address to 0.0.0.0 for PXEClients.
#dhcp-option=vendor:PXEClient,1,0.0.0.0

# Send microsoft-specific option to tell windows to release the DHCP lease
# when it shuts down. Note the "i" flag, to tell dnsmasq to send the
# value as a four-byte integer - that's what microsoft wants. See
# http://technet2.microsoft.com/WindowsServer/en/library/a70f1bb7-d2d4-49f0-96d6-4b7414ecfaae1033.mspx?mfr=true
#dhcp-option=vendor:MSFT,2,1i

# Send the Encapsulated-vendor-class ID needed by some configurations of
# Etherboot to allow is to recognise the DHCP server.
#dhcp-option=vendor:Etherboot,60,"Etherboot"

# Send options to PXELinux. Note that we need to send the options even
# though they don't appear in the parameter request list, so we need
# to use dhcp-option-force here.
# See http://syslinux.zytor.com/pxe.php#special for details.
# Magic number - needed before anything else is recognised
#dhcp-option-force=208,f1:00:74:7e
# Configuration file name
#dhcp-option-force=209,configs/common
# Path prefix
#dhcp-option-force=210,/tftpboot/pxelinux/files/
# Reboot time. (Note 'i' to send 32-bit value)
#dhcp-option-force=211,30i

# Set the boot filename for netboot/PXE. You will only need
# this is you want to boot machines over the network and you will need
# a TFTP server; either dnsmasq's built in TFTP server or an
# external one. (See below for how to enable the TFTP server.)
#dhcp-boot=pxelinux.0

# The same as above, but use custom tftp-server instead machine running dnsmasq
#dhcp-boot=pxelinux,server.name,192.168.1.100

# Boot for Etherboot gPXE. The idea is to send two different
# filenames, the first loads gPXE, and the second tells gPXE what to
# load. The dhcp-match sets the gpxe tag for requests from gPXE.
#dhcp-match=set:gpxe,175 # gPXE sends a 175 option.
#dhcp-boot=tag:!gpxe,undionly.kpxe
#dhcp-boot=mybootimage

# Encapsulated options for Etherboot gPXE. All the options are
# encapsulated within option 175
#dhcp-option=encap:175, 1, 5b         # priority code
#dhcp-option=encap:175, 176, 1b       # no-proxydhcp
#dhcp-option=encap:175, 177, string   # bus-id
#dhcp-option=encap:175, 189, 1b       # BIOS drive code
#dhcp-option=encap:175, 190, user     # iSCSI username
#dhcp-option=encap:175, 191, pass     # iSCSI password

# Test for the architecture of a netboot client. PXE clients are
# supposed to send their architecture as option 93. (See RFC 4578)
#dhcp-match=peecees, option:client-arch, 0 #x86-32
#dhcp-match=itanics, option:client-arch, 2 #IA64
#dhcp-match=hammers, option:client-arch, 6 #x86-64
#dhcp-match=mactels, option:client-arch, 7 #EFI x86-64

# Do real PXE, rather than just booting a single file, this is an
# alternative to dhcp-boot.
#pxe-prompt="What system shall I netboot?"
# or with timeout before first available action is taken:
#pxe-prompt="Press F8 for menu.", 60

# Available boot services. for PXE.
#pxe-service=x86PC, "Boot from local disk"

# Loads <tftp-root>/pxelinux.0 from dnsmasq TFTP server.
#pxe-service=x86PC, "Install Linux", pxelinux

# Loads <tftp-root>/pxelinux.0 from TFTP server at 1.2.3.4.
# Beware this fails on old PXE ROMS.
#pxe-service=x86PC, "Install Linux", pxelinux, 1.2.3.4

# Use bootserver on network, found my multicast or broadcast.
#pxe-service=x86PC, "Install windows from RIS server", 1

# Use bootserver at a known IP address.
#pxe-service=x86PC, "Install windows from RIS server", 1, 1.2.3.4

# If you have multicast-FTP available,
# information for that can be passed in a similar way using options 1
# to 5. See page 19 of
# http://download.intel.com/design/archives/wfm/downloads/pxespec.pdf


# Enable dnsmasq's built-in TFTP server
#enable-tftp

# Set the root directory for files available via FTP.
#tftp-root=/var/ftpd

# Make the TFTP server more secure: with this set, only files owned by
# the user dnsmasq is running as will be send over the net.
#tftp-secure

# This option stops dnsmasq from negotiating a larger blocksize for TFTP
# transfers. It will slow things down, but may rescue some broken TFTP
# clients.
#tftp-no-blocksize

# Set the boot file name only when the "red" tag is set.
#dhcp-boot=net:red,pxelinux.red-net

# An example of dhcp-boot with an external TFTP server: the name and IP
# address of the server are given after the filename.
# Can fail with old PXE ROMS. Overridden by --pxe-service.
#dhcp-boot=/var/ftpd/pxelinux.0,boothost,192.168.0.3

# If there are multiple external tftp servers having a same name
# (using /etc/hosts) then that name can be specified as the
# tftp_servername (the third option to dhcp-boot) and in that
# case dnsmasq resolves this name and returns the resultant IP
# addresses in round robin fasion. This facility can be used to
# load balance the tftp load among a set of servers.
#dhcp-boot=/var/ftpd/pxelinux.0,boothost,tftp_server_name

# Set the limit on DHCP leases, the default is 150
#dhcp-lease-max=150

# The DHCP server needs somewhere on disk to keep its lease database.
# This defaults to a sane location, but if you want to change it, use
# the line below.
#dhcp-leasefile=/var/lib/misc/dnsmasq.leases

# Set the DHCP server to authoritative mode. In this mode it will barge in
# and take over the lease for any client which broadcasts on the network,
# whether it has a record of the lease or not. This avoids long timeouts
# when a machine wakes up on a new network. DO NOT enable this if there's
# the slightest chance that you might end up accidentally configuring a DHCP
# server for your campus/company accidentally. The ISC server uses
# the same option, and this URL provides more information:
# http://www.isc.org/files/auth.html
#dhcp-authoritative

# Run an executable when a DHCP lease is created or destroyed.
# The arguments sent to the script are "add" or "del",
# then the MAC address, the IP address and finally the hostname
# if there is one.
#dhcp-script=/bin/echo

# Set the cachesize here.
#cache-size=150

# If you want to disable negative caching, uncomment this.
#no-negcache

# Normally responses which come form /etc/hosts and the DHCP lease
# file have Time-To-Live set as zero, which conventionally means
# do not cache further. If you are happy to trade lower load on the
# server for potentially stale date, you can set a time-to-live (in
# seconds) here.
#local-ttl=

# If you want dnsmasq to detect attempts by Verisign to send queries
# to unregistered .com and .net hosts to its sitefinder service and
# have dnsmasq instead return the correct NXDOMAIN response, uncomment
# this line. You can add similar lines to do the same for other
# registries which have implemented wildcard A records.
#bogus-nxdomain=64.94.110.11

# If you want to fix up DNS results from upstream servers, use the
# alias option. This only works for IPv4.
# This alias makes a result of 1.2.3.4 appear as 5.6.7.8
#alias=1.2.3.4,5.6.7.8
# and this maps 1.2.3.x to 5.6.7.x
#alias=1.2.3.0,5.6.7.0,255.255.255.0
# and this maps 192.168.0.10->192.168.0.40 to 10.0.0.10->10.0.0.40
#alias=192.168.0.10-192.168.0.40,10.0.0.0,255.255.255.0

# Change these lines if you want dnsmasq to serve MX records.

# Return an MX record named "maildomain.com" with target
# servermachine.com and preference 50
#mx-host=maildomain.com,servermachine.com,50

# Set the default target for MX records created using the localmx option.
#mx-target=servermachine.com

# Return an MX record pointing to the mx-target for all local
# machines.
#localmx

# Return an MX record pointing to itself for all local machines.
#selfmx

# Change the following lines if you want dnsmasq to serve SRV
# records.  These are useful if you want to serve ldap requests for
# Active Directory and other windows-originated DNS requests.
# See RFC 2782.
# You may add multiple srv-host lines.
# The fields are <name>,<target>,<port>,<priority>,<weight>
# If the domain part if missing from the name (so that is just has the
# service and protocol sections) then the domain given by the domain=
# config option is used. (Note that expand-hosts does not need to be
# set for this to work.)

# A SRV record sending LDAP for the example.com domain to
# ldapserver.example.com port 389
#srv-host=_ldap._tcp.example.com,ldapserver.example.com,389

# A SRV record sending LDAP for the example.com domain to
# ldapserver.example.com port 389 (using domain=)
#domain=example.com
#srv-host=_ldap._tcp,ldapserver.example.com,389

# Two SRV records for LDAP, each with different priorities
#srv-host=_ldap._tcp.example.com,ldapserver.example.com,389,1
#srv-host=_ldap._tcp.example.com,ldapserver.example.com,389,2

# A SRV record indicating that there is no LDAP server for the domain
# example.com
#srv-host=_ldap._tcp.example.com

# The following line shows how to make dnsmasq serve an arbitrary PTR
# record. This is useful for DNS-SD. (Note that the
# domain-name expansion done for SRV records _does_not
# occur for PTR records.)
#ptr-record=_http._tcp.dns-sd-services,"New Employee Page._http._tcp.dns-sd-services"

# Change the following lines to enable dnsmasq to serve TXT records.
# These are used for things like SPF and zeroconf. (Note that the
# domain-name expansion done for SRV records _does_not
# occur for TXT records.)

#Example SPF.
#txt-record=example.com,"v=spf1 a -all"

#Example zeroconf
#txt-record=_http._tcp.example.com,name=value,paper=A4

# Provide an alias for a "local" DNS name. Note that this _only_ works
# for targets which are names from DHCP or /etc/hosts. Give host
# "bert" another name, bertrand
#cname=bertand,bert

# For debugging purposes, log each DNS query as it passes through
# dnsmasq.
#log-queries

# Log lots of extra information about DHCP transactions.
#log-dhcp

# Include a another lot of configuration options.
#conf-file=/etc/dnsmasq.more.conf
#conf-dir=/etc/dnsmasq.d

/etc/network/interfaces

verkleinern
# loopback-Interface nicht löschen
auto lo
iface lo inet loopback

# LAN / automatische Konfiguration über DHCP
auto eth0
iface eth0 inet dhcp

# WLAN mit statischer Konfiguration
auto wlan0
iface wlan0 inet static
address 192.168.1.112
netmask 255.255.255.0
broadcast 192.168.1.255

# Forwarding zulassen
sysctl -w net.ipv4.ip_forward=1

# Kernelmodule laden
modprobe ip_tables
modprobe ip_nat_ftp
modprobe ip_nat_irc
modprobe ip_conntrack
modprobe ipt_limit
modprobe ipt_multiport
modprobe iptable_mangle
modprobe ipt_state
modprobe iptable_filter
modprobe iptable_nat
modprobe ipt_REJECT
modprobe ipt_LOG
modprobe xt_recent
modprobe ipt_mac

# Vorhandene Regeln und Ketten zuerst löschen (Restart-Funktionalität)
/sbin/iptables -F
/sbin/iptables -X
/sbin/iptables -t nat -F

# Default Verhalten festlegen
/sbin/iptables -P INPUT DROP
/sbin/iptables -P OUTPUT ACCEPT
/sbin/iptables -P FORWARD DROP

# ALLOW ESTABLISHED and RELATED incoming connections
/sbin/iptables -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -A INPUT -i wlan0 -m state --state ESTABLISHED,RELATED -j ACCEPT
 
# ALLOW self communication
/sbin/iptables -A INPUT -i lo -j ACCEPT
/sbin/iptables -A OUTPUT -o lo -j ACCEPT

# FORWARDING rules for our WirelessLAN on wlan0 to the WAN
/sbin/iptables -A FORWARD -i eth0 -o wlan0 -d 192.168.1.0/24 -m state --state ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -A FORWARD -i wlan0 -s 192.168.1.0/24 -o eth0 -j ACCEPT

# ALLOW incomming connections on our internal interfaces
iptables -A INPUT -i wlan0 -j ACCEPT

# ALLOW ssh
iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT

# Do MASQUERADING for every OUTPUT package
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

# hostapd und dnsmasq neu starten
/etc/init.d/hostapd restart
/etc/init.d/dnsmasq restart

2.) Am pi zwei Terminals öffnen.

a.) Im ersten Terminal folgenden Befehl ausführen, und nach Befehl 2.b.) den Inhalt posten

tail -f /var/log/syslog

b.) Auch den Output von diesem Befehl posten bitte.

sudo /etc/init.d/networking restart

3.) An einem Ubuntuclient einen Terminal öffnen, bevor du versuchst per Wifi einen Verbindung zum pi aufzubauen. Wenn du die Verbindung aufbaust, dessen Inhalt posten.

tail -f /var/log/syslog

4.) Du hast zwei mal den gleichen Addressbereich, das kann nicht funktionieren! Hast du vorher von deinem DSL-Router eine statische IP verlangt? Mach mal bitte einen Reset auf deinem DSL-Router.

ifconfig -a

verkleinern
eth0      Link encap:Ethernet  Hardware Adresse b8:27:eb:70:d2:d6  
          inet Adresse:192.168.1.112  Bcast:192.168.1.255  Maske:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1
          RX packets:19190 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4296 errors:0 dropped:0 overruns:0 carrier:0
          Kollisionen:0 Sendewarteschlangenlänge:1000 
          RX bytes:2723841 (2.5 MiB)  TX bytes:624461 (609.8 KiB)

lo        Link encap:Lokale Schleife  
          inet Adresse:127.0.0.1  Maske:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metrik:1
          RX packets:27 errors:0 dropped:0 overruns:0 frame:0
          TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
          Kollisionen:0 Sendewarteschlangenlänge:0 
          RX bytes:5732 (5.5 KiB)  TX bytes:5732 (5.5 KiB)

mon.wlan0 Link encap:UNSPEC  Hardware Adresse A0-F3-C1-29-DB-77-00-00-00-00-00-00-00-00-00-00  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1
          RX packets:1860545 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          Kollisionen:0 Sendewarteschlangenlänge:1000 
          RX bytes:535461919 (510.6 MiB)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  Hardware Adresse a0:f3:c1:29:db:77  
          inet Adresse:192.168.1.112  Bcast:192.168.1.255  Maske:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1
          RX packets:213 errors:0 dropped:89 overruns:0 frame:0
          TX packets:205 errors:0 dropped:0 overruns:0 carrier:0
          Kollisionen:0 Sendewarteschlangenlänge:1000 
          RX bytes:42971 (41.9 KiB)  TX bytes:45669 (44.5 KiB)

elektronenblitz63

es sollte lauten

up iptables -A FORWARD -o eth0 -i wlan0 -s 192.168.1.0/24 -m conntrack --ctstate NEW -j ACCEPT So sieht das hier aus.

Das habe ich in Farinet's script bereits korrigiert.

duesentriebchen

Avatar von duesentriebchen

Anmeldungsdatum:
10. Februar 2012

Beiträge: 713

Wohnort: Im Inntal

Farinet

Poste mal bitte vom pi die Ausgabe von

cat /etc/NetworkManager/NetworkManager.conf

Farinet

(Themenstarter)

Anmeldungsdatum:
17. Juni 2009

Beiträge: 611

duesentriebchen...

Ja, die iptables regeln sind etwas, naja, nicht so ganz die besten.

Versuch mal diese...

/etc/network/interfaces

# loopback-Interface nicht löschen
auto lo
iface lo inet loopback

# LAN / automatische Konfiguration über DHCP
auto eth0
iface eth0 inet dhcp

# WLAN mit statischer Konfiguration
auto wlan0
iface wlan0 inet static
address 192.168.1.112
netmask 255.255.255.0
broadcast 192.168.1.255

# Forwarding zulassen
sysctl -w net.ipv4.ip_forward=1

# Kernelmodule laden
modprobe ip_tables
modprobe ip_nat_ftp
modprobe ip_nat_irc
modprobe ip_conntrack
modprobe ipt_limit
modprobe ipt_multiport
modprobe iptable_mangle
modprobe ipt_state
modprobe iptable_filter
modprobe iptable_nat
modprobe ipt_REJECT
modprobe ipt_LOG
modprobe xt_recent
modprobe ipt_mac

# Vorhandene Regeln und Ketten zuerst löschen (Restart-Funktionalität)
/sbin/iptables -F
/sbin/iptables -X
/sbin/iptables -t nat -F

# Default Verhalten festlegen
/sbin/iptables -P INPUT DROP
/sbin/iptables -P OUTPUT ACCEPT
/sbin/iptables -P FORWARD DROP

# ALLOW ESTABLISHED and RELATED incoming connections
/sbin/iptables -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -A INPUT -i wlan0 -m state --state ESTABLISHED,RELATED -j ACCEPT
 
# ALLOW self communication
/sbin/iptables -A INPUT -i lo -j ACCEPT
/sbin/iptables -A OUTPUT -o lo -j ACCEPT

# FORWARDING rules for our WirelessLAN on wlan0 to the WAN
/sbin/iptables -A FORWARD -i eth0 -o wlan0 -d 192.168.1.0/24 -m state --state ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -A FORWARD -i wlan0 -s 192.168.1.0/24 -o eth0 -j ACCEPT

# ALLOW incomming connections on our internal interfaces
iptables -A INPUT -i wlan0 -j ACCEPT

# ALLOW ssh
iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT

# Do MASQUERADING for every OUTPUT package
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

# hostapd und dnsmasq neu starten
/etc/init.d/hostapd restart
/etc/init.d/dnsmasq restart

So, eine Supernachricht: Mit Deinem /etc/network/interfaces kann ich mich in die Himbeere einloggen, und die Himbeere leitet dann weiter zum Router/Modem und ins Internet.

Jetzt noch eine Frage: Im Augenblick lasse ich die Wlan Funktion der EasyBox noch angeschaltet (um eventuell Adminstrationszugriff zu haben und auch, wenn irgendetwas doch noch schief läuft, ins Internet zu kommen). Wäre das ok so?

Jetzt muss ich nochmal zurück zu Deinen Vorschlägen, wie man jetzt tor auf der Himbeere einrichtet. Zuvor noch eine Frage: Ich bin Deinem Rat gefolgt und habe, soweit möglich, auf den lokalen Devices (Rechner sowieso, aber auch einigen tablets und smartphones der family) privoxy eingerichtet. Das funktioniert in der Tat überraschend gut.

Nun bleibt die Frage: Lohnt sich das polipo als cachenden Proxy vor Tor auf der Himbeere einzurichten, so dass auf den einzelnen Rechnern in privoxy eine Weiterleitung zu polipo eingerichtet werden müsste (so in der Art:

forward   /      10.10.10.112:8123 #10.10.10.112 = Adresse der Himbeere

)?(1) Und wie sollte man dann mit dem Cache der Browser umgehen, abschalten? Oder ist es besser auf letzteren zu bauen?


1) Irgendwie müsste man noch den "Admin-Zugang" zur Easybox ermöglichen . . . (wenn's denn überhaupt möglich ist).

duesentriebchen

Avatar von duesentriebchen

Anmeldungsdatum:
10. Februar 2012

Beiträge: 713

Wohnort: Im Inntal

Hallo Farinet

War ja auch die Absicht ☺

Im Moment lässt sich deine Himbeere per SSH sowohl über eth0 und wlan0 administrieren. Wenn du uns sagst Was du bevorzugst, stellen wir daß so ein.

Ich denke nicht, dass es mit Tor sinnvoll ist einen CachingProxy zu nutzen, da die Verbindungen von Tor abhängig sind.

Cache der Browser würde ich abschalten. Deine Verbindungsgeschwindigkeiten streuen zu sehr, als daß ein CacheProxy von Vorteil wäre.

Was ist deine "EasyBox"? Der DSL Router von deinem ISP?

Wenn du dich an die Tor Konfiguration machst, meld dich wieder 😉

Hans9876543210

Anmeldungsdatum:
2. Januar 2011

Beiträge: 3741

Hi duesentriebchen

  1. Wieso muss man eigentlich das Loopback Interface angeben?

2. Wieso hast du eigentlich bei der eth0 Schnittstelle DHCP wieder weggenommen? Das würde ja nur dann Sinn machen, wenn du eth0 vorher erlaubt hättest, aber jetzt den DNS nur haben willst.

Danke schonmal für die Infos ☺

duesentriebchen schrieb:

Farinet schrieb:

Versuchs mal mit dieser /etc/dnsmasq.conf (Änderungen in gelb hervorgehoben)
1.) Dir hat das loopback (localhost) interface gefehlt.

# If you want dnsmasq to listen for DHCP and DNS requests only on
# specified interfaces (and the loopback) give the name of the
# interface (eg eth0) here.
# Repeat the line for more than one interface.
interface=lo
interface=wlan0

# If you want dnsmasq to provide only DNS service on an interface,
# configure it as shown above, and then use the following line to
# disable DHCP and TFTP on it.
no-dhcp-interface=eth0

Farinet

(Themenstarter)

Anmeldungsdatum:
17. Juni 2009

Beiträge: 611

duesentriebchen schrieb:

Hallo Farinet

War ja auch die Absicht ☺

Im Moment lässt sich deine Himbeere per SSH sowohl über eth0 und wlan0 administrieren. Wenn du uns sagst Was du bevorzugst, stellen wir daß so ein.

Ich denke nicht, dass es mit Tor sinnvoll ist einen CachingProxy zu nutzen, da die Verbindungen von Tor abhängig sind.

Cache der Browser würde ich abschalten. Deine Verbindungsgeschwindigkeiten streuen zu sehr, als daß ein CacheProxy von Vorteil wäre.

Was ist deine "EasyBox"? Der DSL Router von deinem ISP?

Wenn du dich an die Tor Konfiguration machst, meld dich wieder 😉

Der Reihe nach:

- Polipo ist also nicht sinnvoll (eigentlich schade, ich hatte der Himbeere eine ultraschnelle 8GB Sdcard gespendet; mein Fotoapparat kann sie nicht gebrauchen, der kann nur bis 4 GB. Aber nun gut, es ist wie es ist 😉 Ich werd's dann mal wieder löschen!

- Die Easybox ist der (A)Dsl-Router/Modem. Ich hatte mir das so gedacht, dass ich dessen Wlan abschalte, wenn die Himbeere stabil und zuverlässig funktioniert, sodass er nur noch als Modem funktioniert; verbunden per ethernet mit der Himbeere. Wie gesagt, es läuft jetzt auch mit dem Router Wlan on (aber ich denke das gibt nur Wirrwar, wenn beides läuft). Da man das Wlan der Easybox nur per Webinterface abschalten kann, will ich es solange laufen lassen, bis ich alles klar habe (möglichst auch den admin Zugang per torbox).

- Ich habe noch etwas Kurioses bemerkt: Die Macs haben mit der EasyBox nur dann kommunizieren können, wenn ich auf ihnen das Netz (TCP/IP etc.) manuell konfiguriere. Mit der Himbeere sprechen sie dagegen nur per automatisch (??). Sollte aber kein grosses Problem sein, Hauptsache, es läuft.

- Melde mich hiermit also für die Transparente Torbox. Ich habe die entsprechenden Seiten des Tor Projects gelesen, aber nicht wirklich viel verstanden ... Aber man hört ja nie auf zu lernen (So nebenbei ist es mir gelungen, auf einem steinalten HP Pavilion ein hübsches environment from the scratch aufzubauen (debian sid(uction) slim → fluxbox - viel kopiert von #! crunchbang 😀 ; aber es sieht nicht schlecht aus, und ist rasend schnell für die alte Mühle. Dabei habe ich eine ganze Menge gelernt, vor allem von wie vielen Dingen ich absolut keine Ahnung habe. Und so ähnlich ist es auch hier 😉 ).

duesentriebchen

Avatar von duesentriebchen

Anmeldungsdatum:
10. Februar 2012

Beiträge: 713

Wohnort: Im Inntal

Hans9876543210 schrieb:

Hi duesentriebchen

  1. Wieso muss man eigentlich das Loopback Interface angeben?

Weill dnsmasq auf diesem interface auf Anfragen wartet. Sieh dir auf Ubuntu 12.04 mal den Output von

cat /etc/resolv.conf

an.

2. Wieso hast du eigentlich bei der eth0 Schnittstelle DHCP wieder weggenommen? Das würde ja nur dann Sinn machen, wenn du eth0 vorher erlaubt hättest, aber jetzt den DNS nur haben willst.

Weil du, angenommen eth0 ist deine WAN Schnittstelle, nicht möchtest, daß dnsmasq auf Verbindungen aus dem Internet lauscht 😀
Lesen

Danke schonmal für die Infos ☺

Bitte gerne 😬

Farinet schrieb:

Der Reihe nach:

Okidoki

- Polipo ist also nicht sinnvoll (eigentlich schade, ich hatte der Himbeere eine ultraschnelle 8GB Sdcard gespendet; mein Fotoapparat kann sie nicht gebrauchen, der kann nur bis 4 GB. Aber nun gut, es ist wie es ist 😉 Ich werd's dann mal wieder löschen!

Je weniger auf deinem System läuft, desto besser. Du verwendest auf den Clients schon Privoxy, der filtert sehr viel. Daher steigt deine "Sicherheit", durch eliminierte Add-Server, und auch deine Verbindungsgeschwindigkeiten, da diese Add-Server nicht geladen werden.
Du kannst Polipo installieren, aber obs sinnvoll und dir Geschwindigkeit bringt, musst du ausprobieren.

- Die Easybox ist der (A)Dsl-Router/Modem. Ich hatte mir das so gedacht, dass ich dessen Wlan abschalte, wenn die Himbeere stabil und zuverlässig funktioniert, sodass er nur noch als Modem funktioniert; verbunden per ethernet mit der Himbeere. Wie gesagt, es läuft jetzt auch mit dem Router Wlan on (aber ich denke das gibt nur Wirrwar, wenn beides läuft). Da man das Wlan der Easybox nur per Webinterface abschalten kann, will ich es solange laufen lassen, bis ich alles klar habe (möglichst auch den admin Zugang per torbox).

Jope, kannst du so machen, ist sinnvoll.

- Ich habe noch etwas Kurioses bemerkt: Die Macs haben mit der EasyBox nur dann kommunizieren können, wenn ich auf ihnen das Netz (TCP/IP etc.) manuell konfiguriere. Mit der Himbeere sprechen sie dagegen nur per automatisch (??). Sollte aber kein grosses Problem sein, Hauptsache, es läuft.

Bitte definier das etwas genauer...

- Melde mich hiermit also für die Transparente Torbox. Ich habe die entsprechenden Seiten des Tor Projects gelesen, aber nicht wirklich viel verstanden ... Aber man hört ja nie auf zu lernen (So nebenbei ist es mir gelungen, auf einem steinalten HP Pavilion ein hübsches environment from the scratch aufzubauen (debian sid(uction) slim → fluxbox - viel kopiert von #! crunchbang 😀 ; aber es sieht nicht schlecht aus, und ist rasend schnell für die alte Mühle. Dabei habe ich eine ganze Menge gelernt, vor allem von wie vielen Dingen ich absolut keine Ahnung habe. Und so ähnlich ist es auch hier 😉 ).

Die Links hast du in diesem Thread schon, um das erfolgreich umzusetzen. Vergiss in den iptables rules nicht, deinen SSH Port mit dem Interface freizugeben, ansonsten sperrst du dich aus ❗

elektronenblitz63

Avatar von elektronenblitz63

Anmeldungsdatum:
16. Januar 2007

Beiträge: 29307

Wohnort: NRW

Hallo,
ich habe mir jetzt ebenfalls einen Pi zugelegt. Hier läuft das Ganze nun bereits grundsätzlich so wie ich mir das vorgestellt habe, es gibt aber noch einiges zu testen, die Konfiguration ist nur rudimentär, außerdem soll es noch ein DNS-Leck geben, was es zu stopfen gilt.

DSL - Router – LAN – Pi [WLAN-AP über hostapd → Squid (transparent) → Privoxy → Tor] ~~~ WLAN ~~~ Clients

Auf den Clients muss ich nichts konfigurieren, da Squid ja als transparenter Proxy läuft. Stoppe ich auf dem Pi einen der Dienste, Squid Privoxy oder Tor, so habe ich auf den Clients keine Internetverbindung mehr. http://www.ipchicken.com/ zeigt mir auch wechselnde Adressen aus dem Tor-Netzwerk an.

Weill dnsmasq auf diesem interface auf Anfragen wartet. Sieh dir auf Ubuntu 12.04 mal den Output von ...

Hier läuft dnsmasq ausschließlich als DHCP-Server und lauscht auf der WLAN-Schnittstelle. Unter Raspian ist dnsmasq-base standardmäßig nicht installiert, so wie unter Ubuntu!

Konfiguration folgt, sofern gewünscht.

Hans9876543210

Anmeldungsdatum:
2. Januar 2011

Beiträge: 3741

Hi, ich muss noch mal nachfragen weil ich das nicht so ganz verstehe 😐

  1. Wieso muss man eigentlich das Loopback Interface angeben?

Weill dnsmasq auf diesem interface auf Anfragen wartet. Sieh dir auf Ubuntu 12.04 mal den Output von

cat /etc/resolv.conf

an.

Siehe Dnsmasq (Abschnitt „Verwendung-des-Cache“). Also sofern in der resolv.conf schon als nameserver 127.0.0.1 gesetzt wurde, braucht man keine weitere Angabe in dnsmasq.

2. Wieso hast du eigentlich bei der eth0 Schnittstelle DHCP wieder weggenommen? Das würde ja nur dann Sinn machen, wenn du eth0 vorher erlaubt hättest, aber jetzt den DNS nur haben willst.

Weil du, angenommen eth0 ist deine WAN Schnittstelle, nicht möchtest, daß dnsmasq auf Verbindungen aus dem Internet lauscht 😀
Lesen

Laut hier ist die Angabe von eth0 überhaupt nicht erforderlich, eben weil dnsmasq hier nicht lauscht. Es sei denn, du gibst es explizit an, dann würde no-dhcp wieder Sinn machen.

Sorry für die dummen Nachfragen, aber ich wills halt verstehen. Danke! ☺

Farinet

(Themenstarter)

Anmeldungsdatum:
17. Juni 2009

Beiträge: 611

duesentriebchen

... Farinet schrieb:

...

- Ich habe noch etwas Kurioses bemerkt: Die Macs haben mit der EasyBox nur dann kommunizieren können, wenn ich auf ihnen das Netz (TCP/IP etc.) manuell konfiguriere. Mit der Himbeere sprechen sie dagegen nur per automatisch (??). Sollte aber kein grosses Problem sein, Hauptsache, es läuft.

Bitte definier das etwas genauer...

Also: Wenn ich Macs (und iPhones, ich weiss, ich weiss, aber mach' was gegen die "Jugend" ... 😉 ) für den den Internetzugang ohne raspberry einrichte, dann muss ich das Netzwerk per manuell konfigurieren, und zwar so:

Ich teile den devices IP-Adressen fix zu, definiere die Netzwerkmaske und muss auch DNS-Server sowie Gateway per Ip-Adresse genau eingeben. (Das trifft nicht zu für Linux oder Android Devices, die konfigurieren sich automatisch).

Für den Zugang zum Internet via raspberry funktioniert dagegen (iPhone - iOs also - habe ich noch nicht probiert) die automatische Konfiguration (da muss nur das Gateway angegeben werden).

- Melde mich hiermit also für die Transparente Torbox. . . .

Die Links hast du in diesem Thread schon, um das erfolgreich umzusetzen. Vergiss in den iptables rules nicht, deinen SSH Port mit dem Interface freizugeben, ansonsten sperrst du dich aus ❗

Für Tor melde ich mich noch. Da habe ich eine Menge Fragen, die in eine ähnliche Richtung gehen wie die von Hans (aber vermutlich noch viel "dümmer" sind).

Farinet

(Themenstarter)

Anmeldungsdatum:
17. Juni 2009

Beiträge: 611

duesentriebchen schrieb:

... Ich würde eine Whitelist für MAC-Addressen führen. Hostapd kann das und mach ein Passwort mit 63 Stellen. Artikel dazu im Wiki.

Da habe ich versucht mich schlau zu machen und die ganze Anleitung in wireless.kernel.org durchgelesen. Mir bleibt jedoch unklar, wo und wie hostapd die Liste der erlaubten Mac-Adressen führt?