This commit is contained in:
Twoje Imię Nazwisko 2025-05-27 08:35:26 +02:00
parent c1a90490c5
commit bb3413d4e2
4 changed files with 139 additions and 15 deletions

View File

@ -16,4 +16,10 @@
\@writefile{toc}{\contentsline {subsection}{\numberline {3.10}Testing the Configuration}{5}{}\protected@file@percent } \@writefile{toc}{\contentsline {subsection}{\numberline {3.10}Testing the Configuration}{5}{}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {4}Troubleshooting}{5}{}\protected@file@percent } \@writefile{toc}{\contentsline {section}{\numberline {4}Troubleshooting}{5}{}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {5}Conclusion}{6}{}\protected@file@percent } \@writefile{toc}{\contentsline {section}{\numberline {5}Conclusion}{6}{}\protected@file@percent }
\gdef \@abspage@last{6} \@writefile{toc}{\contentsline {section}{\numberline {A}Test Topology Dynamic\ IP Variant}{6}{}\protected@file@percent }
\newlabel{sec:topo-dhcp}{{A}{6}{}{section.1}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {A.1}Logical view}{6}{}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {A.2}Key differences from the static-IP variant}{6}{}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {A.3}Quick test matrix}{7}{}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {A.4}Uwagi}{7}{}\protected@file@percent }
\gdef \@abspage@last{7}

View File

