network: let NetworkManager configure VM uplink, if enabled
Previously even if NetworkManager was enabled, our script manually configured network parameters. This apparently have negative effects, because NetworkManager tries to configure some things differently - for example use metric 1024 for default gateway. Fixes QubesOS/qubes-issues#1052
This commit is contained in:
parent
3c7844d408
commit
d23f3d8ddb
@ -14,21 +14,9 @@ if [ x$ip != x ]; then
|
|||||||
netmask=`/usr/bin/qubesdb-read /qubes-netmask`
|
netmask=`/usr/bin/qubesdb-read /qubes-netmask`
|
||||||
gateway=`/usr/bin/qubesdb-read /qubes-gateway`
|
gateway=`/usr/bin/qubesdb-read /qubes-gateway`
|
||||||
secondary_dns=`/usr/bin/qubesdb-read /qubes-secondary-dns`
|
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
|
|
||||||
if [ "x$disablegw" != "x1" ]; then
|
|
||||||
/sbin/route add default gw $gateway
|
|
||||||
fi
|
|
||||||
/sbin/ethtool -K $INTERFACE sg off
|
/sbin/ethtool -K $INTERFACE sg off
|
||||||
/sbin/ethtool -K $INTERFACE tx off
|
/sbin/ethtool -K $INTERFACE tx off
|
||||||
if ! grep -rq "^/etc/resolv[.]conf$" "${PROTECTED_FILE_LIST}" 2>/dev/null; then
|
# If NetworkManager is enabled, let it configure the network
|
||||||
echo > /etc/resolv.conf
|
|
||||||
if [ "x$disabledns" != "x1" ]; then
|
|
||||||
echo "nameserver $gateway" > /etc/resolv.conf
|
|
||||||
echo "nameserver $secondary_dns" >> /etc/resolv.conf
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [ -f /var/run/qubes-service/network-manager ]; then
|
if [ -f /var/run/qubes-service/network-manager ]; then
|
||||||
nm_config=/etc/NetworkManager/system-connections/qubes-uplink-$INTERFACE
|
nm_config=/etc/NetworkManager/system-connections/qubes-uplink-$INTERFACE
|
||||||
cat > $nm_config <<__EOF__
|
cat > $nm_config <<__EOF__
|
||||||
@ -62,6 +50,21 @@ __EOF__
|
|||||||
echo "addresses1=$ip;32" >> $nm_config
|
echo "addresses1=$ip;32" >> $nm_config
|
||||||
fi
|
fi
|
||||||
chmod 600 $nm_config
|
chmod 600 $nm_config
|
||||||
|
else
|
||||||
|
# No NetworkManager enabled, configure the network manually
|
||||||
|
/sbin/ifconfig $INTERFACE $ip netmask 255.255.255.255
|
||||||
|
/sbin/ifconfig $INTERFACE up
|
||||||
|
/sbin/route add -host $gateway dev $INTERFACE
|
||||||
|
if [ "x$disablegw" != "x1" ]; then
|
||||||
|
/sbin/route add default gw $gateway
|
||||||
|
fi
|
||||||
|
if ! grep -rq "^/etc/resolv[.]conf$" "${PROTECTED_FILE_LIST}" 2>/dev/null; then
|
||||||
|
echo > /etc/resolv.conf
|
||||||
|
if [ "x$disabledns" != "x1" ]; then
|
||||||
|
echo "nameserver $gateway" > /etc/resolv.conf
|
||||||
|
echo "nameserver $secondary_dns" >> /etc/resolv.conf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
network=$(qubesdb-read /qubes-netvm-network 2>/dev/null)
|
network=$(qubesdb-read /qubes-netvm-network 2>/dev/null)
|
||||||
if [ "x$network" != "x" ] && [ "x$disabledns" != "x1" ]; then
|
if [ "x$network" != "x" ] && [ "x$disabledns" != "x1" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user