본문 바로가기

맥(솔라리스)

[솔라리스] OpenSolaris 네트워크를 설정하는 방법

반응형

OpenSolaris 네트워크를 설정하는 방법

OpenSolaris에서 네트워크는 Linux와 다르게 일부 설정 파일 기반으로 관리됩니다.

고정 IP 설정, 게이트웨이, DNS, 이름 해석 순서, 호스트 파일, 자동 네트워크 서비스(NWAM) 기준으로 정리하였습니다.

1. 네트워크 인터페이스 확인

시스템의 NIC(Device Name)를 확인합니다.

ifconfig -a
iprb0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500
  • 네트워크 인터페이스명 iprb0

2. IP 주소 설정 (Static IP)

OpenSolaris는 /etc/hostname.<인터페이스명> 파일에 IP 주소 또는 호스트명을 입력하여 부팅 시 네트워크를 활성화합니다.

vi /etc/hostname.iprb0
10.0.10.100
  • 인터페이스 iprb0 에 IP 10.0.10.100 할당
  • 재부팅 후 자동 적용

3. Netmask 설정

vi /etc/netmasks
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License"). You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright 2000 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
#
# The netmasks file associates Internet Protocol (IP) address
# masks with IP network numbers.
#
# network-number netmask
#
# The term network-number refers to a number obtained from the Internet Network
# Information Center.
#
# Both the network-number and the netmasks are specified in
# "decimal dot" notation, e.g:
#
# 128.32.0.0 255.255.255.0
#

10.0.10.0 255.255.255.0
  • 네트워크 대역 10.0.10.0/24
  • 서브넷 마스크 255.255.255.0

4. 기본 게이트웨이 설정

vi /etc/defaultrouter
10.0.10.1
  • 외부 네트워크 통신을 위한 기본 라우터 설정

5. DNS 설정

vi /etc/resolv.conf
nameserver 10.0.10.2

추가 예시

search example.local
nameserver 10.0.10.2
nameserver 8.8.8.8
  • DNS 서버 지정
  • 여러 개 등록 가능

6. 이름 해석 순서 (NSSwitch)

vi /etc/nsswitch.conf
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
#
# /etc/nsswitch.files:
#
# An example file that could be copied over to /etc/nsswitch.conf; it
# does not use any naming service.
#
# "hosts:" and "services:" in this file are used only if the
# /etc/netconfig file has a "-" for nametoaddr_libs of "inet" transports.
passwd: files
group: files
hosts: files dns
ipnodes: files
networks: files
protocols: files
rpc: files
ethers: files
netmasks: files
bootparams: files
publickey: files
# At present there isn't a 'files' backend for netgroup; the system will
# figure it out pretty quickly, and won't use netgroups at all.
netgroup: files
automount: files
aliases: files
services: files
printers: user files
auth_attr: files
prof_attr: files
project: files
tnrhtp: files
tnrhdb: files
  • files → /etc/hosts 먼저 조회
  • dns → DNS 서버 조회

즉, 호스트명 조회 순서는

  1. /etc/hosts
  2. DNS 서버
원본 내용에서는 hosts: files dnsipnodes: files 처럼 붙어 있었는데 줄바꿈이 깨진 것으로 보입니다.
정상 형식은 아래와 같습니다.
hosts: files dns
ipnodes: files
728x90

7. 호스트 파일 설정

vi /etc/hosts
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
#
# Internet host table
#
::1 opensolaris opensolaris.local localhost loghost
127.0.0.1 opensolaris.local localhost loghost
  • 로컬 이름 해석용 정적 호스트 파일
  • DNS 없이 서버 간 통신 가능

8. NWAM(Network Auto Magic) 확인

OpenSolaris는 자동 네트워크 관리 서비스 NWAM 이 동작할 수 있습니다.

cat /etc/nwam/llp
iprb0 dhcp
iprb0 priority 0
  • iprb0 인터페이스가 DHCP 사용 중
  • 우선순위 0

9. 고정 IP 사용 시 주의사항

NWAM이 활성화되어 있으면 수동 설정(static IP)과 충돌할 수 있습니다.

 

NWAM 서비스 확인

svcs | grep nwam

비활성화

svcadm disable nwam

일반 네트워크 서비스 활성화

svcadm enable network/physical:default

10. 설정 적용

재부팅 또는 네트워크 서비스 재시작

reboot

또는

svcadm restart network/physical

11. 설정 확인

IP 확인

ifconfig -a

라우팅 확인

netstat -rn

DNS 확인

nslookup google.com

통신 확인

ping 10.0.10.1
ping google.com

 

OpenSolaris는 NWAM(DHCP 자동관리) 과 수동 Static 설정이 동시에 존재할 수 있으므로 서버 운영 환경에서는 NWAM 비활성화 + 정적 IP 설정 방식이 일반적입니다.

 

728x90
반응형