네트워킹에 대해 배우려고 합니다. 특히 현재 기본 라우터에 연결된 NAT 뒤에서 실행되는 개인 네트워크를 만들려고 합니다.
내 생각은 다음과 같습니다.
+---------------------------------------------------+
|10.0.0.0/24 |
| +-------+ |
+------+---------------------------+ |Switch | +-----+ |
|Raspberry Pi | | +---+ | |
| | | | +-----+ |
| eth1+---+ | |
+-----------------+ | 10.0.0.1| | | |
|Router | | | | | +-----+ |
|192.168.100.1 +---+eth0 dnsmasq settings| | +---+ | |
+---+dhcp: | |192.168.100.5 range: 10.0.0.2/24| | | +-----+ |
|192.168.100.2/24 | | gateway: 10.0.0.1| +-------+ |
| | | | |
+-----+------+----+ +------+---------------------------+ |
| | | |
| | +---------------------------------------------------+
| |
| +------------------------------------+ Other devices
|
| +---------------+
| |pi-hole |
+-------+192.168.100.3 |
| |
+---------------+
이제 Raspberry Pi를 올바르게 설정한 것 같습니다. 구성은 다음과 같습니다.
/etc/dnsmasq.conf
domain=local.pi
local=/local.pi/
no-hosts
addn-hosts=/etc/hosts.d
localise-queries
no-poll
no-resolv
cache-size=10000
log-async
log-queries=extra
log-facility=/var/log/dnsmasq/dnsmasq.log
local-ttl=2
server=192.168.100.3
server=9.9.9.9
domain-needed
bogus-priv
interface=eth1
dhcp-authoritative
dhcp-range=10.0.0.2,10.0.0.254,1h
dhcp-option=option:router,10.0.0.1
dhcp-leasefile=/etc/dhcp.leases
그러나 로그에 표시된 것처럼 dnsmasq는 IP 주소를 배포하지 않는 것 같습니다.
Sep 30 22:37:25 dnsmasq[3296]: started, version 2.76 cachesize 10000
Sep 30 22:37:25 dnsmasq[3296]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify
Sep 30 22:37:25 dnsmasq-dhcp[3296]: DHCP, IP range 10.0.0.2 -- 10.0.0.254, lease time 1h
Sep 30 22:37:25 dnsmasq[3296]: using nameserver 9.9.9.9#53
Sep 30 22:37:25 dnsmasq[3296]: using nameserver 192.168.100.3#53
Sep 30 22:37:25 dnsmasq[3296]: using local addresses only for domain local.pi
Sep 30 22:37:33 dnsmasq-dhcp[3296]: no address range available for DHCP request via eth1
클라이언트가 IP를 요청할 때 마지막 메시지가 반복됩니다. 다음은 tcpdump의 출력입니다.
# tcpdump -v
tcpdump: listening on eth1, link-type EN10MB (Ethernet), capture size 262144 bytes
23:14:53.372604 IP (tos 0x0, ttl 64, id 17534, offset 0, flags [none], proto UDP (17), length 384)
0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from b8:27:eb:64:2b:f2 (oui Unknown), length 356, xid 0x37bc3a64, secs 11906, Flags [none]
Client-Ethernet-Address b8:27:eb:64:2b:f2 (oui Unknown)
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Discover
Client-ID Option 61, length 7: ether b8:27:eb:64:2b:f2
SLP-NA Option 80, length 0""
NOAUTO Option 116, length 1: Y
MSZ Option 57, length 2: 1472
Vendor-Class Option 60, length 56: "dhcpcd-6.11.5:Linux-4.14.34-hypriotos-v7+:armv7l:BCM2835"
Hostname Option 12, length 14: "test-client"
T145 Option 145, length 1: 1
Parameter-Request Option 55, length 15:
Subnet-Mask, Classless-Static-Route, Static-Route, Default-Gateway
Domain-Name-Server, Hostname, Domain-Name, MTU
BR, NTP, Lease-Time, Server-ID
RN, RB, Option 119
23:15:07.057241 IP (tos 0x0, ttl 64, id 26091, offset 0, flags [none], proto UDP (17), length 384)
0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 00:e0:4c:23:c2:22 (oui Unknown), length 356, xid 0x1b0502bb, secs 8250, Flags [none]
Client-Ethernet-Address 00:e0:4c:23:c2:22 (oui Unknown)
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Discover
Client-ID Option 61, length 7: ether 00:e0:4c:23:c2:22
SLP-NA Option 80, length 0""
NOAUTO Option 116, length 1: Y
MSZ Option 57, length 2: 1472
Vendor-Class Option 60, length 56: "dhcpcd-6.11.5:Linux-4.14.34-hypriotos-v7+:armv7l:BCM2835"
Hostname Option 12, length 14: "gateway"
T145 Option 145, length 1: 1
Parameter-Request Option 55, length 15:
Subnet-Mask, Classless-Static-Route, Static-Route, Default-Gateway
Domain-Name-Server, Hostname, Domain-Name, MTU
BR, NTP, Lease-Time, Server-ID
RN, RB, Option 119#
^C
2 packets captured
2 packets received by filter
0 packets dropped by kernel
내가 무엇을 놓치고 있나요? 궁극적인 목표는 10.0.0.0/24 범위 내의 모든 네트워크가 NAT를 통해 나머지 인터넷에 연결되는 것입니다.