LFCS 네트워킹 단계별 실전

상태 확인, IP·route, 시간 동기화, SSH, firewalld, NAT, bridge·bond와 reverse proxy를 단계적으로 연습


실제 시험문항이 아니다. 원격 접속에 사용하는 유일한 NIC, route, SSH 허용 규칙을 직접 바꾸면 연결이 끊길 수 있다. 정적 네트워크·NAT·bond 실습은 console과 snapshot이 있는 격리 VM에서만 수행한다.

작성·검증 상태: AI가 영문 task·힌트·풀이의 구조화를 보조했다. NetworkManager·firewalld version별 option은 local manual에서 다시 확인한다.

네트워크 문제의 확인 순서

link → address → route → DNS → socket → firewall → application
ip -br link
ip -br address
ip route
resolvectl status
ss -lntup
firewall-cmd --get-active-zones

각 단계에서 현재 kernel state와 재부팅 후에도 남는 profile/configuration을 따로 확인한다. 원격 시험 환경에서는 관리 NIC와 현재 SSH route를 먼저 표시해 두고, 제공된 실습 connection만 수정한다.

요구먼저 떠올릴 도구
address·gateway·DNS·route 영속 설정nmcli connection
현재 address·routeip address, ip route
이름 해석getent ahosts, resolvectl
listener·연결ss, curl, nc
방화벽firewall-cmd
SSH 설정 검증sshd -t, sshd -T
시간 동기화timedatectl, chronyc

문제 1 — firewalld runtime과 permanent

English

Ensure firewalld is running now and at boot. Allow the http service and TCP port 8080 in the default zone, persistently and immediately. Preserve existing rules.

한국어

방화벽을 현재·부팅 시 실행하고 기본 zone에 HTTP와 8080/tcp를 영구·즉시 허용한다. 기존 규칙은 보존한다.

연결표

요구선택
현재와 부팅 시 serviceenable --now
재부팅 후 유지--permanent
현재 규칙에도 반영--reload 또는 runtime rule 추가
default zone--zone 생략 가능
실제 NIC zone--get-active-zones
풀이 예시
systemctl enable --now firewalld
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-port=8080/tcp
firewall-cmd --reload
firewall-cmd --list-services
firewall-cmd --list-ports
firewall-cmd --permanent --list-services
firewall-cmd --permanent --list-ports

public은 firewalld가 제공하는 기본 zone 이름 중 하나다. 기본 zone과 실제 interface가 연결된 active zone은 다를 수 있으므로 문제 문장을 구분한다.

문제 2 — static address와 route

English

On the provided lab connection, configure IPv4 192.0.2.10/24, gateway 192.0.2.1, DNS 192.0.2.53, and a persistent route to 198.51.100.0/24 through 192.0.2.254.

한국어

제공된 NetworkManager connection에 고정 IPv4, gateway, DNS와 추가 static route를 설정한다. 기존 route와 관리 connection은 보존한다.

1차 가이드

nmcli connection show
nmcli device status

연결 이름과 장치 이름을 같다고 가정하지 않는다. nmcli connection modify로 profile을 바꾸고 연결을 다시 올린 뒤 kernel state와 profile을 모두 확인한다.

명령 형태
nmcli connection modify '<CONNECTION>' \
  ipv4.method manual \
  ipv4.addresses 192.0.2.10/24 \
  ipv4.gateway 192.0.2.1 \
  ipv4.dns 192.0.2.53 \
  +ipv4.routes '198.51.100.0/24 192.0.2.254'
nmcli connection up '<CONNECTION>'
ip -br address
ip route
ip route get 198.51.100.10

+ipv4.routes는 기존 route 목록에 추가한다. ipv4.routes만 사용하면 기존 profile route를 교체할 수 있다. 원격 연결을 바꾸기 전에 nmcli connection show --active와 ip route get <관리자-IP>를 확인한다.

문제 3 — time synchronization

English

Configure the system to synchronize time with the provided NTP server 192.0.2.123. Keep the service enabled and verify the selected source.

한국어

제공된 NTP server를 chrony source로 설정하고 서비스를 현재와 부팅 시 실행한다. 단순 active가 아니라 해당 source가 실제 선택됐는지 확인한다.

연결표

chrony config → chronyd enable/restart → timedatectl → chronyc sources/tracking

배포판에서 사용하는 config 경로와 directive를 man chrony.conf에서 확인한다. 설정 후에는 service가 active인 것만 보지 말고 실제 source 선택 상태를 확인한다.

Rocky/RHEL 풀이 예시

