※ 다시 시작할때 multi-user 레벨(3번 레벨)로 실행하는 명령어
※ <방법 1> 네트워크 설정 창 여는 명령어 - 그래픽으로 주소 주는 방법
<방법1> [nmtui] NetworkManager 를 Terminal UI
nmcli device status
nmtui
init 6
● rocky linux 9 Network 구성
- rocky linux 9 에서는 하위 버전과 다르게 network 구동이 NetworkManager로 통일 됨
- 하위 OS에서 사용하던 network-scripts 사용하는 방법은 참고하기(방법 3)
ip addr //IP 주소 확인
netstat -rn //Gateway 주소 확인 (0.0.0.0이 게이트웨이 있는 곳)
cat /etc/resolv.conf //DNS서버 주소 확인
※ <방법2> [nmcli] NetworkManager를 cli
nmcli device status
nmcli con mod ens160 ipv4.method manual ipv4.address 192.168.1.30/24 gw4
192.168.1.2 ipv4.dns "8.8.8.8 8.8.4.4"
init 6
● 설정 후 재부팅 하기 귀찮다면 연결(connection)을 down했다가 up을 하면 재부팅하지 않고도 설정이 적용된다. (랜카드 비활성화/활성화)
nmcli con down ens160
nmcli con up ens160
또는
systemctl restart NetworkManager
※ <방법3>
nmcli connection //device 이름 확인 및 uuid확인
ifconfig //IP주소 확인
cd /etc/sysconfig/network-scripts
ls
vi /etc/sysconfig/network-scripts/ifcfg-ens160
TYPE=Ethernet
BOOTPROTO=static #none <-> dhcp
NAME=ens160 # device name
UUID=5ed5886b-5c78-39b0-bd96-96ba1282bdf6 # device name (nmcli connection으로 uuid확인 후 입력)
DEVICE=ens160 # device name
ONBOOT=yes # 부팅 시 랜카드 활성화
IPADDR=192.168.1.190 # device ip
PREFIX=24 # device netmask # 255.0.0.0=/8, 255.255.0.0=/16, 255.255.255.0=/24
GATEWAY=192.168.1.2 # device gateway
DNS1=8.8.8.8 # DNS서버의 주소 #192.168.1.2
esc -> wq
## linux 9 devel repo에 network-scripts 패키지 존재
dnf install -y network-scripts --enablerepo=devel ## yum = dnf = (apt우분투)
## NetworkManager 중지 및 network 자동 시작 등록
systemctl enable network # 부팅 시 자동시작
systemctl disable NetworkManager
systemctl restart network # start/stop/restart(stop->start)
systemctl stop NetworkManager
ip addr # 192.168.1.190
<실습> 각 Server IP 등록
■ 참고: centos5
ifconfig
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static ##dhcp -> static(none)
HWARADDR=생략
IPADDR=192.168.10.11 ##주소입력
NETMASK=255.255.255.0 ##subnet maks 입력 ##PREFIX=24
GATEWAY=192.168.10.2 ##gateway 입력
DNS1=192.168.10.2 ##DNS서버 입력
# service network restart
또는
# ifdown eth0
# ifup eth0
'Linux' 카테고리의 다른 글
DHCP 주소 할당 & DNS 서버 & Web 서버 실습 (11/12) (0) | 2025.02.24 |
---|---|
CentOS 5 & Rocky 9 & Ubuntu 22 & Window server (11/05) (0) | 2025.02.24 |
마스터 DNS 서버 구축 (10/29) (0) | 2025.02.24 |
리눅스 명령어 추가, WEB & DNS 서버 (10/08, 10/15) (0) | 2025.02.20 |
리눅스 기초(레드헷) - (09/24, 10/01) (0) | 2025.02.20 |