VyOS 소개와 사용법

VyOS 라우터 사용 가이드입니다. configure/commit/save 흐름, NAT gateway 예시, DNS forwarding, 정적 라우팅, 설정 백업과 문제 해결 기준을 정리했습니다.

VyOS는 라우팅, 방화벽, NAT, VPN 기능을 제공하는 오픈소스 네트워크 OS입니다. Linux 기반이지만 일반 Linux 서버처럼 파일을 직접 수정하는 방식보다, Junos와 비슷한 configure, commit, save 흐름으로 설정을 관리합니다.

명령어 목록만 나열하지 않고, 작은 NAT gateway를 만든다는 기준으로 실제 설정 흐름과 점검 순서를 정리합니다.

운영 모드와 설정 모드

show version
show interfaces
show ip route
configure
show
exit

일반 프롬프트는 operational mode이고, configure로 들어가면 configuration mode가 됩니다. 설정 모드에서 set으로 후보 설정을 만들고, commit으로 적용하고, save로 재부팅 후에도 유지합니다.

기본 NAT gateway 예시

예시는 eth0이 WAN, eth1이 LAN인 작은 랩입니다. 실제 인터페이스 이름은 show interfaces로 확인합니다.

configure
set system host-name vyos-lab
set interfaces ethernet eth0 description 'WAN'
set interfaces ethernet eth0 address dhcp
set interfaces ethernet eth1 description 'LAN'
set interfaces ethernet eth1 address '192.168.10.1/24'
commit
save
exit

Source NAT 설정

configure
set nat source rule 100 description 'LAN to WAN masquerade'
set nat source rule 100 outbound-interface name eth0
set nat source rule 100 source address '192.168.10.0/24'
set nat source rule 100 translation address masquerade
commit
save
exit

LAN 클라이언트의 default gateway를 192.168.10.1로 설정하면 외부로 나가는 트래픽이 WAN 주소로 변환됩니다.

상태 확인

show interfaces
show ip route
show nat source rules
show conntrack table ipv4
ping 8.8.8.8
ping google.com

IP ping은 되는데 DNS 이름이 안 되면 라우팅보다 DNS 설정을 먼저 봅니다.

DNS forwarding

configure
set service dns forwarding listen-address '192.168.10.1'
set service dns forwarding allow-from '192.168.10.0/24'
set service dns forwarding system
commit
save
exit

정적 라우팅

configure
set protocols static route 10.20.0.0/16 next-hop 192.168.10.254
commit
save
exit

정적 라우트는 목적지 CIDR과 next-hop이 핵심입니다. route가 맞아도 반대편 return route가 없으면 통신이 되지 않습니다.

설정 비교와 롤백

configure
set system name-server 1.1.1.1
compare
commit
save
exit

변경 전후 차이는 compare로 확인합니다. 원격 장비에서는 네트워크 설정을 바꾸다 접속이 끊길 수 있으므로, 가능하면 console 접근이나 rollback 계획을 확보합니다.

설정 백업

show configuration
show configuration commands
cp /config/config.boot /config/config.boot.backup

show configuration commands 출력에는 password, key, tunnel secret 같은 민감값이 포함될 수 있습니다. 외부 공유 전 반드시 마스킹합니다.

문제 해결 기준

  • 인터페이스 link/IP가 맞는지 show interfaces로 확인합니다.
  • default route와 목적지 route를 show ip route로 확인합니다.
  • NAT가 필요한 구간인지, source rule이 outbound interface와 source CIDR에 맞는지 확인합니다.
  • 방화벽을 적용했다면 어느 방향과 어느 interface에 적용했는지 먼저 확인합니다.
  • 원격 장비 설정 변경은 commit-confirm 같은 안전 절차를 검토합니다.

공식 문서

BGM EVER