core-agent-linux/vm-systemd/network-proxy-setup.sh
Marek Marczykowski 596a3ebd8e network: do not fail when eth0 doesn't exists
It can be perfectly right case for wireless-only netvm.
2013-08-13 00:40:13 +02:00

16 lines
646 B
Bash
Executable File

#!/bin/sh
# Setup gateway for all the VMs this netVM is serviceing...
network=$(/usr/bin/xenstore-read qubes-netvm-network 2>/dev/null)
if [ "x$network" != "x" ]; then
gateway=$(/usr/bin/xenstore-read qubes-netvm-gateway)
netmask=$(/usr/bin/xenstore-read qubes-netvm-netmask)
secondary_dns=$(/usr/bin/xenstore-read qubes-netvm-secondary-dns)
modprobe netbk 2> /dev/null || modprobe xen-netback
echo "NS1=$gateway" > /var/run/qubes/qubes-ns
echo "NS2=$secondary_dns" >> /var/run/qubes/qubes-ns
/usr/lib/qubes/qubes-setup-dnat-to-ns
echo "1" > /proc/sys/net/ipv4/ip_forward
/sbin/ethtool -K eth0 sg off || :
fi