본문 바로가기

Development Study/Linux

[Linux] Virtual Box - Linux - Centos6 네트워크 설정

[Linux] Virtual Box - Linux - Centos6 네트워크 설정


가상 머신 시작

root 로그인

localhost login: root
Password: <root_password>

네트워크확인

$ ifconfig

ifcfg-eth1 파일 생성

$ vi /etc/sysconfig/network-scripts/ifcfg-eth1

  • 스크립트 작성

  • MAC 주소 > 가상머신 -> 설정 -> 네트워크 -> 어탭터 2

DEVICE=eth1

HWADDR=08:00:27:28:5B:8D

TYPE=Ethernet

ONBOOT=yes

BOOTPROTO=static

IPADDR=192.168.56.111

NETMASK=255.255.255.0

GATEWAY=192.168.56.1

NETWORK=192.168.56.0

네트워크 다시시작

service network restart

네트워크 확인

$ ifconfig

  • ifcfg-eth1 에서 설정한 ip주소로 고정 됨

ssh 접속을 위한 패키지 설치

$ yum install -y openssh\*

$ service sshd restart

$ chkconfig sshd on
  • yum 으로 ssh 설치

  • 설치 완료

  • sshd 재실행

  • 부팅 시 sshd 실행 > chkconfig 등록

network 재실행

$ service network restart

네트워크 연결 확인

ping 8.8.8.8

ssh 22번 port 확인

net -tnlp | grep sshd

ssh 설정 변경

vi /etc/ssh/sshd\_config

#변경전

PermitRootLogin no

ChallengeResponseAuthentication no

#변경후

PermitRootLogin yes

ChallengeResponseAuthentication yes

sshd 재시작

service sshd restart

Putty 연결