2012-01-10 12:10:16 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Setup gateway for all the VMs this netVM is serviceing...
|
2015-01-30 00:30:24 +01:00
|
|
|
network=$(qubesdb-read /qubes-netvm-network 2>/dev/null)
|
2012-01-10 12:10:16 +01:00
|
|
|
if [ "x$network" != "x" ]; then
|
2015-11-29 01:00:00 +01:00
|
|
|
|
|
|
|
if [ -e /proc/sys/kernel ] && ! [ -e /proc/sys/kernel/modules_disabled ]; then
|
2016-03-19 16:26:29 +01:00
|
|
|
readonly modprobe_fail_cmd='true'
|
2015-11-29 01:00:00 +01:00
|
|
|
else
|
2016-03-19 16:26:29 +01:00
|
|
|
readonly modprobe_fail_cmd='false'
|
2015-11-29 01:00:00 +01:00
|
|
|
fi
|
|
|
|
|
2015-01-30 00:30:24 +01:00
|
|
|
gateway=$(qubesdb-read /qubes-netvm-gateway)
|
2017-12-03 03:30:53 +01:00
|
|
|
gateway6=$(qubesdb-read /qubes-netvm-gateway6 ||:)
|
2017-09-30 04:49:21 +02:00
|
|
|
#netmask=$(qubesdb-read /qubes-netvm-netmask)
|
|
|
|
primary_dns=$(qubesdb-read /qubes-netvm-primary-dns 2>/dev/null || echo "$gateway")
|
2015-01-30 00:30:24 +01:00
|
|
|
secondary_dns=$(qubesdb-read /qubes-netvm-secondary-dns)
|
2015-11-29 01:00:00 +01:00
|
|
|
modprobe netbk 2> /dev/null || modprobe xen-netback || "${modprobe_fail_cmd}"
|
2016-03-07 13:37:45 +01:00
|
|
|
echo "NS1=$primary_dns" > /var/run/qubes/qubes-ns
|
2013-03-13 02:26:40 +01:00
|
|
|
echo "NS2=$secondary_dns" >> /var/run/qubes/qubes-ns
|
|
|
|
/usr/lib/qubes/qubes-setup-dnat-to-ns
|
2012-01-10 12:10:16 +01:00
|
|
|
echo "1" > /proc/sys/net/ipv4/ip_forward
|
2017-12-03 03:30:53 +01:00
|
|
|
# enable also IPv6 forwarding, if IPv6 is enabled
|
|
|
|
if [ -n "$gateway6" ]; then
|
|
|
|
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
|
|
|
|
fi
|
2016-03-19 16:23:36 +01:00
|
|
|
/sbin/ethtool -K eth0 sg off || true
|
2012-01-10 12:10:16 +01:00
|
|
|
fi
|