반응형

리눅스에서 동적 ip할당시 대표하는 localhost 이름을 사용할 경우가 있다.

이를 위해 hostname을 변경해보자, 여기서는 로컬호스트명을 "toolsetup"이라고 지었다.

 

현재 hostname 보기

hostname

현재 hostname 자세히 보기

hostnamectl

1. hostname 변경 (localhost -> toolsetup)

    1-1. 커맨드로 변경

sudo hostnamectl set-hostname toolsetup

    1-2. 설정파일 수정으로 변경

sudo vi /etc/hostname

위와 같이 이름편집

2. 루프백 ip에 등록

sudo vi /etc/hosts

맨끝에 로컬호스트명 추가

다시 hostnamectl 명령어를 치면 아래와 같이 변경됨을 확인할 수 있다.

반응형

+ Recent posts