I need help with this. I’m doing everything as it says in the docs, but I can’t make it work.
sys-net:
wls6 UP 192.168.0.16/24
vif60.0 UP 10.138.19.200/32
sys-firewall:
eth0 UP 10.138.18.170/32
vif61.0 UP 10.138.18.170/32
vif63.0 UP 10.138.18.170/32
nginx:
eth0 UP 10.137.0.27/32
I applied the following to sys-net’s qubes-firewall-user-script and checked that it persist:
if nft add chain qubes custom-dnat-nginx ‘{ type nat hook prerouting priority filter +1 ; policy accept; }’
then
nft add rule qubes custom-dnat-nginx iif == “wls6” ip saddr 192.168.0.0/24 tcp dport 80 ct state new,established,related counter dnat 10.138.18.170
nft add rule qubes custom-forward iif == “wls6” ip saddr 192.168.0.0/24 ip daddr 10.138.18.170 tcp dport 80 ct state new,established,related counter accept
fi
sys-firewall’s qubes-firewall-user-script:
if nft add chain qubes custom-dnat-nginx ‘{ type nat hook prerouting priority filter +1 ; policy accept; }’
then
nft add rule qubes custom-dnat-nginx iif == “eth0” ip saddr 192.168.0.0/24 tcp dport 80 ct state new,established,related counter dnat 10.137.0.27
nft add rule qubes custom-forward iif == “eth0” ip saddr 192.168.0.0/24 ip daddr 10.137.0.27 tcp dport 80 ct state new,established,related counter accept
fi
in my nginx’s rc.local:
nft add rule qubes custom-input tcp dport 80 ip daddr 10.137.0.27 ct state new,established,related counter accept
in the nginx qube I am able to http://localhost, but when I hit my public IP(say 72.72.72.72) it just hangs.
I wonder if the daddr part is useful, this may be creating problems here
in the nginx qube, if you run sudo tcpdump -i eth0 -nn tcp port 80 do you see lines appearing when trying to connect? From sys-firewall, you can try to connect with curl http://10.137.0.27
I can’t.
curl http://192.168.0.16
curl: (7) Failed to connect to 192.168.0.16 port 80 after 1 ms: Couldn’t connect to server
What should I write instead?
Only if I use curl 10.137.0.27 from the sys-firewall, but not from sys-net.
for the curl 192.168.0.16 I don’t see anything.
I can get results when I use curl 10.137.0.27 from sys-firewall, but not sys-net for some reason
That’s cool, but I want to learn by doing it myself first. Meanwhile as you can see I’m having issues with simple things like that, despite following the docs.
It may also be that “adding” rules may not work, because they are added after the catch-all “drop”. Can’t check now, but it’s worth trying to “insert” the rules instead.