I've updated my Debian 8 template, and for some reason it's messed up the DNS-related iptables rules.
I've narrowed the problem down to this script:
/usr/lib/qubes/qubes-setup-dnat-to-ns
-----------
#!/bin/sh
addrule()
{
if [ $FIRSTONE = yes ] ; then
FIRSTONE=no
RULE1="-A PR-QBS -d $NS1 -p udp --dport 53 -j DNAT --to $1
-A PR-QBS -d $NS1 -p tcp --dport 53 -j DNAT --to $1"
RULE2="-A PR-QBS -d $NS2 -p udp --dport 53 -j DNAT --to $1
-A PR-QBS -d $NS2 -p tcp --dport 53 -j DNAT --to $1"
else
RULE2="-A PR-QBS -d $NS2 -p udp --dport 53 -j DNAT --to $1
-A PR-QBS -d $NS2 -p tcp --dport 53 -j DNAT --to $1"
NS=$NS2
fi
}
export PATH=$PATH:/sbin:/bin
. /var/run/qubes/qubes-ns
if [ "X"$NS1 = "X" ] ; then exit ; fi
iptables -t nat -F PR-QBS
FIRSTONE=yes
grep ^nameserver /etc/resolv.conf | grep -v ":.*:" | head -2 |
(
while read x y z ; do
addrule "$y"
done
(echo "*nat"; echo "$RULE1"; echo "$RULE2"; echo COMMIT) | iptables-restore -n
)
-----------
When I run it as it is, I get the following error:
user@debian-8:~$ sudo bash /usr/lib/qubes/qubes-setup-dnat-to-ns
/usr/lib/qubes/qubes-setup-dnat-to-ns: line 17: /var/run/qubes/qubes-ns: No such file or directory
I've commented the line that runs that script (which is not present in the system), and it doesn't do anything as this line exits the script ($NS1 is empty):
if [ "X"$NS1 = "X" ] ; then exit ; fi
So I've also commented out that line so the rules can get added, but, I get an error when the script adds the rules:
Bad argument `udp'
Error occurred at line: 2
Try `iptables-restore -h' or 'iptables-restore --help' for more information.
It complains about '[...] -p udp [...]'
I'm not sure why I'm running into all these errors, as everything worked just fine before! Any ideas or suggestions are appreciated
Cheers.
Hi guys,
Than for your response.
As I said before, qubes-ns does not get created, and after running setup-ip manually, I get a couple of errors:
----------
$ sudo bash /usr/lib/qubes/setup-ip
Cannot get device feature names: No such device
Cannot get device feature names: No such device
SIOCSIFNETMASK: No such device
up: error fetching interface information: Device not found
Usage: inet_route [-vF] del {-host|-net} Target[/prefix] [gw Gw] [metric M] [[dev] If]
inet_route [-vF] add {-host|-net} Target[/prefix] [gw Gw] [metric M]
[netmask N] [mss Mss] [window W] [irtt I]
[mod] [dyn] [reinstate] [[dev] If]
inet_route [-vF] add {-host|-net} Target[/prefix] [metric M] reject
inet_route [-FC] flush NOT supported
SIOCADDRT: File exists
----------
Would you mind to share these files with me from your Debian 8 template to see if I can fin what the problem is?!
Unman, no I haven't enabled anything. I got a Debian 8 template, almost clean, and then a bunch of AppVMs using it as a template.
Cheers.
Hi,
The thing is that when I set up the DNS servers manually by modifying the /etc/hosts file to let's say 8.8.8.8, everything works properly! I think the problem is that for some reason the iptables rules are not being created, so the appVM can't connect.
Cheers.
Hi,
Sorry I replied from my phone in a rush, you are right what I'm modifying is the resolv.conf file. When I add there let's say 8.8.8.8, it resolves, so the problem seems to be that the template or appVMs cannot connect to sys-fw to resolve DNS names, and this seems to be due to the lack of those iptables rules that are not created for some reason.
The issues applies to both, the template VM and the app VM