Software >> OS >> Unix >> Linux >> RHEL >> 7 >> How to assign static IP to a new network itnerface



## e.g. new network interface (enp0s9) added to the system

[root@rhel7mgmt1 ~]# nmcli device status
DEVICE      TYPE      STATE         CONNECTION
enp0s3      ethernet  connected     enp0s3    
virbr0      bridge    connected     virbr0    
enp0s8      ethernet  connected     enp0s8    

enp0s9      ethernet  disconnected  --        
lo          loopback  unmanaged     --        
virbr0-nic  tun       unmanaged     --


## activate the connection

[root@rhel7mgmt1 ~]# nmcli con add con-name enp0s9 type ethernet ifname enp0s9
Connection 'enp0s9' (155866d3-4ce7-4d71-8ca9-c6d709be6e03) successfully added.


## then define the IP addresses and set method to manual

[root@rhel7mgmt1 ~]# nmcli con mod enp0s9 ipv4.addresses "192.168.1.30/24"

[root@rhel7mgmt1 ~]# nmcli con mod enp0s9 ipv4.method manual

[root@rhel7mgmt1 ~]# nmcli con show
NAME    UUID                                  TYPE      DEVICE
enp0s3  6ba6c0b1-ea4e-4dd5-aa19-cf8f69a10c07  ethernet  enp0s3
enp0s9  155866d3-4ce7-4d71-8ca9-c6d709be6e03  ethernet  enp0s9
enp0s8  a58f03fd-1707-4bd2-8e1d-767ec3b304f2  ethernet  enp0s8
virbr0  cae7ac83-8810-4f46-bc2a-9eb4e20834c3  bridge    virbr0