728x90
반응형
어제 설치를 어느정도 하고나서, 새로운 난관이 앞에 기다리고 있었다...ㅡ.ㅡ;;

ip가 변경이 된것이다. 다행히 여기에서 같이 일하는 사토야마상이 해결해 줬지만..왠지 그냥 넘어가기에는 찜찜해서 자료를 좀 조사를 했다..


솔라리스는 모든 시스템 의 설정 값들을 /etc 안에 저장하게 된다고 한다.

이중 네트워크 관련 파일은 다음과 같다..

1. /etc/hosts
2. /etc/hostname.fjgi0 혹은 /etc/hostname.hme0
3. /etc/defaultrouter
4. /etc/resolv.conf
5. /etc/nsswitch.conf
6. /etc/inet/netmasks

이들 파일의 설정들을 바꾸어 준 후 재쿠팅을 하면 ip 설정이 변경이된다.

영구히 ip 바꾸기 


1. vi /etc/hosts
127.0.0.1 localhost
xxx.xxx.xxx.xxx 서버이름
 
위와 같이 되어있으며 이곳에 라우터등의 정보를 추가할 수 있다. 즉
 
127.0.0.1 localhost
xxx.xxx.xxx.xxx 서버이름
xxx.xxx.xxx.xxx 라우터이름(정해주면 된다. ip는 사용하고 있는 라우터 ip를 주면 된다.)
xxx.xxx.xxx.xxx 도메인이름(위와 같다)
  
2. vi /etc/defaultrouter
xxx.xxx.xxx.xxx 이렇게 직접 ip를 줘도 되고
라우터이름 <- hosts파일에서 설정한 라우터 이름으로 줘도 된다
 
3. vi /etc/resolv.conf
nameserver xxx.xxx.xxx.xxx 이렇게 직접 ip를 줘도 되고
nameserver 도메인 이름 <- hosts파일에서 설정한 도메인 이름으로 줘도 된다.
 
4. /etc/nsswitch.conf 
# /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 ~~~~~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

5. /etc/inet/netmasks file을 열고 맨밑부분에 netmask값을 넣어준다. 
# 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. Currently this number is restricted to being a class 
# A, B, or C network number. In the future we should be able to support 
# arbitrary network numbers per the Classless Internet Domain Routing 
# guidelines. 
# Both the network-number and the netmasks are specified in 
# \"decimal dot\" notation, e.g: 
# 128.32.0.0 255.255.255.0 
xxx.xxx.xxx.0 255.255.255.0 
~~~~~~왼쪽은 IP에서 끝자리는 0으로 하고, 오른쪽은 Subnet값을 넣어준다.
  
6 /etc/hostname.hme0 혹은 /etc/hostname.fjgi0 파일에 서버이름을 적어준다.

7 마지막으로 시스템을 리부팅한다.






임시 ip 바꾸기 




임시로 ip를 변경하는 방법을 알아보자 임시로 ip를 설정하면 재부팅 시 그 효과를 잃게 된다.
임시로 변경 ip를 변경해 보자
일단 ifconfig -a의 명령어로 현재 셋팅되어있는 ip를 알아보자

lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000 
fjgi0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet xxx.xxx.xxx.xxx netmask xxxxxxxx broadcast xxx.xxx.xxx.xxx
        ether 0:b:5d:f3:a2:c6
 
이제 변경해 보자 
ifconfig fjgi0 inet xxx.xxx.xxx.xxx netmask xxx.xxx.xxx.xxx broadcast + up
 
이제 임시로 ip와 netmask가 변경 되었다.
ifconfig -a로 변경 되었는지 확인해 보자
  
서버의 Network cable을 연결할 Port가 남아 있는가?
서버를 봤을 때 4개의 port가 있는데 그 중 3개만 사용할 경우
나머지 하나도 마저 사용하고 싶다면 아래와 같이 한다.
 
# cd /etc
# ls -l hostname*
의 결과가
hostname.hme0
hostname.hme1
hostname.hme2
라면
 
# ifconfig hme3 plumb
# ifconfig hme3 xxx.xxx.xxx.xxx netmask yyy.yyy.yyy.yyy broadcast + up
xxx.xxx.xxx.xxx: 해당 IP를 넣는다
yyy.yyy.yyy.yyy: 해당 Netmask를 넣는다.
설정이 끝나면 확인해 보자
# ifconfig -a
 
현재사용하고 있는 port를 사용하고 싶지 않다면
# ifconfig hme3 down unplumb
 
확인해 보자
# ifconfig -a
  
팁: netstat -rn 명령어로 현재 셋팅되어있는 라우팅 테이블을 확인할 수 있다.







728x90
반응형

+ Recent posts