@ -1,8 +1,8 @@
This is pdfTeX, Version 3.141592653-2.6-1.40.26 (TeX Live 2025/dev/Debian) (preloaded format=pdflatex 2025.5.15) 15 MAY 2025 11:32 This is pdfTeX, Version 3.141592653-2.6-1.40.26 (TeX Live 2025/dev/Debian) (preloaded format=pdflatex 2025.5.15) 27 MAY 2025 08:35
entering extended mode entering extended mode
restricted \write18 enabled. restricted \write18 enabled.
%&-line parsing enabled. %&-line parsing enabled.
**main.tex **main
(./main.tex (./main.tex
LaTeX2e <2024-11-01> patch level 2 LaTeX2e <2024-11-01> patch level 2
L3 programming layer <2025-01-18> L3 programming layer <2025-01-18>
@ -316,29 +316,62 @@ ents (from 192.168.1.100 to 192.168.1.200,
[5] [5]
[6] (./main.aux) ! LaTeX Error: \begin{document} ended by \end{verbatim}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.296 \end{verbatim}
?
! Extra \endgroup.
\end ...end#1\endcsname \@checkend {#1}\endgroup
\UseHook {env/#1/after}\if...
l.296 \end{verbatim}
?
LaTeX Font Info: Font shape `T1/lmtt/bx/n' in size <12> not available
(Font) Font shape `T1/lmtt/b/n' tried instead on input line 300.
[6]
LaTeX Font Info: External font `lmex10' loaded for size
(Font) <12> on input line 335.
LaTeX Font Info: External font `lmex10' loaded for size
(Font) <8> on input line 335.
LaTeX Font Info: External font `lmex10' loaded for size
(Font) <6> on input line 335.
[7] (./main.aux)
*********** ***********
LaTeX2e <2024-11-01> patch level 2 LaTeX2e <2024-11-01> patch level 2
L3 programming layer <2025-01-18> L3 programming layer <2025-01-18>
*********** ***********
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
) )
Here is how much of TeX's memory you used: Here is how much of TeX's memory you used:
5150 strings out of 475178 5182 strings out of 475178
74333 string characters out of 5766539 74732 string characters out of 5766539
825811 words of memory out of 5000000 825820 words of memory out of 5000000
28102 multiletter control sequences out of 15000+600000 28127 multiletter control sequences out of 15000+600000
599267 words of font info for 61 fonts, out of 8000000 for 9000 614648 words of font info for 72 fonts, out of 8000000 for 9000
14 hyphenation exceptions out of 8191 14 hyphenation exceptions out of 8191
57i,6n,65p,497b,1620s stack positions out of 10000i,1000n,20000p,200000b,200000s 57i,7n,65p,493b,1620s stack positions out of 10000i,1000n,20000p,200000b,200000s
</usr/share/texmf/fonts/type1/public/lm/lmbx12.pfb></usr/share/texmf/fonts/ty </usr/share/texmf/fonts/type1/public/lm/lmbx12.pfb></usr/share/texmf/fonts/ty
pe1/public/lm/lmr12.pfb></usr/share/texmf/fonts/type1/public/lm/lmr17.pfb></usr pe1/public/lm/lmr12.pfb></usr/share/texmf/fonts/type1/public/lm/lmr17.pfb></usr
/share/texmf/fonts/type1/public/lm/lmr6.pfb></usr/share/texmf/fonts/type1/publi /share/texmf/fonts/type1/public/lm/lmr6.pfb></usr/share/texmf/fonts/type1/publi
c/lm/lmtk10.pfb></usr/share/texmf/fonts/type1/public/lm/lmtt10.pfb></usr/share/ c/lm/lmri12.pfb></usr/share/texmf/fonts/type1/public/lm/lmtk10.pfb></usr/share/
texmf/fonts/type1/public/lm/lmtt12.pfb> texmf/fonts/type1/public/lm/lmtt10.pfb></usr/share/texmf/fonts/type1/public/lm/
Output written on main.pdf (6 pages, 206192 bytes). lmtt12.pfb>
Output written on main.pdf (7 pages, 232455 bytes).
PDF statistics: PDF statistics:
63 PDF objects out of 1000 (max. 8388607) 73 PDF objects out of 1000 (max. 8388607)
39 compressed objects within 1 object stream 46 compressed objects within 1 object stream
0 named destinations out of 1000 (max. 500000) 0 named destinations out of 1000 (max. 500000)
1 words of extra memory for PDF output out of 10000 (max. 10000000) 1 words of extra memory for PDF output out of 10000 (max. 10000000)

Binary file not shown.

View File

@ -268,4 +268,89 @@ If \texttt{dnsmasq} fails to start:
\section{Conclusion} \section{Conclusion}
This guide configures \texttt{dnsmasq} as a DNS and DHCP server in an Incus container on Debian. The \texttt{link.py} script and Netplan configuration ensure a robust network setup with veth pairs and static IP addressing. For advanced configurations, refer to the \texttt{dnsmasq} documentation (\texttt{man dnsmasq}) and \texttt{pyroute2} documentation. This guide configures \texttt{dnsmasq} as a DNS and DHCP server in an Incus container on Debian. The \texttt{link.py} script and Netplan configuration ensure a robust network setup with veth pairs and static IP addressing. For advanced configurations, refer to the \texttt{dnsmasq} documentation (\texttt{man dnsmasq}) and \texttt{pyroute2} documentation.
\appendix
\section{Test Topology Dynamic\ IP Variant}
\label{sec:topo-dhcp}
\subsection{Logical view}
\begin{verbatim}
+------------------+
| Laptop / PC |
| (browser) |
| DHCP client |
+--------+---------+
| (br0 10.10.10.0/24)
---------- ns1 (host) ---+-------------------------------
br0 (DHCP) |
|
+-----------------+-------------------+
| |
+-------+--------+ +------+-------+
| dnsmasq-ct | | web-ct |
| 10.10.10.2/24 | | DHCP client |
| DHCP + DNS | | :1111/tcp |
+----------------+ +--------------+
\end{verbatim}
\end{verbatim}
\subsection{Key differences from the static-IP variant}
\begin{itemize}
\item \textbf{Host bridge \texttt{br0}}
\begin{itemize}
\item Utwórz most, ale \emph{nie} przypisuj mu ręcznie adresu:
\begin{lstlisting}[language=bash]
sudo ip link add name br0 type bridge
sudo ip link set br0 up
sudo dhclient -v br0 # pobiera lease od dnsmasq-ct
\end{lstlisting}
\end{itemize}
\item \textbf{\texttt{dnsmasq.conf}} (w dnsmasq-ct)
Bez zmian poza tym, że opcja \texttt{dhcp-option 3} (gateway) wskazuje teraz
na \textit{aktualny} adres hosta br0, nadany dynamicznie. Najprostsze
rozwiązanie w labie: pozostaw ten wiersz pominięty — wszystkie testowe
maszyny działają wewnątrz jednej podsieci i nie muszą wychodzić na świat.
\item \textbf{web-ct Netplan}
Usuń plik \texttt{/etc/netplan/00-static.yaml} i zostaw domyślną konfigurację
\texttt{dhcp4: yes}:
\begin{lstlisting}[language=bash]
incus exec web-ct -- rm /etc/netplan/00-static.yaml
incus exec web-ct -- bash -c 'printf "%s\n" \
"network:" " version: 2" " ethernets:" \
" eth0:" " dhcp4: yes" > /etc/netplan/01-dhcp.yaml'
incus exec web-ct -- netplan apply
\end{lstlisting}
\item \textbf{Host ns1 jako klient DNS}
\begin{lstlisting}[language=bash]
sudo bash -c 'echo "nameserver 10.10.10.2" > /etc/resolv.conf'
\end{lstlisting}
\end{itemize}
\subsection{Quick test matrix}
\begin{tabular}{l l l}
\textbf{Sprawdzenie} & \textbf{Polecenie} & \textbf{Oczekiwany wynik} \\
\hline
Lease br0 & \verb|ip -4 a show br0| & adres 10.10.10.\emph{N} \\
DNS strona.pl & \verb|dig +short strona.pl| & 10.10.10.\emph{X} (web-ct) \\
HTTP & przeglądarka → \verb|http://strona.pl:1111| & treść web-ct \\
\end{tabular}
\subsection{Uwagi}
\begin{itemize}
\item W środowisku produkcyjnym upewnij się, że dnsmasq ma wpis \verb|dhcp-option=3| z
poprawnym adresem bramy lub skonfiguruj statyczną trasę domyślną.
\item Jeśli potrzebujesz stałego adresu dla web-ct, użyj
\verb|dhcp-host=| w \texttt{dnsmasq.conf}, np.:
\verb|dhcp-host=mac:AA:BB:CC:DD:EE:FF,10.10.10.3|
\end{itemize}
\clearpage
\end{document} \end{document}