how do I use nmcli to add an IP-address to an interface?
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
On a CentOS 7 virtual machine, I have an interface called ens7
, as shown here:
[root@localhost ~]# nmcli con show
NAME UUID TYPE DEVICE
Wired connection 1 448101d7-1f8f-4b78-ad90-7efd5be23b08 802-3-ethernet ens7
eth0 d976f7ca-ab7f-4fd0-ab2b-6213815bd1a1 802-3-ethernet eth0
How do I get nmcli to assign the 10.1.1.1
ip address to the ens7
interface?
I tried typing nmcli con modify 'Wired connection 1' ipv4.addresses "10.1.1.2"
from within the virtual machine, but it did not take, as seen in the results of `` as follows:
[root@localhost ~]# nmcli con modify 'Wired connection 1' ipv4.addresses "10.1.1.2"
[root@localhost ~]# nmcli device show
GENERAL.DEVICE: eth0
...lots of stuff related to eth0
GENERAL.DEVICE: ens7
GENERAL.TYPE: ethernet
GENERAL.HWADDR: 52:54:00:8F:3B:14
GENERAL.MTU: 1500
GENERAL.STATE: 70 (connecting (getting IP configuration))
GENERAL.CONNECTION: Wired connection 1
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/64
WIRED-PROPERTIES.CARRIER: on
GENERAL.DEVICE: lo
...lots of stuff related to lo
[root@localhost ~]#
What syntax do I use to get the IP-address to show up in the nmcli device show
results? So that I will be able to ping the new IP-address from an authorized outsider?
centos networking rhel network-interface nmcli
add a comment |Â
up vote
2
down vote
favorite
On a CentOS 7 virtual machine, I have an interface called ens7
, as shown here:
[root@localhost ~]# nmcli con show
NAME UUID TYPE DEVICE
Wired connection 1 448101d7-1f8f-4b78-ad90-7efd5be23b08 802-3-ethernet ens7
eth0 d976f7ca-ab7f-4fd0-ab2b-6213815bd1a1 802-3-ethernet eth0
How do I get nmcli to assign the 10.1.1.1
ip address to the ens7
interface?
I tried typing nmcli con modify 'Wired connection 1' ipv4.addresses "10.1.1.2"
from within the virtual machine, but it did not take, as seen in the results of `` as follows:
[root@localhost ~]# nmcli con modify 'Wired connection 1' ipv4.addresses "10.1.1.2"
[root@localhost ~]# nmcli device show
GENERAL.DEVICE: eth0
...lots of stuff related to eth0
GENERAL.DEVICE: ens7
GENERAL.TYPE: ethernet
GENERAL.HWADDR: 52:54:00:8F:3B:14
GENERAL.MTU: 1500
GENERAL.STATE: 70 (connecting (getting IP configuration))
GENERAL.CONNECTION: Wired connection 1
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/64
WIRED-PROPERTIES.CARRIER: on
GENERAL.DEVICE: lo
...lots of stuff related to lo
[root@localhost ~]#
What syntax do I use to get the IP-address to show up in the nmcli device show
results? So that I will be able to ping the new IP-address from an authorized outsider?
centos networking rhel network-interface nmcli
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
On a CentOS 7 virtual machine, I have an interface called ens7
, as shown here:
[root@localhost ~]# nmcli con show
NAME UUID TYPE DEVICE
Wired connection 1 448101d7-1f8f-4b78-ad90-7efd5be23b08 802-3-ethernet ens7
eth0 d976f7ca-ab7f-4fd0-ab2b-6213815bd1a1 802-3-ethernet eth0
How do I get nmcli to assign the 10.1.1.1
ip address to the ens7
interface?
I tried typing nmcli con modify 'Wired connection 1' ipv4.addresses "10.1.1.2"
from within the virtual machine, but it did not take, as seen in the results of `` as follows:
[root@localhost ~]# nmcli con modify 'Wired connection 1' ipv4.addresses "10.1.1.2"
[root@localhost ~]# nmcli device show
GENERAL.DEVICE: eth0
...lots of stuff related to eth0
GENERAL.DEVICE: ens7
GENERAL.TYPE: ethernet
GENERAL.HWADDR: 52:54:00:8F:3B:14
GENERAL.MTU: 1500
GENERAL.STATE: 70 (connecting (getting IP configuration))
GENERAL.CONNECTION: Wired connection 1
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/64
WIRED-PROPERTIES.CARRIER: on
GENERAL.DEVICE: lo
...lots of stuff related to lo
[root@localhost ~]#
What syntax do I use to get the IP-address to show up in the nmcli device show
results? So that I will be able to ping the new IP-address from an authorized outsider?
centos networking rhel network-interface nmcli
On a CentOS 7 virtual machine, I have an interface called ens7
, as shown here:
[root@localhost ~]# nmcli con show
NAME UUID TYPE DEVICE
Wired connection 1 448101d7-1f8f-4b78-ad90-7efd5be23b08 802-3-ethernet ens7
eth0 d976f7ca-ab7f-4fd0-ab2b-6213815bd1a1 802-3-ethernet eth0
How do I get nmcli to assign the 10.1.1.1
ip address to the ens7
interface?
I tried typing nmcli con modify 'Wired connection 1' ipv4.addresses "10.1.1.2"
from within the virtual machine, but it did not take, as seen in the results of `` as follows:
[root@localhost ~]# nmcli con modify 'Wired connection 1' ipv4.addresses "10.1.1.2"
[root@localhost ~]# nmcli device show
GENERAL.DEVICE: eth0
...lots of stuff related to eth0
GENERAL.DEVICE: ens7
GENERAL.TYPE: ethernet
GENERAL.HWADDR: 52:54:00:8F:3B:14
GENERAL.MTU: 1500
GENERAL.STATE: 70 (connecting (getting IP configuration))
GENERAL.CONNECTION: Wired connection 1
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/64
WIRED-PROPERTIES.CARRIER: on
GENERAL.DEVICE: lo
...lots of stuff related to lo
[root@localhost ~]#
What syntax do I use to get the IP-address to show up in the nmcli device show
results? So that I will be able to ping the new IP-address from an authorized outsider?
centos networking rhel network-interface nmcli
centos networking rhel network-interface nmcli
edited Oct 15 '15 at 8:55
Thomas Dickey
51.1k593162
51.1k593162
asked Oct 14 '15 at 21:09
CodeMed
1,738216898
1,738216898
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
3
down vote
nmcli con modify "Wired connection 1" ifname ens7 type ethernet ip4 10.1.1.2/24
If you downvote, please leave a comment why. Then, the reader can evaluate more easily whether the answer is helpful for them or not. Thanks!
â Torsten Bronger
Dec 8 '16 at 7:42
add a comment |Â
up vote
2
down vote
Your conn modify looks mostly right, but need to put a netmask on the address otherwise it'll get the default (probably /8, which may or may not be what you want). For instance, if you needed a class-c network (254 hosts, 10.1.1.1 through 254 in your case), you'd:
nmcli con modify 'Wired connection 1' ipv4.addresses "10.1.1.2/24"
You also need to apply the config to the running interface. I usually:
nmcli conn down "Wired Connection 1"
nmcli conn up !$
You may be able to just use conn up with out taking the interface down first.
Other note: you can run "nmcli conn show "Wired Connection 1" to get all the settings for that device. At the end of that, it'll also show the current settings in all caps.
connection.id: virbr0
connection.stable-id: --
connection.type: bridge
connection.interface-name: virbr0
[SNIP]
IP4.ADDRESS[1]: 192.168.122.1/24
IP4.GATEWAY: --
IP4.ROUTE[1]: dst = 192.168.122.0/24, nh = 0.0.0.0, mt = 0
IP6.GATEWAY: --
If someone else wants to validate this answer independently and leave comments on results, then I will mark this or the other answer as accepted. But I cannot validate myself as I am on to other things.
â CodeMed
Aug 5 at 6:59
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
nmcli con modify "Wired connection 1" ifname ens7 type ethernet ip4 10.1.1.2/24
If you downvote, please leave a comment why. Then, the reader can evaluate more easily whether the answer is helpful for them or not. Thanks!
â Torsten Bronger
Dec 8 '16 at 7:42
add a comment |Â
up vote
3
down vote
nmcli con modify "Wired connection 1" ifname ens7 type ethernet ip4 10.1.1.2/24
If you downvote, please leave a comment why. Then, the reader can evaluate more easily whether the answer is helpful for them or not. Thanks!
â Torsten Bronger
Dec 8 '16 at 7:42
add a comment |Â
up vote
3
down vote
up vote
3
down vote
nmcli con modify "Wired connection 1" ifname ens7 type ethernet ip4 10.1.1.2/24
nmcli con modify "Wired connection 1" ifname ens7 type ethernet ip4 10.1.1.2/24
edited Oct 15 '15 at 3:20
G-Man
12.1k92860
12.1k92860
answered Oct 15 '15 at 3:15
unix
311
311
If you downvote, please leave a comment why. Then, the reader can evaluate more easily whether the answer is helpful for them or not. Thanks!
â Torsten Bronger
Dec 8 '16 at 7:42
add a comment |Â
If you downvote, please leave a comment why. Then, the reader can evaluate more easily whether the answer is helpful for them or not. Thanks!
â Torsten Bronger
Dec 8 '16 at 7:42
If you downvote, please leave a comment why. Then, the reader can evaluate more easily whether the answer is helpful for them or not. Thanks!
â Torsten Bronger
Dec 8 '16 at 7:42
If you downvote, please leave a comment why. Then, the reader can evaluate more easily whether the answer is helpful for them or not. Thanks!
â Torsten Bronger
Dec 8 '16 at 7:42
add a comment |Â
up vote
2
down vote
Your conn modify looks mostly right, but need to put a netmask on the address otherwise it'll get the default (probably /8, which may or may not be what you want). For instance, if you needed a class-c network (254 hosts, 10.1.1.1 through 254 in your case), you'd:
nmcli con modify 'Wired connection 1' ipv4.addresses "10.1.1.2/24"
You also need to apply the config to the running interface. I usually:
nmcli conn down "Wired Connection 1"
nmcli conn up !$
You may be able to just use conn up with out taking the interface down first.
Other note: you can run "nmcli conn show "Wired Connection 1" to get all the settings for that device. At the end of that, it'll also show the current settings in all caps.
connection.id: virbr0
connection.stable-id: --
connection.type: bridge
connection.interface-name: virbr0
[SNIP]
IP4.ADDRESS[1]: 192.168.122.1/24
IP4.GATEWAY: --
IP4.ROUTE[1]: dst = 192.168.122.0/24, nh = 0.0.0.0, mt = 0
IP6.GATEWAY: --
If someone else wants to validate this answer independently and leave comments on results, then I will mark this or the other answer as accepted. But I cannot validate myself as I am on to other things.
â CodeMed
Aug 5 at 6:59
add a comment |Â
up vote
2
down vote
Your conn modify looks mostly right, but need to put a netmask on the address otherwise it'll get the default (probably /8, which may or may not be what you want). For instance, if you needed a class-c network (254 hosts, 10.1.1.1 through 254 in your case), you'd:
nmcli con modify 'Wired connection 1' ipv4.addresses "10.1.1.2/24"
You also need to apply the config to the running interface. I usually:
nmcli conn down "Wired Connection 1"
nmcli conn up !$
You may be able to just use conn up with out taking the interface down first.
Other note: you can run "nmcli conn show "Wired Connection 1" to get all the settings for that device. At the end of that, it'll also show the current settings in all caps.
connection.id: virbr0
connection.stable-id: --
connection.type: bridge
connection.interface-name: virbr0
[SNIP]
IP4.ADDRESS[1]: 192.168.122.1/24
IP4.GATEWAY: --
IP4.ROUTE[1]: dst = 192.168.122.0/24, nh = 0.0.0.0, mt = 0
IP6.GATEWAY: --
If someone else wants to validate this answer independently and leave comments on results, then I will mark this or the other answer as accepted. But I cannot validate myself as I am on to other things.
â CodeMed
Aug 5 at 6:59
add a comment |Â
up vote
2
down vote
up vote
2
down vote
Your conn modify looks mostly right, but need to put a netmask on the address otherwise it'll get the default (probably /8, which may or may not be what you want). For instance, if you needed a class-c network (254 hosts, 10.1.1.1 through 254 in your case), you'd:
nmcli con modify 'Wired connection 1' ipv4.addresses "10.1.1.2/24"
You also need to apply the config to the running interface. I usually:
nmcli conn down "Wired Connection 1"
nmcli conn up !$
You may be able to just use conn up with out taking the interface down first.
Other note: you can run "nmcli conn show "Wired Connection 1" to get all the settings for that device. At the end of that, it'll also show the current settings in all caps.
connection.id: virbr0
connection.stable-id: --
connection.type: bridge
connection.interface-name: virbr0
[SNIP]
IP4.ADDRESS[1]: 192.168.122.1/24
IP4.GATEWAY: --
IP4.ROUTE[1]: dst = 192.168.122.0/24, nh = 0.0.0.0, mt = 0
IP6.GATEWAY: --
Your conn modify looks mostly right, but need to put a netmask on the address otherwise it'll get the default (probably /8, which may or may not be what you want). For instance, if you needed a class-c network (254 hosts, 10.1.1.1 through 254 in your case), you'd:
nmcli con modify 'Wired connection 1' ipv4.addresses "10.1.1.2/24"
You also need to apply the config to the running interface. I usually:
nmcli conn down "Wired Connection 1"
nmcli conn up !$
You may be able to just use conn up with out taking the interface down first.
Other note: you can run "nmcli conn show "Wired Connection 1" to get all the settings for that device. At the end of that, it'll also show the current settings in all caps.
connection.id: virbr0
connection.stable-id: --
connection.type: bridge
connection.interface-name: virbr0
[SNIP]
IP4.ADDRESS[1]: 192.168.122.1/24
IP4.GATEWAY: --
IP4.ROUTE[1]: dst = 192.168.122.0/24, nh = 0.0.0.0, mt = 0
IP6.GATEWAY: --
edited 5 mins ago
answered Aug 1 at 22:22
MattPie
212
212
If someone else wants to validate this answer independently and leave comments on results, then I will mark this or the other answer as accepted. But I cannot validate myself as I am on to other things.
â CodeMed
Aug 5 at 6:59
add a comment |Â
If someone else wants to validate this answer independently and leave comments on results, then I will mark this or the other answer as accepted. But I cannot validate myself as I am on to other things.
â CodeMed
Aug 5 at 6:59
If someone else wants to validate this answer independently and leave comments on results, then I will mark this or the other answer as accepted. But I cannot validate myself as I am on to other things.
â CodeMed
Aug 5 at 6:59
If someone else wants to validate this answer independently and leave comments on results, then I will mark this or the other answer as accepted. But I cannot validate myself as I am on to other things.
â CodeMed
Aug 5 at 6:59
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f236220%2fhow-do-i-use-nmcli-to-add-an-ip-address-to-an-interface%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password