{"id":8920,"date":"2013-08-12T21:01:27","date_gmt":"2013-08-12T12:01:27","guid":{"rendered":"http:\/\/oichinote.com\/plus\/?p=8920"},"modified":"2016-06-04T11:09:57","modified_gmt":"2016-06-04T02:09:57","slug":"setting-dnsmasq-on-freebsd","status":"publish","type":"post","link":"https:\/\/oichinote.com\/plus\/2013\/08\/setting-dnsmasq-on-freebsd.html","title":{"rendered":"FreeBSD\u306bDNSMASQ\u3092\u8a2d\u5b9a\u3059\u308b"},"content":{"rendered":"<p>NAS\u7528\u3068\u3057\u3066\u7d44\u307f\u4e0a\u3052\u305fFreeBSD\u6a5f\u306f\u3001\u5bb6\u5ead\u5185\u30b5\u30fc\u30d0\u3068\u3057\u3066\u3082\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u3001\u6291\u3048\u3066\u304a\u304d\u305f\u3044\u306e\u306f\u3001\u5bb6\u5ead\u5185DNS\u30b5\u30fc\u30d0\u3067\u3059\u3002QNAP\u3092\u4f7f\u3063\u3066\u3044\u308b\u6642\u306b\u77e5\u3063\u305fDNSMASQ\u3068\u8a00\u3046\u30bd\u30d5\u30c8\u304c\u4f7f\u3044\u6613\u305d\u3046\u3067\u3059\u3002<\/p>\n<p>DNSMASQ\u3068\u306f\u3001DHCP\u30b5\u30fc\u30d0\u6a5f\u80fd\u3068DNS\u30b5\u30fc\u30d0\u6a5f\u80fd\u3092\u4f75\u305b\u6301\u3063\u305f\u30bd\u30d5\u30c8\u3067\u3059\u3002DHCP\u3067\u30a2\u30c9\u30ec\u30b9\u3092\u914d\u5e03\u3059\u308b\u969b\u3001MAC\u30a2\u30c9\u30ec\u30b9\u306b\u5bfe\u5fdc\u3057\u305fIP\u30a2\u30c9\u30ec\u30b9\u3068\u30db\u30b9\u30c8\u540d\u3092\u5272\u308a\u4ed8\u3051\u308b\u306e\u3067\u3001DHCP\u3067\u3042\u308a\u3064\u3064\u3001\u56fa\u5b9aIP\u306e\u69d8\u306a\u4f7f\u3044\u65b9\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u672c\u5f53\u306b\u56fa\u5b9aIP\u3092\u4f7f\u3044\u305f\u3044\u6642\u306f\u3001\/etc\/host(\u7b49)\u306b\u66f8\u3044\u305f\u30a2\u30c9\u30ec\u30b9\u3092\u53c2\u7167\u3055\u305b\u308b\u4e8b\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u624b\u9806\u306f\u3001\u6b21\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<ol>\n<li>DNSMASQ\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/li>\n<li>DNSMASQ\u8a2d\u5b9a<\/li>\n<li>\u8d77\u52d5&amp;\u30c6\u30b9\u30c8<\/li>\n<li>\/etc\/rc.conf\u306b\u8a18\u8ff0<\/li>\n<\/ol>\n<h3>1. DNSMASQ\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n<p>\u30dd\u30fc\u30c8\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre>$ cd \/usr\/port\/dns\/dnsmasq\r\n$ sudo make config-recursive\r\n$ sudo make install clean<\/pre>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb(\u30d3\u30eb\u30c9)\u81ea\u4f53\u306f\u3001\u7c21\u5358\u306b\u7d42\u4e86\u3057\u307e\u3059\u3002<\/p>\n<h3>2. DNSMASQ\u8a2d\u5b9a<\/h3>\n<p>\u809d\u3067\u3059\u3002\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u4fee\u6b63\u3057\u307e\u3059\u3002<\/p>\n<pre>$ sudo vi \/usr\/local\/etc\/dnsmasq.conf\r\n<\/pre>\n<p>\u4ee5\u4e0b\u306e\u4f8b\u306f\u3001\u6b21\u306e\u8a2d\u5b9a\u306e\u5834\u5408\u3067\u3059\u3002<\/p>\n<ul>\n<li>\u30c9\u30e1\u30a4\u30f3\u540d:local.example.com<\/li>\n<li>\u30b5\u30d6\u30cd\u30c3\u30c8:192.168.0.xx<\/li>\n<li>\u30cd\u30fc\u30e0\u30b5\u30fc\u30d0:192.168.0.1<\/li>\n<li>\u30b2\u30fc\u30c8\u30a6\u30a7\u30a4:192.168.0.254<\/li>\n<li>\u30af\u30e9\u30a4\u30a2\u30f3\u30c81:192.168.0.2(mac, MAC\u30a2\u30c9\u30ec\u30b9\u306f00:00:00:00:00:00)<\/li>\n<li>\u30af\u30e9\u30a4\u30a2\u30f3\u30c82:192.168.0.3(win, MAC\u30a2\u30c9\u30ec\u30b9\u306f00:00:00:00:00:01)<\/li>\n<\/ul>\n<pre class=\"hljs\"><code> |domain-needed # Never forward plain names (without a dot or domain part)\r\n |expand-hosts # Add the domain to simple names (without a period) in \/etc\/hosts in the\r\n |# same way as for DHCP-derived names.\r\n |bogus-priv # Never forward addresses in the non-routed address spaces.\r\n |filterwin2k # Uncomment this to filter useless windows-originated DNS requests\r\n |clear-on-reload # Whenever \/etc\/resolv.conf is re-read, clear the DNS cache.\r\n*|domain=local.example.com # Set the domain for dnsmasq.\r\n |cache-size=1000 # Set the size of dnsmasq&#039;s cache. The default is 150 names.\r\n |local-ttl=600\r\n |neg-ttl=600\r\n |localmx\r\n*|local=\/local.example.com\/ # Add local-only domains here, queries in these domains are answered\r\n |# from \/etc\/hosts or DHCP only.\r\n |\r\n*|dhcp-range=192.168.0.2,192.168.0.159,24h # dhcp range, 24 hour lease\r\n |dhcp-option=vendor:MSFT,2,1i # Send microsoft-specific option to tell windows to release the DHCP lease\r\n |# when it shuts down.\r\n |dhcp-authoritative # Set the DHCP server to authoritative mode. In this mode it will barge in\r\n |# and take over the lease for any client which broadcasts on the network,\r\n |# whether it has a record of the lease or not.\r\n*|dhcp-option=option:router,192.168.0.254 # set router address (3)\r\n*|dhcp-option=option:dns-server,192.168.0.1 # set dns server address (6)\r\n*|dhcp-option=option:domain-name,local.exapmple.com # set domain name (15)\r\n |dhcp-option=option:netbios-nodetype,1 # netbios node type (46)\r\n |# 1 B-node: Broadcast - no WINS\r\n |# 2 P-node: Peer - WINS only.\r\n |# 4 M-node: Mixed - broadcast, then WINS\r\n |# 8 H-node: Hybrid - WINS, then broadcast\r\n*|dhcp-host=00:00:00:00:00:00,192.168.0.2,mac # Mac\r\n*|dhcp-host=00:00:00:00:00:01,192.168.0.3,win # Windows\r\n |\r\n |log-facility=\/var\/log\/dnsmasq.log\r\n |log-queries\r\n |log-dhcp\r\n<\/code><\/pre>\n<p>\u30dd\u30a4\u30f3\u30c8\u306f\u3001\u6b21\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<ul>\n<li>\u30c9\u30e1\u30a4\u30f3\u540d\u306e\u6307\u5b9a<\/li>\n<li>\u914d\u5e03\u3059\u308bIP\u30a2\u30c9\u30ec\u30b9\u7bc4\u56f2\u306e\u6307\u5b9a<\/li>\n<li>\u30cd\u30fc\u30e0\u30b5\u30fc\u30d0\u3001\u30b2\u30fc\u30c8\u30a6\u30a7\u30a4\u30a2\u30c9\u30ec\u30b9\u306e\u6307\u5b9a<\/li>\n<li>MAC\u30a2\u30c9\u30ec\u30b9\u3001IP\u30a2\u30c9\u30ec\u30b9\u3001\u30db\u30b9\u30c8\u540d\u306e\u5bfe\u5fdc\u8868<\/li>\n<\/ul>\n<p>\u305d\u3057\u3066\u3001\/etc\/hosts\u306b\u306f\u3001\u6b21\u306e\u5185\u5bb9\u3092\u8a18\u8ff0\u3057\u3066\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre>$ sudo vi \/etc\/hosts\r\n<\/pre>\n<pre class=\"hljs\"><code>127.0.0.1 localhost localhost.local.example.com\r\n192.168.0.1 freebsd.local.example.com freebsd\r\n192.168.0.254 gw.local.example.com gw\r\n<\/code><\/pre>\n<h3>3. \u8d77\u52d5&amp;\u30c6\u30b9\u30c8<\/h3>\n<p>\u6b21\u306e\u901a\u308a\u3001\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n<pre>$ sudo \/usr\/local\/etc\/rc.d\/dnsmasq start\r\n<\/pre>\n<p>\u78ba\u8a8d\u9805\u76ee\u306f\u3001\u6b21\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<ul>\n<li>\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306eIP\u30a2\u30c9\u30ec\u30b9\u304c\u6b63\u3057\u3044\u304b\u3069\u3046\u304b?<\/li>\n<li>\u5272\u308a\u5f53\u3066\u3089\u308c\u305f\u30c9\u30e1\u30a4\u30f3\u540d\u304c\u6b63\u3057\u3044\u304b\u3069\u3046\u304b?<\/li>\n<li>\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306e\u30cd\u30fc\u30e0\u30b5\u30fc\u30d0\u3001\u30b2\u30fc\u30c8\u30a6\u30a7\u30a4\u304c\u6b63\u3057\u3044\u304b\u3069\u3046\u304b?<\/li>\n<\/ul>\n<p>\/var\/log\/dnsmasq.log\u306b\u30ed\u30b0\u304c\u6b8b\u3063\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u3053\u3061\u3089\u3082\u3054\u78ba\u8a8d\u304f\u3060\u3055\u3044\u3002<\/p>\n<h3>4. \/etc\/rc.conf\u306b\u8a18\u8ff0<\/h3>\n<pre>$ sudo vi \/etc\/rc.conf\r\n<\/pre>\n<p>\u8a18\u8ff0\u3059\u308b\u5185\u5bb9\u306f\u3001\u6b21\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<pre class=\"hljs\"><code>dnsmasq_enable=&quot;YES&quot;\r\n<\/code><\/pre>\n<h3>\u53c2\u8003\u306b\u3057\u305f\u6240<\/h3>\n<ul>\n<li><a href=\"http:\/\/blog.livedoor.jp\/hkoie\/archives\/51186460.html\" target=\"_blank\">koie blog : dnsmasq + natd on FreeBSD<\/a><\/li>\n<\/ul>\n<p>\u4ed6\u306b\u3082\u3001QNAP\u306e\u30d5\u30a9\u30fc\u30e9\u30e0\u304b\u3069\u3053\u304b\u3067\u3001\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3057\u3066\u3044\u308b\u306e\u3092\u8aad\u3093\u3067\u3044\u308b\u306e\u3067\u3059\u304c\u3001\u898b\u3064\u3051\u3089\u308c\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n[amazonjs asin=\"B00GIF7SOW\" locale=\"JP\"]\n","protected":false},"excerpt":{"rendered":"<p>NAS\u7528\u3068\u3057\u3066\u7d44\u307f\u4e0a\u3052\u305fFreeBSD\u6a5f\u306f\u3001\u5bb6\u5ead\u5185\u30b5\u30fc\u30d0\u3068\u3057\u3066\u3082\u4f7f\u3044\u307e\u3059\u3002 \u307e\u305a\u3001\u6291\u3048\u3066\u304a\u304d\u305f\u3044\u306e\u306f\u3001\u5bb6\u5ead\u5185DNS\u30b5\u30fc\u30d0\u3067\u3059\u3002QNAP\u3092\u4f7f\u3063\u3066\u3044\u308b\u6642\u306b\u77e5\u3063\u305fDNSMASQ\u3068\u8a00\u3046\u30bd\u30d5\u30c8\u304c\u4f7f\u3044\u6613\u305d\u3046\u3067\u3059\u3002 DNSMASQ\u3068\u306f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"\u65b0\u3057\u3044\u8a18\u4e8b\u300eFreeBSD\u306bDNSMASQ\u3092\u8a2d\u5b9a\u3059\u308b\u300f\u3092\u6295\u7a3f\u3057\u307e\u3057\u305f\u3002\u8aad\u3093\u3067\u3044\u305f\u3060\u3051\u308b\u3068\u5b09\u3057\u3044\u3067\u3059\u3002","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[32,34,59,5],"tags":[],"class_list":["post-8920","post","type-post","status-publish","format-standard","hentry","category-ipad-ipod-iphone","category-mac","category-nas","category-computer"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":2275,"url":"https:\/\/oichinote.com\/plus\/2012\/03\/os-x-liondnswor.html","url_meta":{"origin":8920,"position":0},"title":"OS X Lion\u3092DNS\u30b5\u30fc\u30d0\u306b\u3057\u3066WordPress\u306e\u30de\u30eb\u30c1\u30b5\u30a4\u30c8\u306e\u5b9f\u9a13\u3092\u3057\u307e\u3057\u305f(2\/2)","author":"\u304a\u5e02\u306e\u304b\u305f","date":"2012\u5e743\u670827\u65e5","format":false,"excerpt":"WordPress\u306e\u30de\u30eb\u30c1\u30b5\u30a4\u30c8(\u30b5\u30d6\u30c9\u30e1\u30a4\u30f3\u5f62\u5f0f)\u3092\u5b9f\u9a13\u3057\u3088\u3046\u3068\u3059\u308b\u3068\u3001\u30b5\u30d6\u30c9\u30e1\u30a4\u30f3\u540d\u3067WordP\u2026","rel":"","context":"Mac","block_context":{"text":"Mac","link":"https:\/\/oichinote.com\/plus\/category\/mac"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":6054,"url":"https:\/\/oichinote.com\/plus\/2013\/04\/l2tp-vpn-server-in-freebsd-9-1.html","url_meta":{"origin":8920,"position":1},"title":"FreeBSD 9.1\u3092IPsec\u5bfe\u5fdcL2TP VPN\u30b5\u30fc\u30d0\u306b\u3059\u308b","author":"\u304a\u5e02\u306e\u304b\u305f","date":"2013\u5e744\u670827\u65e5","format":false,"excerpt":"\u4e00\u5fdc\u3001\u6b21\u306e\u8a2d\u5b9a\u3067\u5916\u51fa\u5148\u304b\u3089\u81ea\u5b85\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306b\u3001VPN\u63a5\u7d9a\u3067\u304d\u3066\u3044\u307e\u3059\u3002 \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u7248Mac\u3092VPN\u2026","rel":"","context":"FreeBSD","block_context":{"text":"FreeBSD","link":"https:\/\/oichinote.com\/plus\/category\/freebsd"},"img":{"alt_text":"\u30cd\u30c3\u30c8\u30ef\u30fc\u30af","src":"https:\/\/i0.wp.com\/oichinote.com\/plus\/files\/2015\/10\/20151014gatag-00000078.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":20639,"url":"https:\/\/oichinote.com\/plus\/2017\/06\/accress-vccw-from-network.html","url_meta":{"origin":8920,"position":2},"title":"VCCW\u3092\u540c\u3058\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u5185\u306e\u4ed6\u306ePC\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b","author":"\u304a\u5e02\u306e\u304b\u305f","date":"2017\u5e746\u670824\u65e5","format":false,"excerpt":"FreeBSD\u4e0a\u3067VirtualBox+Vargrant+VCCW\u3067WordPress\u3092\u52d5\u304b\u3057\u307e\u3057\u305f\u2026","rel":"","context":"FreeBSD","block_context":{"text":"FreeBSD","link":"https:\/\/oichinote.com\/plus\/category\/freebsd"},"img":{"alt_text":"Safari\u304b\u3089\u30a2\u30af\u30bb\u30b9","src":"https:\/\/i0.wp.com\/oichinote.com\/plus\/files\/2017\/06\/20170624vccw-on-freebsd-via-safari.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":19708,"url":"https:\/\/oichinote.com\/plus\/2017\/03\/netatalk-and-samba46-collaboration.html","url_meta":{"origin":8920,"position":3},"title":"git\u7248samba46\u3092\u4f7f\u3063\u3066\u3001Netatalk\u3068Samba\u3092\u5171\u5b58","author":"\u304a\u5e02\u306e\u304b\u305f","date":"2017\u5e743\u670820\u65e5","format":false,"excerpt":"FreeBSD11\u306esamba44\u3067Netatalk\u3068Samba\u306e\u5171\u5b58\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002 \u3067\u2026","rel":"","context":"FreeBSD","block_context":{"text":"FreeBSD","link":"https:\/\/oichinote.com\/plus\/category\/freebsd"},"img":{"alt_text":"Samba46","src":"https:\/\/i0.wp.com\/oichinote.com\/plus\/files\/2017\/03\/20170320samba46.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1578,"url":"https:\/\/oichinote.com\/plus\/2010\/05\/ubuntu-910leopa.html","url_meta":{"origin":8920,"position":4},"title":"Ubuntu 9.10\u306e\u30c7\u30a3\u30b9\u30af\u3092Leopard\u3067NFS\u30de\u30a6\u30f3\u30c8\u3059\u308b[\u8ffd\u8a18\u30fb\u8a02\u6b63\u3042\u308a]","author":"\u304a\u5e02\u306e\u304b\u305f","date":"2010\u5e745\u67083\u65e5","format":false,"excerpt":"PowerMac G4\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305fUbuntu 9.10\u306e\u30c7\u30a3\u30b9\u30af\u3092\u3001\u5225\u306e\u30db\u30b9\u30c8\u306eMac OS\u2026","rel":"","context":"Mac","block_context":{"text":"Mac","link":"https:\/\/oichinote.com\/plus\/category\/mac"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1589,"url":"https:\/\/oichinote.com\/plus\/2010\/05\/leopardwebdavdi.html","url_meta":{"origin":8920,"position":5},"title":"Leopard\u3092WebDAV\u30b5\u30fc\u30d0\u306b\u3059\u308b(Digest\u8a8d\u8a3c\u5bfe\u5fdc)[\u8a02\u6b63\u3042\u308a]","author":"\u304a\u5e02\u306e\u304b\u305f","date":"2010\u5e745\u670814\u65e5","format":false,"excerpt":"\u66ab\u5b9a\u7684\u306a\u306e\u3067\u3059\u3051\u308c\u3069\u3001Mac OS X 10.5.8 Leopard\u3092WebDAV\u30b5\u30fc\u30d0\u306b\u3059\u308b\u4e8b\u304c\u3067\u2026","rel":"","context":"\u30d1\u30bd\u30b3\u30f3\u30fb\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8","block_context":{"text":"\u30d1\u30bd\u30b3\u30f3\u30fb\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8","link":"https:\/\/oichinote.com\/plus\/category\/computer"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/oichinote.com\/plus\/wp-json\/wp\/v2\/posts\/8920","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oichinote.com\/plus\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oichinote.com\/plus\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oichinote.com\/plus\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oichinote.com\/plus\/wp-json\/wp\/v2\/comments?post=8920"}],"version-history":[{"count":20,"href":"https:\/\/oichinote.com\/plus\/wp-json\/wp\/v2\/posts\/8920\/revisions"}],"predecessor-version":[{"id":17946,"href":"https:\/\/oichinote.com\/plus\/wp-json\/wp\/v2\/posts\/8920\/revisions\/17946"}],"wp:attachment":[{"href":"https:\/\/oichinote.com\/plus\/wp-json\/wp\/v2\/media?parent=8920"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oichinote.com\/plus\/wp-json\/wp\/v2\/categories?post=8920"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oichinote.com\/plus\/wp-json\/wp\/v2\/tags?post=8920"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}