We are making progress! The firewall rules are auto-generated by Nord. I have two variables to play with (Killswitch, Firewall). I reran your query and retested for the following permutations 1) Firewall and Killswitch disabled. 2) Firewall enabled Killswitch disabled. 3 NordVPN disconnected. When I add your iptable rules I can remotely connect to LAN IP addresses as long as the KILLSWITCH is DISABLED (both scenario 1 and 2). However, I have no access to internet outside my LAN. When I disconnect Nord, I have access to LAN and Internet through wireguard.
If we can get the internet working (with the NordVPN KillSwitch disabled), I’d also like to lock down the pi so that it has no internet connectivity without Nord (a custom killswitch firewall rule). I want to prevent automatic downloads from occurring without VPN connection. In terms of internet connectivity, my preference would be a double-hop (inbound wireguard connections get forwarded to Nord)
pi@pivpn:~ $ nordvpn settings
Technology: NORDLYNX
Firewall: disabled
Kill Switch: disabled
CyberSec: disabled
Notify: disabled
Auto-connect: enabled
IPv6: disabled
DNS: 192.168.1.28
Whitelisted subnets:
192.168.1.0/24
pi@pivpn:~ $ nordvpn connect chicago
Connecting to United States #9310 (us9310.nordvpn.com)
You are connected to United States #9310 (us9310.nordvpn.com)!
pi@pivpn:~ $ sudo su
root@pivpn:/home/pi# ss -tunlp | grep 51821; ip -4 addr; ip -4 ro list table all; ip -4 ru; iptables-save -c
udp UNCONN 0 0 0.0.0.0:51821 0.0.0.0:*
udp UNCONN 0 0 *:51821 *:*
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
inet 192.168.1.28/24 brd 192.168.1.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever
4: wg0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue state UNKNOWN group default qlen 1000
inet 10.6.0.1/24 scope global wg0
valid_lft forever preferred_lft forever
20: nordlynx: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue state UNKNOWN group default qlen 1000
inet 10.5.0.2/32 scope global nordlynx
valid_lft forever preferred_lft forever
default via 192.168.1.1 dev eth0 table isp
0.0.0.0/1 via 10.5.0.2 dev nordlynx
default via 192.168.1.1 dev eth0 src 192.168.1.28 metric 202
10.6.0.0/24 dev wg0 proto kernel scope link src 10.6.0.1
128.0.0.0/1 via 10.5.0.2 dev nordlynx
185.203.219.130 via 192.168.1.1 dev eth0
192.168.1.0/24 dev eth0 proto dhcp scope link src 192.168.1.28 metric 202
local 10.5.0.2 dev nordlynx table local proto kernel scope host src 10.5.0.2
broadcast 10.6.0.0 dev wg0 table local proto kernel scope link src 10.6.0.1
local 10.6.0.1 dev wg0 table local proto kernel scope host src 10.6.0.1
broadcast 10.6.0.255 dev wg0 table local proto kernel scope link src 10.6.0.1
broadcast 127.0.0.0 dev lo table local proto kernel scope link src 127.0.0.1
local 127.0.0.0/8 dev lo table local proto kernel scope host src 127.0.0.1
local 127.0.0.1 dev lo table local proto kernel scope host src 127.0.0.1
broadcast 127.255.255.255 dev lo table local proto kernel scope link src 127.0.0.1
broadcast 192.168.1.0 dev eth0 table local proto kernel scope link src 192.168.1.28
local 192.168.1.28 dev eth0 table local proto kernel scope host src 192.168.1.28
broadcast 192.168.1.255 dev eth0 table local proto kernel scope link src 192.168.1.28
0: from all lookup local
15010: from all iif lo sport 51821 lookup isp
32766: from all lookup main
32767: from all lookup default
# Generated by iptables-save v1.8.7 on Wed Feb 9 11:15:34 2022
*filter
:INPUT ACCEPT [16819454:73736317088]
:FORWARD ACCEPT [20575:10602192]
:OUTPUT ACCEPT [5472150:953778801]
[0:0] -A INPUT -s 185.203.219.130/32 -i wlan0 -j ACCEPT
[101:37144] -A INPUT -s 185.203.219.130/32 -i eth0 -j ACCEPT
[0:0] -A INPUT -s 192.168.1.0/24 -i wlan0 -j ACCEPT
[1706:207709] -A INPUT -s 192.168.1.0/24 -i eth0 -j ACCEPT
[0:0] -A INPUT -i wlan0 -j DROP
[202:33554] -A INPUT -i eth0 -j DROP
[0:0] -A OUTPUT -d 185.203.219.130/32 -o wlan0 -j ACCEPT
[68:12052] -A OUTPUT -d 185.203.219.130/32 -o eth0 -j ACCEPT
[0:0] -A OUTPUT -d 192.168.1.0/24 -o wlan0 -j ACCEPT
[941:138809] -A OUTPUT -d 192.168.1.0/24 -o eth0 -j ACCEPT
[0:0] -A OUTPUT -o wlan0 -j DROP
[94:10884] -A OUTPUT -o eth0 -j DROP
COMMIT
# Completed on Wed Feb 9 11:15:34 2022
# Generated by iptables-save v1.8.7 on Wed Feb 9 11:15:34 2022
*nat
:PREROUTING ACCEPT [40971:3576797]
:INPUT ACCEPT [39555:3396272]
:OUTPUT ACCEPT [15935:1091185]
:POSTROUTING ACCEPT [15774:1123291]
[404:82821] -A POSTROUTING -s 10.6.0.0/24 -o eth0 -m comment --comment wireguard-nat-rule -j MASQUERADE
COMMIT
# Completed on Wed Feb 9 11:15:34 2022
root@pivpn:/home/pi# nordvpn set firewall enabled
Firewall is set to 'enabled' successfully.
root@pivpn:/home/pi# nordvpn settings
Technology: NORDLYNX
Firewall: enabled
Kill Switch: disabled
CyberSec: disabled
Notify: disabled
Auto-connect: enabled
IPv6: disabled
DNS: disabled
root@pivpn:/home/pi# nordvpn connect chicago
Connecting to United States #9045 (us9045.nordvpn.com)
You are connected to United States #9045 (us9045.nordvpn.com)!
root@pivpn:/home/pi# ss -tunlp | grep 51821; ip -4 addr; ip -4 ro list table all; ip -4 ru; iptables-save -c
udp UNCONN 0 0 0.0.0.0:51821 0.0.0.0:*
udp UNCONN 0 0 *:51821 *:*
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
inet 192.168.1.28/24 brd 192.168.1.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever
4: wg0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue state UNKNOWN group default qlen 1000
inet 10.6.0.1/24 scope global wg0
valid_lft forever preferred_lft forever
22: nordlynx: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue state UNKNOWN group default qlen 1000
inet 10.5.0.2/32 scope global nordlynx
valid_lft forever preferred_lft forever
default via 192.168.1.1 dev eth0 table isp
0.0.0.0/1 via 10.5.0.2 dev nordlynx
default via 192.168.1.1 dev eth0 src 192.168.1.28 metric 202
10.6.0.0/24 dev wg0 proto kernel scope link src 10.6.0.1
108.62.107.241 via 192.168.1.1 dev eth0
128.0.0.0/1 via 10.5.0.2 dev nordlynx
192.168.1.0/24 dev eth0 proto dhcp scope link src 192.168.1.28 metric 202
local 10.5.0.2 dev nordlynx table local proto kernel scope host src 10.5.0.2
broadcast 10.6.0.0 dev wg0 table local proto kernel scope link src 10.6.0.1
local 10.6.0.1 dev wg0 table local proto kernel scope host src 10.6.0.1
broadcast 10.6.0.255 dev wg0 table local proto kernel scope link src 10.6.0.1
broadcast 127.0.0.0 dev lo table local proto kernel scope link src 127.0.0.1
local 127.0.0.0/8 dev lo table local proto kernel scope host src 127.0.0.1
local 127.0.0.1 dev lo table local proto kernel scope host src 127.0.0.1
broadcast 127.255.255.255 dev lo table local proto kernel scope link src 127.0.0.1
broadcast 192.168.1.0 dev eth0 table local proto kernel scope link src 192.168.1.28
local 192.168.1.28 dev eth0 table local proto kernel scope host src 192.168.1.28
broadcast 192.168.1.255 dev eth0 table local proto kernel scope link src 192.168.1.28
0: from all lookup local
15010: from all iif lo sport 51821 lookup isp
32766: from all lookup main
32767: from all lookup default
# Generated by iptables-save v1.8.7 on Wed Feb 9 11:16:53 2022
*filter
:INPUT ACCEPT [16820518:73736540247]
:FORWARD ACCEPT [20583:10602613]
:OUTPUT ACCEPT [5472965:953918279]
COMMIT
# Completed on Wed Feb 9 11:16:53 2022
# Generated by iptables-save v1.8.7 on Wed Feb 9 11:16:53 2022
*nat
:PREROUTING ACCEPT [41122:3589950]
:INPUT ACCEPT [39706:3409425]
:OUTPUT ACCEPT [15998:1095667]
:POSTROUTING ACCEPT [15837:1127773]
[404:82821] -A POSTROUTING -s 10.6.0.0/24 -o eth0 -m comment --comment wireguard-nat-rule -j MASQUERADE
COMMIT
# Completed on Wed Feb 9 11:16:53 2022
root@pivpn:/home/pi# nordvpn disconnect
You are disconnected from NordVPN.
How would you rate your connection quality on a scale from 1 (poor) to 5 (excellent)? Type 'nordvpn rate [1-5]'.
root@pivpn:/home/pi# nordvpn status
Status: Disconnected
root@pivpn:/home/pi# ss -tunlp | grep 51821; ip -4 addr; ip -4 ro list table all; ip -4 ru; iptables-save -c
udp UNCONN 0 0 0.0.0.0:51821 0.0.0.0:*
udp UNCONN 0 0 *:51821 *:*
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
inet 192.168.1.28/24 brd 192.168.1.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever
4: wg0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue state UNKNOWN group default qlen 1000
inet 10.6.0.1/24 scope global wg0
valid_lft forever preferred_lft forever
default via 192.168.1.1 dev eth0 table isp
default via 192.168.1.1 dev eth0 src 192.168.1.28 metric 202
10.6.0.0/24 dev wg0 proto kernel scope link src 10.6.0.1
192.168.1.0/24 dev eth0 proto dhcp scope link src 192.168.1.28 metric 202
broadcast 10.6.0.0 dev wg0 table local proto kernel scope link src 10.6.0.1
local 10.6.0.1 dev wg0 table local proto kernel scope host src 10.6.0.1
broadcast 10.6.0.255 dev wg0 table local proto kernel scope link src 10.6.0.1
broadcast 127.0.0.0 dev lo table local proto kernel scope link src 127.0.0.1
local 127.0.0.0/8 dev lo table local proto kernel scope host src 127.0.0.1
local 127.0.0.1 dev lo table local proto kernel scope host src 127.0.0.1
broadcast 127.255.255.255 dev lo table local proto kernel scope link src 127.0.0.1
broadcast 192.168.1.0 dev eth0 table local proto kernel scope link src 192.168.1.28
local 192.168.1.28 dev eth0 table local proto kernel scope host src 192.168.1.28
broadcast 192.168.1.255 dev eth0 table local proto kernel scope link src 192.168.1.28
0: from all lookup local
15010: from all iif lo sport 51821 lookup isp
32766: from all lookup main
32767: from all lookup default
# Generated by iptables-save v1.8.7 on Wed Feb 9 11:17:14 2022
*filter
:INPUT ACCEPT [16820933:73736596170]
:FORWARD ACCEPT [20583:10602613]
:OUTPUT ACCEPT [5473190:953953903]
COMMIT
# Completed on Wed Feb 9 11:17:14 2022
# Generated by iptables-save v1.8.7 on Wed Feb 9 11:17:14 2022
*nat
:PREROUTING ACCEPT [41149:3591922]
:INPUT ACCEPT [39733:3411397]
:OUTPUT ACCEPT [16002:1095944]
:POSTROUTING ACCEPT [15841:1128050]
[404:82821] -A POSTROUTING -s 10.6.0.0/24 -o eth0 -m comment --comment wireguard-nat-rule -j MASQUERADE
COMMIT
# Completed on Wed Feb 9 11:17:14 2022