Setting up a local network

← Back

Enable on-board LAN controller in the BIOS.

On PC A:

sudo ip link set enp3s0 up
sudo ip addr add 192.168.2.1/24 dev enp3s0
sudo ip route add default via 192.168.2.1 # only if PC A will be gateway to internet (optional)

On PC B:

sudo ip link set enp3s0 up
sudo ip addr add 192.168.2.2/24 dev enp3s0
sudo ip route add default via 192.168.2.1 # if using PC A as gateway (optional)

Test:

# (from PC B)ping 192.168.2.1
# (from PC A)ping 192.168.2.2

Configure DNS

echo "nameserver 1.1.1.1" | sudo tee /etc/resolv.conf

Persistence with NetworkManager

Disable systemd-networkd on both machines:

sudo systemctl disable --now systemd-networkd

PC A

sudo nmcli connection add type ethernet ifname enp7s0 con-name lan-static ipv4.addresses 192.168.2.1/24 ipv4.method manual autoconnect yes

PC B

sudo nmcli connection add type ethernet ifname enp42s0 con-name lan-static ipv4.addresses 192.168.2.2/24 ipv4.method manual autoconnect yes

Bring it up

sudo nmcli connection up lan-static

Verify

ip addr show enp7s0
nmcli device statusnmcli connection show --active

Allow

sudo ufw allow from 192.168.2.0/24