Home How to Configure Network in RHEL 9.x (Using CLI)
Post
Cancel

How to Configure Network in RHEL 9.x (Using CLI)

1. IP 설정 정보

ITEMSCONFIG
Connection Namepublic-network
Static IPv4 Address / Subnet mask192.168.150.182/24
Static IPv6 Address / Subnet maskDisabled
IPv4 Default Gateway192.168.150.1
IPv4 DNS Server8.8.8.8
DNS Search Domaingoogle.com

2. 설정할 Network Device List 확인

1
2
3
4
5
6
7
8
9
10
# nmcli device show

< Output Example >  
GENERAL.DEVICE:                         ens192
GENERAL.TYPE:                           ethernet
. . . 

GENERAL.DEVICE:                         lo
GENERAL.TYPE:                           loopback
. . . 

3. Network Configuration

3.1 Add Connection Name

1
# nmcli connection add  con-name public-network ifname ens192 type ethernet 

설정 정보 확인

1
2
3
4
5
# nmcli -g connection.type,connection.interface-name connection show public-network

<Output Example> 
802-3-ethernet
ens192


nmcli 사용법에 대해 더 자세한 내용을 확인하고 싶으면, man nmcli-examples 또는, nmcli --help command를 입력하여 확인할 수 있다.


3.2 Set IPv4 Address and Gateway, IPv4 Method to Manual

1
2
3
4
5
6
7
8
9
< Set IPv4 IP Address > 
# nmcli connection modidfy public-network ipv4.addresses 192.168.150.182/24 

< Set IPv4 IP Gateway 
# nmcli connection modify public-network ipv4.gateway 192.168.150.1 

  
<Set IPv4 Method to Manual> 
# nmcli connection modify public-network ipv4.method manual 

설정 정보 확인

1
2
3
4
5
6
7
# nmcli -g ipv4.addresses,ipv4.gateway,ipv4.method connection show public-network
             

< Output Example> 
192.168.150.182/24		# IPv4 Address 
192.168.150.1			# IPv4 Gateway 
manual				# IPv4 Method ( Auto or Manual ) 

3.3 DNS Server Configuration

1
2
3
4
5
< Set IPv4 DNS Server > 
# nmcli connection modify public-network ipv4.dns "8.8.8.8"

< Set IPv4 DNS-search > 
# nmcli connection modify public-network ipv4.dns-search google.com 

설정 정보 확인

1
2
3
4
5
# nmcli -g ipv4.dns,ipv4.dns-search connection show public-network

<Output Example> 
8.8.8.8			# IPv4 DNS Server 
google.com		# IPv4 dns-search 

4. Set IPv6 Disable

1
# nmcli connection modify public-network ipv6.method disabled

설정 정보 확인

1
2
3
4
# nmcli -g ipv6 connection show public-network

<Output Example>
ipv6:disabled::::0::::-1:0::no:no:no:yes:-1:-1:default:0:auto:::0:yes::0x0:

5. Bring up ‘public-network’

1
# nmcli connection up public-network

6. Verifying Network

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# nmcli 

<Output Example> 
ens192: connected to public-network
        "VMware VMXNET3"
        ethernet (vmxnet3), 00:50:56:A1:28:53, hw, mtu 1500
        ip4 default
        inet4 192.168.150.182/24
        route4 192.168.150.0/24 metric 100
        route4 default via 192.168.150.1 metric 100

lo: unmanaged
        "lo"
        loopback (unknown), 00:00:00:00:00:00, sw, mtu 65536

DNS configuration:
        servers: 8.8.8.8
        domains: google.com
        interface: ens192
This post is licensed under CC BY 4.0 by the author.