Sometimes, RTFM is what people want to do, they're just not sure which manual to read.
With that said, here's an example from my Fedora 21 desktop:
List all existing connections of which NetworkManager is aware.
Code: Select all
[root@young jyoung]# nmcli con show
NAME UUID TYPE DEVICE
virbr0-nic dc9abaa0-a3c3-4b61-b5a4-f2a1ccbf9b3b generic virbr0-nic
virbr0 12bdfaca-99e7-4bc2-a866-ba91ea8bf02b bridge virbr0
Wired Internet f5dc9fe0-f5a5-4f55-9944-320706637835 802-3-ethernet em1
tun0 15fd0495-84b4-40d6-8499-6f982e0239b1 generic --
virbr1 d2c13d58-0bda-4444-b2f5-a6ed95c8b4a9 bridge virbr1
Edit the desired connection, dropping you to a nmcli shell:
Code: Select all
[root@young jyoung]# nmcli con edit Wired\ Internet
===| nmcli interactive connection editor |===
Editing existing '802-3-ethernet' connection: 'Wired Internet'
Type 'help' or '?' for available commands.
Type 'describe [<setting>.<prop>]' for detailed property description.
You may edit the following settings: connection, 802-3-ethernet (ethernet), 802-1x, ipv4, ipv6, dcb
nmcli>
Select the desired section which you'd like to edit:
Code: Select all
You may edit the following settings: connection, 802-3-ethernet (ethernet), 802-1x, ipv4, ipv6, dcb
nmcli>goto ipv4
You may edit the following properties: method, dns, dns-search, addresses, address-labels, routes, ignore-auto-routes, ignore-auto-dns, dhcp-client-id, dhcp-send-hostname, dhcp-hostname, never-default, may-fail
nmcli ipv4>
List the current settings of your selected connection:
Code: Select all
nmcli ipv4> print
['ipv4' setting values]
ipv4.method: auto
ipv4.dns: 192.168.1.1
ipv4.dns-search:
ipv4.addresses:
ipv4.routes:
ipv4.ignore-auto-routes: no
ipv4.ignore-auto-dns: no
ipv4.dhcp-client-id: --
ipv4.dhcp-send-hostname: yes
ipv4.dhcp-hostname: --
ipv4.never-default: no
ipv4.may-fail: yes
Add (a) static route(s), comma-delimited (this example, of course, uses a completely made-up gateway):
Code: Select all
nmcli ipv4> set routes 10.10.10.0/24 172.16.34.1, 10.10.20.0/24 172.16.34.1, 10.10.45.0/23 172.16.34.1
nmcli ipv4> print
['ipv4' setting values]
ipv4.method: auto
ipv4.dns: 192.168.1.1
ipv4.dns-search:
ipv4.addresses:
ipv4.routes: { dst = 10.10.10.0/24, nh = 172.16.34.1, mt = 0 }; { dst = 10.10.20.0/24, nh = 172.16.34.1, mt = 0 }; { dst = 10.10.45.0/23, nh = 172.16.34.1, mt = 0 }
ipv4.ignore-auto-routes: no
ipv4.ignore-auto-dns: no
ipv4.dhcp-client-id: --
ipv4.dhcp-send-hostname: yes
ipv4.dhcp-hostname: --
ipv4.never-default: no
ipv4.may-fail: yes
nmcli ipv4>
Save your changes, and exit the nmcli shell:
Code: Select all
nmcli ipv4> save
Connection 'Wired Internet' (f5dc9fe0-f5a5-4f55-9944-320706637835) successfully updated.
nmcli ipv4> quit
The connection is not saved. Do you really want to quit? (yes/no) [no] no
nmcli ipv4> save
Connection 'Wired Internet' (f5dc9fe0-f5a5-4f55-9944-320706637835) successfully updated.
nmcli ipv4> quit
Reload the connection that you've modified:
Code: Select all
nmcli con down Wired\ Internet; nmcli con up Wired\ Internet
And, here's a better reference.
http://fedoraproject.org/wiki/Networkin ... connection