www.duckland.org/content/posts/2017/02/quick-nmcli-notes.md
2025-06-17 22:14:34 -05:00

29 lines
2 KiB
Markdown

+++
date = "2017-02-16T19:38:42-07:00"
title = "Quick nmcli notes"
categories = ["unix","sa"]
tags = ["linux","R810"]
+++
This is a quick post so I can remember these details.
So, on the [R810](/tags/r810/), I am currently running [ArchLinux](https://archlinux.org), which uses by default [NetworkManager](https://wiki.archlinux.org/index.php/NetworkManager), which I have a love/hate relationship with. At my last job, I recommended removing it from our servers, as under [RHEL6](https://www.redhat.com), it does very odd things to the network and is hard to manage. I have heard that it is better under RHEL7. But, it does let you do some really cool things. On the R810, there is a cellular modem, and on previous installes, I have had it configured and scripted using **nmcli** to easily bring up and down the cellular connections.
The problem I am facing now is that my current DHCP server for the house does not let me provide two MAC Address for a single IP, so when I dock the R810, it gets a different IP address than when it is on WiFi. Very annoying. Also, for some reason, it would prefer to use WiFi when the ethernet connection was present, thus giving me a slower connection.
The documentation I found was a bit light in examples and/or dated (I am running version 1.6.2 of NetworkManager, and the examples were from 1.2.x or 1.4.x, which did not work). So, with a bit of expermenting, I finally got it fixed to:
- Chose the ethernet connection over the Wifi when both are present
- 'Clone' the MAC address of the Wifi NIC to the ethernet NIC
Here are the commands. **local** is what I called the local ethernet connection, and **home-wifi** is what I call the house Wifi Network.
- To set the MAC adress:
>nmcli connection modify local ethernet.cloned-mac-address aa:bb:cc:dd:ee:ff
- To set the connection priorities:
>nmcli connection modify local connection.autoconnect-priority 999
>nmcli connection modify home-wifi connection.autoconnect-priority 999