# NetworkManager fallback address?

## cwr

My laptop's ethernet is configured in /etc/conf.d/net to pick up an address from DHCP  and if

that fails fall back to a known static address.  It works fine; however, I now need to do the

same thing on another system with NetworkManager, and that doesn't seem to be so easy.

NM wants things to be either dynamic or static, and doesn't seem to have provision for fallback.

Does anyone know if NM can handle a fallback address, and if so, how?

Thanks - Will

----------

## BillWho

cwr,

I could be wrong, but I don't think that can be done with NetworkManager. What you might want to try is manipulating a symlink to two connection files in /etc/NetworkManager/system-connections - static and dynamic.

Setup the static and dynamic files appropriately like the Auto\ eth0 file and in /etc/conf.d/net use a preup and postup function something like:

```

## setup initial connection for dhcp

preup() {

rm  -f /etc/NetworkManager/system-connections/Auto\ eth0

ln -sf /etc/NetworkManager/system-connections/dynamic  /etc/NetworkManager/system-connections/Auto\ eth0

}

## check for address and go static if there's none

postup() {

[[ -z $(ifconfig eth0|sed -n '/inet /p'|awk '{print $2}') ]] && \

   rm -f /etc/NetworkManager/system-connections/Auto\ eth0 && ln -sf /etc/NetworkManager/system-connections/static  /etc/NetworkManager/system-connections/Auto\ eth0

}

```

Just a thought   :Smile: 

----------

## cwr

Thanks - I'll give it a try.

Will

----------

