pyratelog

personal blog
git clone git://git.pyratebeard.net/pyratelog.git
Log | Files | Refs | README

commit 274032a0138e029e643abfbff034cd1769691c32
parent 2e14a7e807b1d2b4488bd1fee09507821f35aa3c
Author: pyratebeard <root@pyratebeard.net>
Date:   Sun,  5 Feb 2023 16:19:29 +0000

masq_of_the_dhcphantasm

Diffstat:
Mentry/masq_of_the_dhcphantasm.md | 36+++++++++++++++++++++++++++++++-----
1 file changed, 31 insertions(+), 5 deletions(-)

diff --git a/entry/masq_of_the_dhcphantasm.md b/entry/masq_of_the_dhcphantasm.md @@ -1,13 +1,39 @@ -The other day I wanted to test a new network device without connecting it to my home LAN. I knew the device was preconfigured to use DHCP so I very quickly set up one of my laptops as a DHCP server using [dnsmasq](https://dnsmasq.org/){target="_blank" rel="noreferrer"}, plugged the laptop and the device into a switch, and could test the device 'offline'. +The other day I wanted to test a new network device without connecting it to my home LAN. I knew the device was preconfigured to use DHCP so I very quickly set up one of my laptops as a DHCP server using [dnsmasq](https://dnsmasq.org/){target="_blank" rel="noreferrer"}. -To setup the DHCP server I made sure the `dnsmasq` package was installed on one of my laptops then disconnected it from the WiFi. +After making sure the `dnsmasq` package was installed on the laptop I disconnected it from the WiFi and plugged it into a switch. -The configuration file is usually /etc/dnsmasq.conf, or you can drop your own config files into /etc/dnsmasq.d/ (ensure you uncomment the include line in /etc/dnsmasq.conf). +Configuring a static IP differs from system to system, but in this case I was using `netctl`. I took a copy of the example configuration file, /etc/netctl/examples/ethernet-static, put it into the /etc/netctl directory, and changed the 'Interface' and 'Address' variables +``` +Description='A basic static ethernet connection' +Interface=enp0s25 +Connection=ethernet +IP=static +Address=('192.168.1.1/24') +#Routes=('192.168.0.0/24 via 192.168.1.2') +Gateway='192.168.1.1' +DNS=('192.168.1.1') + +## For IPv6 autoconfiguration +#IP6=stateless + +## For IPv6 static address configuration +#IP6=static +#Address6=('1234:5678:9abc:def::1/64' '1234:3456::123/96') +#Routes6=('abcd::1234') +#Gateway6='1234:0:123::abcd' +``` + +Bringing the interface up with +``` +sudo netctl start ethernet-static +``` + +The dnsmasq configuration file is usually /etc/dnsmasq.conf, or you can drop your own config files into /etc/dnsmasq.d/ (ensure you uncomment the include line in /etc/dnsmasq.conf). My setup was very simple ``` # specify ethernet device to operate on -interface=enp5s0 +interface=enp0s25 # disable dns port=0 @@ -16,7 +42,7 @@ port=0 dhcp-range=192.168.1.10,192.168.1.12,8h ``` -To validate any configuration incant +Before starting `dnsmasq` it is a good idea to validate the configuration ``` dnsmasq --test ```