40 lines
1.5 KiB
Bash
Executable File
40 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
ip=`/usr/bin/qubesdb-read /qubes-ip 2> /dev/null`
|
|
if [ x$ip != x ]; then
|
|
netmask=`/usr/bin/qubesdb-read /qubes-netmask`
|
|
gateway=`/usr/bin/qubesdb-read /qubes-gateway`
|
|
secondary_dns=`/usr/bin/qubesdb-read /qubes-secondary-dns`
|
|
/sbin/ifconfig $INTERFACE $ip netmask 255.255.255.255
|
|
/sbin/ifconfig $INTERFACE up
|
|
/sbin/route add -host $gateway dev $INTERFACE
|
|
/sbin/route add default gw $gateway
|
|
/sbin/ethtool -K $INTERFACE sg off
|
|
/sbin/ethtool -K $INTERFACE tx off
|
|
echo "nameserver $gateway" > /etc/resolv.conf
|
|
echo "nameserver $secondary_dns" >> /etc/resolv.conf
|
|
network=$(/usr/bin/qubesdb-read /qubes-netvm-network 2>/dev/null)
|
|
if [ "x$network" != "x" ]; then
|
|
gateway=$(/usr/bin/qubesdb-read /qubes-netvm-gateway)
|
|
netmask=$(/usr/bin/qubesdb-read /qubes-netvm-netmask)
|
|
secondary_dns=$(/usr/bin/qubesdb-read /qubes-netvm-secondary-dns)
|
|
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
|
|
[ -x /rw/config/qubes-ip-change-hook ] && /rw/config/qubes-ip-change-hook
|
|
# XXX: Backward compatibility
|
|
[ -x /rw/config/qubes_ip_change_hook ] && /rw/config/qubes_ip_change_hook
|
|
fi
|
|
if [ -f /var/run/qubes-service/network-manager ]; then
|
|
cat > /etc/sysconfig/network-scripts/ifcfg-$INTERFACE <<__EOF__
|
|
DEVICE=$INTERFACE
|
|
IPADDR=$ip
|
|
NETMASK=255.255.255.255
|
|
NETWORK=$ip
|
|
ONBOOT=yes
|
|
GATEWAYDEV=$INTERFACE
|
|
GATEWAY=$gateway
|
|
__EOF__
|
|
fi
|
|
fi
|