'Server(O/S)'에 해당되는 글 1건
-
CentO/S - 네트워크 설정 -1
2015.11.23
CentO/S - 네트워크 설정 -1
1. 최상위 경로 이동
[root@localhost /]# cd /
2. eth0 살아있는지 확인
(현재 활성화 되어있는 eth(이더넷=랜카드, 리눅스에서는 eth)
[root@localhost /]# ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
[root@localhost /]#
(활성화 되어있다면 lo(루프백) 말고 eth0, eth1 등등 나와야함...!
H/W 서버에서는 랜카드 = NIC(네트워크 인터페이스 콘트롤러 라고 블림 SE라면 용어정도는 알아야...!!)
3-1. eth0 활성화 시키로 이동(윈도우는 네트워크 어뎁터 > 로컬 영역 > 마우스 오른클릭 > 연결 사용하기 클릭)
경로 - cd /etc//sysconfig/network-scripts/ifcfg-eth0
[root@localhost /]# cd /etc//sysconfig/network-scripts/
- 현재 디렉토리 리스트 보기 명령어 : ls
- ifcfg = Interface Config 약자
[root@localhost network-scripts]# ls
ifcfg-eth0 ifdown-isdn ifup-aliases ifup-plusb init.ipv6-global
ifcfg-lo ifdown-post ifup-bnep ifup-post net.hotplug
ifdown ifdown-ppp ifup-eth ifup-ppp network-functions
ifdown-bnep ifdown-routes ifup-ippp ifup-routes network-functions-ipv6
ifdown-eth ifdown-sit ifup-ipv6 ifup-sit
ifdown-ippp ifdown-tunnel ifup-isdn ifup-tunnel
ifdown-ipv6 ifup ifup-plip ifup-wireless
[root@localhost network-scripts]#
3-2. vi편집기 열기
[root@localhost network-scripts]# vi ifcfg-eth0
HWADDR=9E:FB:D3:F3:D6:64
TYPE=Ethernet
UUID=779f69f8-9b79-4e1b-a407-024eded11737
ONBOOT=no
NM_CONTROLLED=yes
BOOTPROTO=dhcp
-----------------------------------------
3-2. 죽어있던 eth0 살리기
변경전 ONBOOT=no 변경후 ONBOOT=yes
** 편집기에서 그냥 키보드 치면 키가 안눌리죠?
이것은 리눅스에서 기본적으로 제공하는 vi편집기 만의 특성입니다.
추후에 vi편기는 따로 정리 하겠습니다.
우선은 eth0부터 살려야 통신을 할수 있으니 살리는것부터 합니다.
키보드 방향키를 이용하여 깜빡이는 커서를 ONBOOT=no 알바벳 n에 놓고 r
를 누르고 yes 타이핑
DEVICE=eth0
HWADDR=9E:FB:D3:F3:D6:64
TYPE=Ethernet
UUID=779f69f8-9b79-4e1b-a407-024eded11737
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp
-----------------------------------------
키보드 esc 누름
:wq!
네트워크 재시작
[root@localhost network-scripts]# service network restart
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0:
Determining IP information for eth0... done.
[ OK ]
[root@localhost network-scripts]#
eth0 살았나 확인 명령어
[root@localhost network-scripts]# cd /
[root@localhost /]# ifconfig
eth0 Link encap:Ethernet HWaddr 9E:FB:D3:F3:D6:64
inet addr:10.203.66.217 Bcast:10.203.67.255 Mask:255.255.254.0
inet6 addr: fe80::9cfb:d3ff:fef3:d664/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1941 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:107812 (105.2 KiB) TX bytes:1364 (1.3 KiB)
Interrupt:246
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
[root@localhost /]#
★ 고정 IP 주기
[root@localhost network-scripts]# cd /
[root@localhost /]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# ls
ifcfg-eth0 ifdown-isdn ifup-aliases ifup-plusb init.ipv6-global
ifcfg-lo ifdown-post ifup-bnep ifup-post net.hotplug
ifdown ifdown-ppp ifup-eth ifup-ppp network-functions
ifdown-bnep ifdown-routes ifup-ippp ifup-routes network-functions-ipv6
ifdown-eth ifdown-sit ifup-ipv6 ifup-sit
ifdown-ippp ifdown-tunnel ifup-isdn ifup-tunnel
ifdown-ipv6 ifup ifup-plip ifup-wireless
[root@localhost network-scripts]# vi ifcfg-eth0
DEVICE=eth0
HWADDR=9E:FB:D3:F3:D6:64
TYPE=Ethernet
UUID=779f69f8-9b79-4e1b-a407-024eded11737
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp
---------------------------------------
여기서 추가
VI편집기 가장 아래로 커서 내려놓고
Shift + A 누루고 엔터
IPADDR= xxx.xxx.xxx.xxx
NETWORK=xxx.xxx.xxx.xxx(아래 GATEWAY= xxx.xxx.xxx.xxx 같음 한쪽만 넣으면됨)
이렇게 해도 외부로 통신이 되는것은 아닙니다.!
4. 리눅스 네트워크 설정
[root@localhost /]# cd /etc/sysconfig/
[root@localhost sysconfig]# ls
auditd ip6tables modules saslauthd
authconfig ip6tables-config netconsole selinux
cbq ip6tables.old network sshd
clock iptables networking system-config-firewall
console iptables-config network-scripts system-config-firewall.old
crond iptables.old raid-check udev
grub kdump readonly-root
i18n kernel rsyslog
init keyboard sandbox
[root@localhost sysconfig]#
4-1. vi편기집를 이용하여 config(설정파일) 편집(리눅스network 설정)
[root@localhost sysconfig]# vi network
NETWORKING=yes // 네트워크 기능 사용할것인가 아닌가 당연 Yes
HOSTNAME=localhost.localdomain // 호스트 네임설정 부분, 반드시 완벽한 도메인
// 도메인서버 할꺼 아니면 설정 ㄴㄴ
-------------------------------------------
4-2. 추가해야할것(리눅스network 설정)
HOSTNAME=localhost.localdomain
알파벳 n 거서 놓구 대문자 A(Shift + a) 누르고 i 누르고 엔터
GATEWAYDEV=eth0 // 입력
GATEWAY= xxx.xxx.xxx.xxx // IP입력
입력하고 ESC
저장하고 나오기 :wq!
4.3 재시작
[root@localhost sysconfig]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0:
Determining IP information for eth0... done.
[ OK ]
[root@localhost sysconfig]#