Hello Friends,
lets discuss about few options in nmcli command, nmcli is a command-line tool for controlling NetworkManager and getting its status.in RHEL 7 configuration of network interfaces is managed by a system daemon called Network manager. Network configuration file will be available in /etc/sysconfig/network-scripts/ifcfg-name .The nmcli utility can be used to create, edit connection files from the shell prompt.
here i am demonstrating how to configure a network interface using nmcli command.
Configuring NIC using nmcli command :
Let us configure a eno16777736 NIC card in my server. run the #ip link to show the interfaces available in your system.
Now check the configuration available in the server run the following command to check the configuration.
#nmcli con show
There is no configuration present in this system now. lets add one now.
nmcli con add command used to add new connection .let us add the IP information to this interface. the syntax would be.
nmcli con add type <team, bridge,ethernet> con-name <connection name> ip4 <ipv4 address> gw4 <gateway ip>
Here is the command i used to configure the IP address and gateway to eno16777736 interface
Now check the configuration again . you could see that a new configuration is availble in nmcli con show command.
To get more details on the connection and settings that you can change you could run the following command.
nmcli con show <connection name>
[root@foundation ~]# nmcli con show eno1
connection.id: eno1
connection.uuid: 83888dcf-b4cd-4875-b566-3c07601803e5
connection.interface-name: eno16777736
connection.type: 802-3-ethernet
connection.autoconnect: yes
connection.timestamp: 1419290263
connection.read-only: no
connection.permissions:
connection.zone: --
connection.master: --
connection.slave-type: --
connection.secondaries:
connection.gateway-ping-timeout: 0
802-3-ethernet.port: --
802-3-ethernet.speed: 0
802-3-ethernet.duplex: --
802-3-ethernet.auto-negotiate: yes
802-3-ethernet.mac-address: --
802-3-ethernet.cloned-mac-address: --
802-3-ethernet.mac-address-blacklist:
802-3-ethernet.mtu: auto
802-3-ethernet.s390-subchannels:
802-3-ethernet.s390-nettype: --
802-3-ethernet.s390-options:
ipv4.method: manual
ipv4.dns:
ipv4.dns-search:
ipv4.addresses: { ip = 192.168.1.4/24, gw = 192.168.1.1 }
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
ipv6.method: auto
ipv6.dns:
ipv6.dns-search:
ipv6.addresses:
ipv6.routes:
ipv6.ignore-auto-routes: no
ipv6.ignore-auto-dns: no
ipv6.never-default: no
ipv6.may-fail: yes
ipv6.ip6-privacy: -1 (unknown)
ipv6.dhcp-hostname: --
GENERAL.NAME: eno1
GENERAL.UUID: 83888dcf-b4cd-4875-b566-3c07601803e5
GENERAL.DEVICES: eno16777736
GENERAL.STATE: activated
GENERAL.DEFAULT: yes
GENERAL.DEFAULT6: no
GENERAL.VPN: no
GENERAL.ZONE: --
GENERAL.DBUS-PATH: /org/freedesktop/NetworkManager/ActiveConnection/2
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/Settings/3
GENERAL.SPEC-OBJECT: --
GENERAL.MASTER-PATH: --
IP4.ADDRESS[1]: ip = 192.168.1.4/24, gw = 192.168.1.1
IP6.ADDRESS[1]: ip = fe80::20c:29ff:fe32:bf71/64, gw = ::
[root@foundation ~]#
Suppose if you want to change any setting in this you could run nmcli con mod command.
nmcli con mod <interface name> settings <value>
The below command is used to add the DNS address in the system.
These commands will update the information in /etc/sysconfig/network-scripts/ifcfg-eno1 file.
check the ip information using the ip add show <interface name> command.
hope this will be useful to you . I will be posting the teaming and bridging configuration using nmcli soon in next post !
lets discuss about few options in nmcli command, nmcli is a command-line tool for controlling NetworkManager and getting its status.in RHEL 7 configuration of network interfaces is managed by a system daemon called Network manager. Network configuration file will be available in /etc/sysconfig/network-scripts/ifcfg-name .The nmcli utility can be used to create, edit connection files from the shell prompt.
here i am demonstrating how to configure a network interface using nmcli command.
Configuring NIC using nmcli command :
Let us configure a eno16777736 NIC card in my server. run the #ip link to show the interfaces available in your system.
Now check the configuration available in the server run the following command to check the configuration.
#nmcli con show
There is no configuration present in this system now. lets add one now.
nmcli con add command used to add new connection .let us add the IP information to this interface. the syntax would be.
nmcli con add type <team, bridge,ethernet> con-name <connection name> ip4 <ipv4 address> gw4 <gateway ip>
Here is the command i used to configure the IP address and gateway to eno16777736 interface
Now check the configuration again . you could see that a new configuration is availble in nmcli con show command.
To get more details on the connection and settings that you can change you could run the following command.
nmcli con show <connection name>
[root@foundation ~]# nmcli con show eno1
connection.id: eno1
connection.uuid: 83888dcf-b4cd-4875-b566-3c07601803e5
connection.interface-name: eno16777736
connection.type: 802-3-ethernet
connection.autoconnect: yes
connection.timestamp: 1419290263
connection.read-only: no
connection.permissions:
connection.zone: --
connection.master: --
connection.slave-type: --
connection.secondaries:
connection.gateway-ping-timeout: 0
802-3-ethernet.port: --
802-3-ethernet.speed: 0
802-3-ethernet.duplex: --
802-3-ethernet.auto-negotiate: yes
802-3-ethernet.mac-address: --
802-3-ethernet.cloned-mac-address: --
802-3-ethernet.mac-address-blacklist:
802-3-ethernet.mtu: auto
802-3-ethernet.s390-subchannels:
802-3-ethernet.s390-nettype: --
802-3-ethernet.s390-options:
ipv4.method: manual
ipv4.dns:
ipv4.dns-search:
ipv4.addresses: { ip = 192.168.1.4/24, gw = 192.168.1.1 }
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
ipv6.method: auto
ipv6.dns:
ipv6.dns-search:
ipv6.addresses:
ipv6.routes:
ipv6.ignore-auto-routes: no
ipv6.ignore-auto-dns: no
ipv6.never-default: no
ipv6.may-fail: yes
ipv6.ip6-privacy: -1 (unknown)
ipv6.dhcp-hostname: --
GENERAL.NAME: eno1
GENERAL.UUID: 83888dcf-b4cd-4875-b566-3c07601803e5
GENERAL.DEVICES: eno16777736
GENERAL.STATE: activated
GENERAL.DEFAULT: yes
GENERAL.DEFAULT6: no
GENERAL.VPN: no
GENERAL.ZONE: --
GENERAL.DBUS-PATH: /org/freedesktop/NetworkManager/ActiveConnection/2
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/Settings/3
GENERAL.SPEC-OBJECT: --
GENERAL.MASTER-PATH: --
IP4.ADDRESS[1]: ip = 192.168.1.4/24, gw = 192.168.1.1
IP6.ADDRESS[1]: ip = fe80::20c:29ff:fe32:bf71/64, gw = ::
[root@foundation ~]#
Suppose if you want to change any setting in this you could run nmcli con mod command.
nmcli con mod <interface name> settings <value>
The below command is used to add the DNS address in the system.
These commands will update the information in /etc/sysconfig/network-scripts/ifcfg-eno1 file.
check the ip information using the ip add show <interface name> command.
hope this will be useful to you . I will be posting the teaming and bridging configuration using nmcli soon in next post !
how to edit a file using nmcli
ReplyDeleteThnks.