{"id":2891,"date":"2023-07-17T18:47:35","date_gmt":"2023-07-17T16:47:35","guid":{"rendered":"http:\/\/fliegerhorst.dyndns.org\/?p=2891"},"modified":"2023-07-21T15:51:17","modified_gmt":"2023-07-21T13:51:17","slug":"dnsmasq","status":"publish","type":"post","link":"https:\/\/fliegerhorst.dyndns.org\/index.php\/2023\/07\/17\/dnsmasq\/","title":{"rendered":"dnsmasq"},"content":{"rendered":"\n<p>Der Server bedient ein externes Netz und ein internes Netzwerk. Bei jeder externen Kommunikation in denen Server nicht mit dessen IP-Addresse kontaktiert werden mu\u00df diese ermittelt werden. Dieser Service bietet der &#8222;Domain Name Service&#8220; (DNS).<br>Das Programm &#8218;dnsmask&#8216; leitet derartige Anfragen an einen DNS Server weiter und erwartet eine entsprechende Antwort.<\/p>\n\n\n\n<p>Neben den DNS Anfragen hat der Daemon &#8218;dnsmasq&#8216; noch eine weitere Aufgabe, denn er versorgt jedes Ger\u00e4t im internen Netz mit einer IP-Addresse aus dem IP-Adresspool.<\/p>\n\n\n\n<p>Die Installation erfolgt mit:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;liquibyte&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}\">root@fliegerhost:\/# apt install dnsmask<\/pre><\/div>\n\n\n\n<p>Nach der Installation befindet sich im Verzeichnis <code>\/etc<\/code> die Datei <code>dnsmasq.conf<\/code>. Die Konfigurationsdatei enth\u00e4lt etwa 100 Parameter von denen nach der Installation fast alle auskommentiert sind. Ich habe die Konfiguration wie folgt angepasst und hier auch nur die wenigen Parameter aufgef\u00fchrt die aktiviert sind:<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:66.66%\">\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;liquibyte&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}\"># Never forward addresses in the non-routed address spaces.\nbogus-priv<\/pre><\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.33%\">\n<p>Mit dieser Einstellung wird verhindert dass nicht routbare IP-Addressen &#8211; wie z.B. das Netz 192.168.0.0\/16 &#8211; nach au\u00dfen geroutet werden.<br>Diese Einstellung verhindert unn\u00f6tigen Netzwerkverkehr. <\/p>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:66.66%\">\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;liquibyte&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}\"># If you want dnsmasq to listen for DHCP and DNS requests only on\n# specified interfaces (and the loopback) give the name of the\n# interface (eg eth0) here.\n# Repeat the line for more than one interface.\ninterface=enp2s0<\/pre><\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.33%\">\n<p>Diese sehr wichtige Einstellung l\u00e4sst nur DHCP und auch DNS Anfragen aus dem internen Netzwerk zu. An meinem Ger\u00e4t ist das interne Netzwerk am Ethernetinterface <code>enp2s0<\/code> angeschlossen.<\/p>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:66.66%\">\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;liquibyte&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}\"># Uncomment this to enable the integrated DHCP server, you need\n# to supply the range of addresses available for lease and optionally\n# a lease time. If you have more than one network, you will need to\n# repeat this for each network on which you want to supply DHCP\n# service.\ndhcp-range=192.168.2.40,192.168.2.99,12h<\/pre><\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.33%\">\n<p>Mit dieser Einstellung wird der DHCP Server eingeschaltet so dass bei einer DHCP Anfrage eine IP-Addresse aus dem Netzwerkbereich <code>192.168.2.40 bis 192.168.2.99<\/code> mit einer G\u00fcltigkeit von <code>12<\/code> Stunden vergeben wird.<\/p>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:66.66%\">\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;liquibyte&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}\"># Always allocate the host with Ethernet address 11:22:33:44:55:66\n# The IP address 192.168.0.60\ndhcp-host=3C:2A:F4:C9:5A:4E,DruckerBrotherMFCL3750CDW,192.168.2.20,infinite\ndhcp-host=8C:3B:AD:B2:EF:D4,AccessPointBuero,192.168.2.10,infinite\ndhcp-host=00:1D:EC:02:EE:D8,VU-UNO,192.168.2.15,infinite\ndhcp-host=30:B5:C2:82:5C:D0,Repeater,192.168.2.39,infinite\ndhcp-host=4C:60:DE:65:43:63,WLAN2ETH-Fernseher,192.168.2.33,infinite\ndhcp-host=00:1A:22:0A:52:B4,Homematic-CCU2,192.168.2.35,infinite<\/pre><\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.33%\">\n<p>Manchmal m\u00f6chte man aber dass einige spezielle Ger\u00e4te f\u00fcr immer und ewig eine spezielle feste IP-Adresse bekommen sollen. Dies kann unter Umst\u00e4nden notwendig sein wenn wenn Verbindungen von extern zum Ger\u00e4t aufgebaut werden sollen und man nicht jedesmal die IP-Adresse herausfinden m\u00f6chte. Wie man sieht gilt dies insbesondere f\u00fcr Drucker, WLAN-Accesspoints aber auch f\u00fcr Videorecorder.<\/p>\n<\/div>\n<\/div>\n\n\n\n<p>Das war es auch schon mit der Konfiguration. Wenn man nun den <code>dnsmasq<\/code> Daemon per&#8230;<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;liquibyte&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}\">root@fliegerhost:\/# service dnsmask restart<\/pre><\/div>\n\n\n\n<p>&#8230;neu startet, dann wartet der Daemon artig auf DHCP-Anfragen auf dem internen Interface.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Der Server bedient ein externes Netz und ein internes Netzwerk. Bei jeder externen Kommunikation in denen Server nicht mit dessen IP-Addresse kontaktiert werden mu\u00df diese ermittelt werden. Dieser Service bietet der &#8222;Domain Name Service&#8220; (DNS).Das Programm &#8218;dnsmask&#8216; leitet derartige Anfragen an einen DNS Server weiter und erwartet eine entsprechende Antwort. Neben den DNS Anfragen hat[&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3036,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"zakra_general_container_width":0,"zakra_general_content_width":0,"zakra_general_sidebar_width":0,"zakra_sticky_header":"customizer","zakra_header_main_area":true,"zakra_site_logo_width":0,"zakra_header_top_enabled":"customizer","zakra_header_top_style":"customizer","zakra_primary_menu_item_style":"customizer","zakra_page_header_text_color":"","zakra_page_header_layout":"customizer","zakra_page_title_bg":"","zakra_footer_widgets_bg_image":0,"zakra_page_title_bg_repeat":"customizer","zakra_page_title_bg_position":"customizer","zakra_page_title_bg_size":"customizer","zakra_page_title_bg_attachment":"customizer","zakra_breadcrumbs_enabled":"customizer","zakra_breadcrumbs_text_color":"","zakra_breadcrumbs_separator_color":"","zakra_breadcrumbs_link_color":"","zakra_breadcrumbs_link_hover_color":"","zakra_page_title_bg_image":0,"zakra_footer_widgets_enabled":"customizer","zakra_footer_column_layout_1_style":"customizer","zakra_footer_widgets_bg":"","zakra_footer_widgets_bg_repeat":"customizer","zakra_footer_widgets_bg_position":"customizer","zakra_footer_widgets_bg_size":"customizer","zakra_footer_widgets_bg_attachment":"customizer","zakra_footer_bar_enabled":"customizer","zakra_footer_bar_style":"customizer","zakra_page_container_layout":"customizer","zakra_page_sidebar_layout":"customizer","zakra_remove_content_margin":false,"zakra_sidebar":"customizer","zakra_transparent_header":"customizer","zakra_logo":0,"zakra_main_header_style":"default","zakra_menu_item_color":"","zakra_menu_item_hover_color":"","zakra_menu_item_active_color":"","zakra_menu_active_style":"","zakra_page_header":true,"ngg_post_thumbnail":0,"footnotes":""},"categories":[1],"tags":[13],"class_list":["post-2891","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-linux"],"_links":{"self":[{"href":"https:\/\/fliegerhorst.dyndns.org\/index.php\/wp-json\/wp\/v2\/posts\/2891","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fliegerhorst.dyndns.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fliegerhorst.dyndns.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fliegerhorst.dyndns.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fliegerhorst.dyndns.org\/index.php\/wp-json\/wp\/v2\/comments?post=2891"}],"version-history":[{"count":0,"href":"https:\/\/fliegerhorst.dyndns.org\/index.php\/wp-json\/wp\/v2\/posts\/2891\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fliegerhorst.dyndns.org\/index.php\/wp-json\/wp\/v2\/media\/3036"}],"wp:attachment":[{"href":"https:\/\/fliegerhorst.dyndns.org\/index.php\/wp-json\/wp\/v2\/media?parent=2891"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fliegerhorst.dyndns.org\/index.php\/wp-json\/wp\/v2\/categories?post=2891"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fliegerhorst.dyndns.org\/index.php\/wp-json\/wp\/v2\/tags?post=2891"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}