network-proxy-setup.sh 918 B

1234567891011121314151617181920212223
  1. #!/bin/sh
  2. # Setup gateway for all the VMs this netVM is serviceing...
  3. network=$(qubesdb-read /qubes-netvm-network 2>/dev/null)
  4. if [ "x$network" != "x" ]; then
  5. if [ -e /proc/sys/kernel ] && ! [ -e /proc/sys/kernel/modules_disabled ]; then
  6. readonly modprobe_fail_cmd='true'
  7. else
  8. readonly modprobe_fail_cmd='false'
  9. fi
  10. gateway=$(qubesdb-read /qubes-netvm-gateway)
  11. #netmask=$(qubesdb-read /qubes-netvm-netmask)
  12. primary_dns=$(qubesdb-read /qubes-netvm-primary-dns 2>/dev/null || echo "$gateway")
  13. secondary_dns=$(qubesdb-read /qubes-netvm-secondary-dns)
  14. modprobe netbk 2> /dev/null || modprobe xen-netback || "${modprobe_fail_cmd}"
  15. echo "NS1=$primary_dns" > /var/run/qubes/qubes-ns
  16. echo "NS2=$secondary_dns" >> /var/run/qubes/qubes-ns
  17. /usr/lib/qubes/qubes-setup-dnat-to-ns
  18. echo "1" > /proc/sys/net/ipv4/ip_forward
  19. /sbin/ethtool -K eth0 sg off || true
  20. fi