/etc/chrony.conf에 기존 요구를 보존하면서 다음 source를 추가하거나, 문제에서 지정한 기존 source를 교체한다.

server 192.0.2.123 iburst
chronyd -Q -f /etc/chrony.conf
systemctl enable --now chronyd
systemctl restart chronyd
timedatectl status
chronyc sources -v
chronyc tracking

Ubuntu/Debian 계열은 service 이름과 기본 config 위치가 다를 수 있으므로 systemctl list-unit-files | grep -E 'chrony|timesync'로 확인한다.

문제 4 — OpenSSH key와 server 설정

English

Configure Ed25519 key authentication for user deploy on the provided server. Validate the SSH server configuration before reloading it. Do not disable password authentication until key login succeeds in a separate session.

한국어

deploy 사용자용 Ed25519 key 인증을 구성한다. 서버 설정을 검사하고 별도 session에서 key 로그인이 성공하기 전에는 기존 로그인 방식을 차단하지 않는다.

핵심 검증

namei -l /home/deploy/.ssh/authorized_keys
sshd -t
ssh -i KEY -o IdentitiesOnly=yes deploy@SERVER id
journalctl -u sshd -n 20 --no-pager

.ssh는 보통 700, authorized_keys는 600이며 사용자 소유여야 한다. Rocky/RHEL은 sshd, Debian/Ubuntu는 ssh service 이름을 사용할 수 있다.

안전한 구성 순서

client에서 key가 없다면:

ssh-keygen -t ed25519 -f ~/.ssh/lfcs_deploy -N ''

server에서 제공된 public key를 설치한다.

install -d -m 700 -o deploy -g deploy /home/deploy/.ssh
install -m 600 -o deploy -g deploy /dev/null /home/deploy/.ssh/authorized_keys
# 제공된 public key 한 줄을 authorized_keys에 추가
namei -l /home/deploy/.ssh/authorized_keys
sshd -t
systemctl reload sshd

별도 client session에서:

ssh -i ~/.ssh/lfcs_deploy -o IdentitiesOnly=yes deploy@SERVER id

성공 후에만 문제에서 요구한 PermitRootLogin, PasswordAuthentication, AllowUsers 등을 변경하고 다시 sshd -t 후 reload한다.

문제 5 — port redirection

English

Redirect incoming TCP port 80 to an existing local service on TCP 8080 in the active zone. Make the rule persistent and verify an actual HTTP request.

한국어

active zone으로 들어오는 TCP 80을 같은 host의 8080 service로 redirect하고, 현재·재부팅 후 규칙과 실제 HTTP 응답을 확인한다.

firewalld 명령 형태
firewall-cmd --get-active-zones
firewall-cmd --permanent --zone=<ACTIVE_ZONE> \
  --add-forward-port=port=80:proto=tcp:toport=8080
firewall-cmd --reload
firewall-cmd --zone=<ACTIVE_ZONE> --list-forward-ports
curl http://127.0.0.1:80/

다른 호스트로 DNAT하면 IP forwarding, forward 허용, return route와 source NAT까지 추가로 고려한다. 단순 local port redirection과 같은 문제로 취급하지 않는다.

문제 6 — bridge와 bond

English

Create the requested persistent bridge or active-backup bond using the provided unused interfaces. Preserve the management interface.

한국어

제공된 미사용 NIC만 사용해 영구 bridge 또는 active-backup bond를 만든다. 현재 관리 NIC는 건드리지 않는다.

먼저 찾을 것

nmcli device status
nmcli connection show
ip -br link

문제에 제공되지 않은 NIC를 임의로 slave로 넣지 않는다. 생성 후 nmcli connection show, ip link, bond라면 /proc/net/bonding/<NAME>에서 실제 member와 active slave를 검증한다.

명령 형태

active-backup bond 예시:

nmcli connection add type bond ifname bond0 con-name bond0 \
  bond.options 'mode=active-backup,miimon=100'
nmcli connection add type ethernet ifname <NIC1> con-name bond0-port1 controller bond0
nmcli connection add type ethernet ifname <NIC2> con-name bond0-port2 controller bond0
nmcli connection modify bond0 ipv4.method manual ipv4.addresses <ADDRESS/PREFIX>
nmcli connection modify bond0 connection.autoconnect-ports 1
nmcli connection up bond0
cat /proc/net/bonding/bond0

bridge 예시:

