diff --git a/network/setup-ip b/network/setup-ip index 1b4c03a..67ca40e 100755 --- a/network/setup-ip +++ b/network/setup-ip @@ -14,21 +14,9 @@ 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 - if [ "x$disablegw" != "x1" ]; then - /sbin/route add default gw $gateway - fi /sbin/ethtool -K $INTERFACE sg off /sbin/ethtool -K $INTERFACE tx off - 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 + # If NetworkManager is enabled, let it configure the network if [ -f /var/run/qubes-service/network-manager ]; then nm_config=/etc/NetworkManager/system-connections/qubes-uplink-$INTERFACE cat > $nm_config <<__EOF__ @@ -62,6 +50,21 @@ __EOF__ echo "addresses1=$ip;32" >> $nm_config fi 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 network=$(qubesdb-read /qubes-netvm-network 2>/dev/null) if [ "x$network" != "x" ] && [ "x$disabledns" != "x1" ]; then