[gelöst] DHCP-Server mit dnsmasq - Network unreachable

Einrichten des lokalen Netzes, Verbindung zu anderen Computern und Diensten.
Antworten
eddi0815
Beiträge: 5
Registriert: 13.09.2017 21:26:01

[gelöst] DHCP-Server mit dnsmasq - Network unreachable

Beitrag von eddi0815 » 13.09.2017 22:04:46

Hallo,
ich möchte in meinem Netzwerk ein AdHoc-Wlan einrichten und auf dem Rechner mit dem Adhoc-Wlan soll ein DHCP-Server laufen.
Das AdHoc-Wlan läuft bereits und der DHCP-Server verteilt auch IP-Addressen. Leider können sich die Clients und der Server
nicht anpingen (Network is unreachable). Wahrscheinlich ist die Konfiguration /etc/dnsmasq.conf nicht korrekt.
Achso, die Clients sollen kein Zugang zum Internet erhalten.

Dabei bitte ich um eure Hilfe.

Viele Grüße,
eddi0815

Daten:

Debian-Release: Stretch
DHCP-Server: dnsmasq

Kommandos für AdHoc-Wlan:

Code: Alles auswählen

iw wlan0 set type ibss 
ip link set wlan0 up 
iw wlan0 ibss join spc 2412
ip addr add 192.168.20.1 dev wlan0
/etc/dnsmasq.conf:

Code: Alles auswählen

no-resolv
domain-needed
bogus-priv
interface=wlan0
bind-interfaces
dhcp-range=192.168.20.50,192.168.20.150,255.255.255.0,12h
netstat -tulpen | grep dnsmasq:

Code: Alles auswählen

tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      0          26332      1881/dnsmasq        
tcp        0      0 192.168.20.1:53         0.0.0.0:*               LISTEN      0          26330      1881/dnsmasq        
tcp6       0      0 ::1:53                  :::*                    LISTEN      0          26336      1881/dnsmasq        
tcp6       0      0 fe80::ae83:f3ff:fe31:53 :::*                    LISTEN      0          26334      1881/dnsmasq        
udp        0      0 127.0.0.1:53            0.0.0.0:*                           0          26331      1881/dnsmasq        
udp        0      0 192.168.20.1:53         0.0.0.0:*                           0          26329      1881/dnsmasq        
udp        0      0 0.0.0.0:67              0.0.0.0:*                           0          26326      1881/dnsmasq        
udp6       0      0 ::1:53                  :::*                                0          26335      1881/dnsmasq        
udp6       0      0 fe80::ae83:f3ff:fe31:53 :::*                                0          26333      1881/dnsmasq
ifconfig Server:

Code: Alles auswählen

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.20.1  netmask 255.255.255.255  broadcast 0.0.0.0
        inet6 fe80::ae83:f3ff:fe31:f330  prefixlen 64  scopeid 0x20<link>
        ether ac:83:f3:31:f3:30  txqueuelen 1000  (Ethernet)
        RX packets 923  bytes 74032 (72.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 61  bytes 9410 (9.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

iwconfig Server:

Code: Alles auswählen

wlan0     IEEE 802.11  ESSID:"spc"  
          Mode:Ad-Hoc  Frequency:2.412 GHz  Cell: D6:B6:42:4D:DB:20   
          Tx-Power=31 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:on
ip addr show Client:

Code: Alles auswählen

2: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:1e:64:27:4a:9c brd ff:ff:ff:ff:ff:ff
    inet 192.168.20.142/24 brd 192.168.20.255 scope global dynamic wlp3s0
       valid_lft 43185sec preferred_lft 43185sec
    inet6 fe80::2e93:69b4:5e0d:df0e/64 scope link 
       valid_lft forever preferred_lft forever

iwconfig Client:

Code: Alles auswählen

wlp3s0    IEEE 802.11  ESSID:"spc"  
          Mode:Ad-Hoc  Frequency:2.412 GHz  Cell: D6:B6:42:4D:DB:20   
          Tx-Power=14 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off

systemctl status dnsmasq.service:

Code: Alles auswählen

��● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
   Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2017-09-13 19:50:26 UTC; 3s ago
  Process: 2143 ExecStop=/etc/init.d/dnsmasq systemd-stop-resolvconf (code=exited, status=0/SUCCESS)
  Process: 2162 ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf (code=exited, status=0/SUCCESS)
  Process: 2154 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=0/SUCCESS)
  Process: 2151 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUCCESS)
 Main PID: 2161 (dnsmasq)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/dnsmasq.service
           ��└��─2161 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -7 /etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new --local-service --trust-anchor=.,19036,8,2,49aac11d7b6f64467
