[CentOS] Reliable way of having both LAN and WIFI on headless box

Fri Jan 13 12:40:33 UTC 2017
Gianluca Cecchi <gianluca.cecchi at gmail.com>

On Fri, Jan 13, 2017 at 12:33 PM, Gary Stainburn <gary at ringways.co.uk>
wrote:

>
>
> Also, it was suggested that I use nmcli in a cronjob to re-activate it if
> it
> drops.  I can check to see if it's still active by 'grep'ing the IP
> address,
> but I don't know the nmcli to re-activate an existing WIFI connection.
>
> Can anyone help here too, just in case I can't fix the real problem


I have a wireless connection named "AndroidAP-notepro"

So I can run

# nmcli con show --active | grep AndroidAP-notepro
AndroidAP-notepro  62d0fc1f-91b8-4c07-baf0-323cf1c108d1  802-11-wireless
 wlp3s0
#

You can check exit code and number of lines.
If number of lines is 0, it means the connection is not active and you can
try to activate it and get exit code of the command

# nmcli con up AndroidAP-notepro

Also, it could be useful to know what value you have for
"connection.autoconnect" for this connection.
If it is yes, in theory it should automatically reactivate when it returns
available.

In my case my AndroidAP-notepro connection is to be manually activated and
in fact I have

# nmcli con show AndroidAP-notepro | grep connection.autoconnect:
connection.autoconnect:                 no
#

In case you also have autoconnect set to no, If you don't have a gui you
should be able to set it up with

# nmcli con mod AndroidAP-notepro connection.autoconnect yes

HIH,
Gianluca