## Configure the network

1. nmtui

2. nmcli

A) If you don't have any NetworkManager connection:

A.1) Add new NetworkManager connection:

nmcli con add con-name "Exam" ifname eth0 type ethernet ip4 172.25.201.X/24 gw4 172.25.201.254
nmcli con mod "Exam" ipv4.dns "172.25.201.254"
nmcli con mod "Exam" ipv4.method manual
nmcli con mod "Exam" connection.autoconnect yes

A.2) Activate new NetworkManager connection:

nmcli con up "Exam"

A.3) Verify NetorkManager connection and /etc/resolv.conf file:

nmcli con show "Exam"

cat /etc/resolv.conf

-------------------------------------------------------------------------

B) If you already have NetworkManager connection:

B.1) Add another NetworkManager connection:

nmcli con add con-name "Exam" ifname eth0 type ethernet ip4 172.25.201.X/24 gw4 172.25.201.254
nmcli con mod "Exam" ipv4.dns "172.25.201.254"
nmcli con mod "Exam" ipv4.method manual
nmcli con mod "Exam" connection.autoconnect yes

B.1.2) Activate new NetworkManager connection:

nmcli con up "Exam"

B.1.3) Disable old NetworkManager connection to Automatically connect during system start-up:

nmcli con mod "System eth0" connection.autoconnect no

B.1.4) Check NetworkManager connections and verify new NetworkManager connection:

nmcli con show
nmcli con show --active
nmcli con show "Exam"

B.1.5) optional - remove old unwanted NetworkManager connection:

nmcli con del "System eth0"

B.2) Edit already existing NetworkManager connection:

nmcli con mod "System eth0" ip4 172.25.201.X/24
nmcli con mod "System eth0" ipv4.gateway 172.25.201.254
nmcli con mod "System eth0" ipv4.dns "172.25.201.254"
nmcli con mod "System eth0" ipv4.method manual
nmcli con mod "System eth0" connection.autoconnect yes

B.2.1) Activate updated NetworkManager connection:

nmcli con up "System eth0"

B.2.2) Verify updated NetworkManager connection:

nmcli con show "System eth0"

-------------------------------------------------------------------------

## Useful nmcli commands

# To see a list of network devices and their state:

nmcli dev
or
nmcli dev status

# Show detailed information about devices:

nmcli dev show
and
nmcli dev show (device)

# To bring down an interface and temporarily disable autoconnect use command:

nmcli dev dis (device)

# Connect the device

nmcli dev con (device)

# To disable or enable all managed interfaces use command:

nmcli net off
nmcli net on

# To turn off wifi:

nmcli r wifi off

-------------------------------------------------------------------------

### Source -> https://www.youtube.com/watch?v=v-soSvSsw18&feature=share


┌───────────────────────────┤ Edit Connection ├───────────────────────────┐
│                                                                         │
│         Profile name Exam____________________________________           │
│               Device ________________________________________           │
│                                                                         │
│ ═ ETHERNET                                                    <Show>    │
│                                                                         │
│ ╤ IPv4 CONFIGURATION <Manual>                                 <Hide>    │
│ │          Addresses 10.0.2.103/8_____________ <Remove>                 │
│ │                    <Add...>                                           │
│ │            Gateway 10.0.2.1_________________                          │
│ │        DNS servers 10.0.2.1_________________ <Remove>                 │
│ │                    <Add...>                                           │
│ │     Search domains <Add...>                                           │
│ │                                                                       │
│ │            Routing (No custom routes) <Edit...>                       │
│ │ [ ] Never use this network for default route                          │
│ │ [ ] Ignore automatically obtained routes                              │
│ │ [ ] Ignore automatically obtained DNS parameters                      │
│ │                                                                       │
│ │ [ ] Require IPv4 addressing for this connection                       │
│ └                                                                       │
│                                                                         │
│ ═ IPv6 CONFIGURATION <Automatic>                              <Show>    │
│                                                                         │
│ [X] Automatically connect                                               │
│ [X] Available to all users                                              │
│                                                                         │
│                                                           <Cancel> <OK> │