02e54a1607371607a1a41855200fd2ce1cdde32f24e8fb5 --trust-anchor=.,20326,8,2,e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d

Sep 13 19:50:26 spc dnsmasq[2151]: dnsmasq: syntax check OK.
Sep 13 19:50:26 spc dnsmasq[2161]: started, version 2.76 cachesize 150
Sep 13 19:50:26 spc dnsmasq[2161]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify
Sep 13 19:50:26 spc dnsmasq[2161]: warning: no upstream servers configured
Sep 13 19:50:26 spc dnsmasq-dhcp[2161]: DHCP, IP range 192.168.20.50 -- 192.168.20.150, lease time 12h
Sep 13 19:50:26 spc dnsmasq-dhcp[2161]: DHCP, sockets bound exclusively to interface wlan0
Sep 13 19:50:26 spc dnsmasq[2161]: read /etc/hosts - 7 addresses
Sep 13 19:50:26 spc systemd[1]: Started dnsmasq - A lightweight DHCP and caching DNS server.
Sep 13 19:50:27 spc dnsmasq[2161]: failed to send packet: Network is unreachable
Sep 13 19:50:27 spc dnsmasq[2161]: failed to send packet: Network is unreachable
Zuletzt geändert von eddi0815 am 14.09.2017 11:00:22, insgesamt 1-mal geändert.

mat6937
Beiträge: 2927
Registriert: 09.12.2014 10:44:00

Re: DHCP-Server mit dnsmasq - Network unreachable

Beitrag von mat6937 » 13.09.2017 22:52:23

eddi0815 hat geschrieben: ↑ zum Beitrag ↑
13.09.2017 22:04:46
Leider können sich die Clients und der Server
nicht anpingen (Network is unreachable).
Wie sind auf Server und Client, die Ausgaben von:

Code: Alles auswählen

route -a
arp -av
?

eddi0815
Beiträge: 5
Registriert: 13.09.2017 21:26:01

Re: DHCP-Server mit dnsmasq - Network unreachable

Beitrag von eddi0815 » 13.09.2017 23:32:01

Den Parameter -a kennt route nicht, deshalb die Ausgabe von route ohne Parameter

route Server:

Code: Alles auswählen

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
arp -av Server:

Code: Alles auswählen

? (192.168.20.142) at 00:1e:64:27:4a:9c [ether] on wlan0
Entries: 1      Skipped: 0      Found: 1
route Client:

Code: Alles auswählen

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         gateway         0.0.0.0         UG    20600  0        0 wlp3s0
192.168.20.0    0.0.0.0         255.255.255.0   U     600    0        0 wlp3s0
arp -av Client:

Code: Alles auswählen

gateway (192.168.20.1) at ac:83:f3:31:f3:30 [ether] on wlp3s0
Entries: 1      Skipped: 0      Found: 1
Als Vergleich, wenn ich mich mit dem Client mit meiner Fritzbox verbinde kommt bei route:

Code: Alles auswählen

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         fritz.box       0.0.0.0         UG    600    0        0 wlp3s0
192.168.178.0   0.0.0.0         255.255.255.0   U     600    0        0 wlp3s0
Stimmt da vielleicht etwas nicht mit dem default gateway bei der AdHoc-Verbindung?

mat6937
Beiträge: 2927
Registriert: 09.12.2014 10:44:00

Re: DHCP-Server mit dnsmasq - Network unreachable

Beitrag von mat6937 » 13.09.2017 23:37:38

eddi0815 hat geschrieben: ↑ zum Beitrag ↑
13.09.2017 23:32:01
Den Parameter -a kennt route nicht, deshalb die Ausgabe von route ohne Parameter
Ja, mein Fehler, sollte:

Code: Alles auswählen

route -n
werden.
eddi0815 hat geschrieben: ↑ zum Beitrag ↑
13.09.2017 23:32:01
route Server:

Code: Alles auswählen

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
Konfiguriere auch auf dem Server eine definierte route in das Subnetz 192.168.20.0/24 mit dem richtigen Interface des Servers als gateway.

eddi0815
Beiträge: 5
Registriert: 13.09.2017 21:26:01

Re: DHCP-Server mit dnsmasq - Network unreachable

Beitrag von eddi0815 » 14.09.2017 10:59:29

Jo. Das wars.
Vielen Dank für deine Hilfe.

Antworten