I have a desktop and a laptop each with a wireless and wired (eth0) network adapter running Arch Linux. The wireless network(s) that I am on prevents the laptop from seeing the desktop. What I would like to do is use the wired adapters such that I can ssh from the laptop to the desktop. The wired adapter on the desktop is not currently used for anything, but the laptop connects to a variety of wired networks via DHCP. I can manually setup the network at the desktop and laptop are connected via the network cable, but I am having problems automating the setup.
For the manual case, if I connect the desktop to the laptop with a network cable first everything works fine when I run:
# ip link set down dev eth0
# ip addr add 192.168.1.1/24 dev eth0
# ip link set up dev eth0
# systemctl start dhcpd4@eth0.service
where the DHCP server setup and dhcpd4 service file comes from the Arch Wiki.
The issue is that things fall apart if the network cable is not plugged in when I try and assign the IP address and start the DHCP server. I thought maybe ifplugd
might help, but I do not see how to use it to start a DHCP server.