nmcli connection add type bridge ifname br0 con-name br0
nmcli connection add type ethernet ifname <NIC1> con-name br0-port1 controller br0
nmcli connection modify br0 ipv4.method manual ipv4.addresses <ADDRESS/PREFIX>
nmcli connection modify br0 connection.autoconnect-ports 1
nmcli connection up br0
ip -br link show br0
bridge link

실제 address, gateway, DNS는 문제에서 제공한 값만 사용한다.

문제 7 — reverse proxy

English

Configure Nginx to listen on TCP 8081 and proxy requests to the provided backend 127.0.0.1:9000. Validate the configuration before reload and verify both direct and proxied responses.

한국어

Nginx가 8081에서 요청을 받아 제공된 backend 9000으로 전달하게 한다. backend 직접 응답, Nginx 문법, proxy 응답 순서로 확인한다.

핵심 server block
server {
    listen 8081;
    server_name _;

    location / {
        proxy_pass http://127.0.0.1:9000;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}
curl http://127.0.0.1:9000/
nginx -t
systemctl reload nginx
ss -lntp | grep ':8081'
curl http://127.0.0.1:8081/

SELinux enforcing 환경에서 nonstandard HTTP port 때문에 거부되면 AVC를 확인한 뒤 http_port_t에 포트를 추가한다. 무조건 SELinux를 끄지 않는다.

문제 8 — IPv6와 hostname resolution

English

On the provided connection, add persistent IPv6 address 2001:db8:9::10/64 and DNS server 2001:db8:53::53. Ensure app9.example.test resolves to 192.0.2.90 locally without breaking DNS resolution.

한국어

지정 connection에 IPv6와 IPv6 DNS를 영구 설정하고, 기존 DNS를 망가뜨리지 않으면서 local hostname mapping 하나를 추가한다.

풀이 형태
nmcli connection modify '<CONNECTION>' \
  ipv6.method manual \
  ipv6.addresses '2001:db8:9::10/64' \
  +ipv6.dns '2001:db8:53::53'
nmcli connection up '<CONNECTION>'
printf '192.0.2.90 app9.example.test app9\n' >> /etc/hosts

ip -6 address show
nmcli -f ipv6.addresses,ipv6.dns connection show '<CONNECTION>'
getent ahosts app9.example.test
getent hosts example.com

/etc/hosts는 local mapping이고 DNS server 설정은 connection profile이다. 둘을 같은 요구로 보지 않는다.

문제 9 — source NAT와 forwarding

English

Enable IPv4 forwarding persistently and configure masquerading in the provided external firewalld zone so that the lab subnet can reach external networks. Preserve existing rules.

한국어

IPv4 forwarding을 현재·영구 적용하고, 지정된 외부 zone에 masquerading을 현재·영구 구성한다. 기존 firewall rule은 보존한다.

풀이 형태

/etc/sysctl.d/90-lfcs-forward.conf:

net.ipv4.ip_forward = 1
sysctl -p /etc/sysctl.d/90-lfcs-forward.conf
firewall-cmd --permanent --zone=<EXTERNAL_ZONE> --add-masquerade
firewall-cmd --reload
sysctl net.ipv4.ip_forward
firewall-cmd --zone=<EXTERNAL_ZONE> --query-masquerade
firewall-cmd --permanent --zone=<EXTERNAL_ZONE> --query-masquerade

실제 end-to-end 검증에는 내부 client의 default route, forward policy, 외부 return path가 모두 필요하다. server 한 대의 설정 출력만으로 packet 전달 성공을 단정하지 않는다.

조건 변형 대비

문제 표현핵심 선택
default zonefirewall-cmd --get-default-zone
active zonefirewall-cmd --get-active-zones
current onlyruntime rule, --permanent 없음
persistent and immediatepermanent 추가 후 reload 또는 runtime도 별도 추가
add a route+ipv4.routes로 기존 route 보존
local port redirectforward-port의 toport
another host로 DNATforwarding·zone policy·return route·필요 시 masquerade까지 확인
reverse proxy one backendproxy_pass
load balance several backendsNginx upstream에 여러 server와 health/failure 조건 구성

자가 채점

  • default zone과 active zone을 구분했다.
  • runtime과 permanent firewall 결과를 각각 확인했다.
  • connection profile과 현재 kernel networking state를 모두 확인했다.
  • SSH·Nginx 설정을 reload 전에 문법 검사했다.
  • listener 확인뿐 아니라 실제 client request를 보냈다.
  • 관리 NIC와 현재 SSH 경로를 보존했다.
  • IPv4와 IPv6의 profile·kernel state를 각각 확인했다.
  • port redirection과 source NAT를 구분했다.