반응형

Linux A 서버에서 Linux B 서버로 두 번째 로그인 시 암호를 입력하지 않고 SSH로 접속하려면, SSH 키 기반 인증을 설정해야 합니다. 아래에 이를 설정하는 방법을 단계별로 설명합니다:


1. Linux A 서버에서 SSH 키 생성

Linux A 서버의 auser 계정으로 로그인한 상태에서 다음 명령어를 실행합니다:

bash code 
ssh-keygen -t rsa
  • 옵션 설명:
    -t rsa는 RSA 형식의 SSH 키를 생성합니다.
  • 결과:
    • Enter file in which to save the key: 그냥 Enter를 눌러 기본 경로(~/.ssh/id_rsa)를 사용합니다.
    • Enter passphrase: 빈 칸으로 두고 Enter를 눌러 비밀번호 없이 생성합니다.
    • Enter same passphrase again: 다시 Enter를 누릅니다.

2. 생성된 공개 키를 Linux B 서버로 복사

생성된 공개 키를 buser 계정의 ~/.ssh/authorized_keys 파일에 추가해야 합니다. 다음 명령어를 사용합니다:

bash code
ssh-copy-id buser@<b서버 IP 또는 호스트 이름>
  • 이 과정에서 한 번은 암호를 입력해야 합니다.

대안:
만약 ssh-copy-id 명령어가 없다면, 수동으로 공개 키를 복사할 수도 있습니다:

  1. 공개키 확인

bash code
cat ~/.ssh/id_rsa.pub

  2. 출력된 키를 복사한 후, Linux B 서버에 접속하여 buser 계정의 ~/.ssh/authorized_keys 파일에 붙여넣습니다:

bash code
mkdir -p ~/.ssh chmod 700 ~/.ssh echo "<복사한 키>" >> ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys

 

3. 접속 테스트

Linux A 서버에서 다시 한 번 Linux B 서버로 SSH 접속을 시도합니다:

bash code
ssh buser@<b서버 IP 또는 호스트 이름>

이제 암호 없이 SSH 접속이 되어야 합니다.

 


4. 추가 설정 (선택 사항)

1) SSH 설정 파일에서 Alias 사용

~/.ssh/config 파일에 아래 내용을 추가하면, 짧은 명령어로 접속할 수 있습니다:

bash code
Host bserver HostName <b서버 IP 또는 호스트 이름> User buser IdentityFile ~/.ssh/id_rsa

이제 아래 명령어로 접속할 수 있습니다:

bash code
ssh bserver

2) 파일 권한 확인

SSH 키 인증이 작동하지 않으면, 파일 및 디렉터리 권한을 확인하세요:

bash code
chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys chmod 600 ~/.ssh/id_rsa chmod 644 ~/.ssh/id_rsa.pub

이제 Linux A와 B 서버 간 암호 없는 SSH 접속이 설정되었습니다! 😊

반응형
반응형
반응형
반응형
반응형
반응형

리눅스의 hostname 변경하는 다양한 방법 (CentOS 5, 6 7, and  Ubuntu 14, 16, 18, 20)

hostname 변경은 리눅스 버전별로 다른 방법이 있다.
 - 임시 변경 : 서버 리부팅되면 원래 이름으로 복구된다
 - 영구 변경 1 : hostname 저장파일을 수정하고 리부팅한다
 - 영구 변경 2 : ubuntu의 경우 hostname을 영구 변경하는 명령이 별도로 존재한다

 
1. hostname 확인, 임시 변경하기
 1) hostname 명령으로 확인하기
   리눅스 모든 버전이 동일하다
 
   ----------------------------
   $ sudo hostname
   localhost
   $
   ----------------------------
 
 2) hostname 임시 변경하기 (서버 리부팅 후 원래대로 복구된다)

   hostname을 ramen2-server 로 변경해보자
   ----------------------------
   $ sudo hostname ramen2-server
   
   $ sudo hostname
   ramen2-server
   $
   ----------------------------
   
2. hostname 영구 변경하기

   hostname을 ramen3-server 로 변경해보자
   
   # CentOS 6, Ubuntu 14
   hostname을 정하는 파일은  network, hosts 파일이다.
   두 파일을 수정한 후, 서버 재시작하면 적용된다.   
   
   ----------------------------
   $ sudo vi /etc/sysconfig/network
   HOSTNAME=ramen3-server
   $   
   $ sudo vi /etc/hosts
   127.0.0.1 localhost  
   192.168.10.123 ramen3-server
   ----------------------------
    
   
   # CentOS 7, CentOS 8, Ubuntu 16, Ubuntu 18, Ubuntu 20
   
   hostname을 정하는 파일은 hostname, hosts 파일이다.
   두 파일을 수정한 후, 서버 재시작하면 적용된다.
   ----------------------------
   $ sudo vi /etc/hostname
   ramen3-server
   $   
   $ sudo vi /etc/hosts
   127.0.0.1 localhost  
   192.168.10.123 ramen3-server
   ----------------------------
   
   or
      
   ----------------------------
   $ hostnamectl set-hostname ramen3-server  // this command changes hostname file
   $   
   $ sudo vi /etc/hosts
   127.0.0.1 localhost  
   192.168.10.123 ramen3-server
   ----------------------------
   
  

반응형
반응형

리눅스 OS (CentOS, Ubuntu) 버전별 커널버전 비교

CentOS-5 : linux kernel 2.6.18 ~
CentOS-6 : linux kernel 2.6.32 ~
CentOS-7 : linux kernel 3.10 ~
CentOS-8 : linux kernel 4.16 ~
 
Ubuntu 14.04.0, 14.04.1 : linux kernel 3.13
Ubuntu 14.04.5, 16.04.0, 16.04.1 : linux kernel 4.4
Ubuntu 16.04.5, 18.04.0, 18.04.1 : linux kernel 4.15
Ubuntu 18.04.5, 20.04.0, 20.04.1 : linux kernel 5.4
Ubuntu 20.04.2, 20.10 : linux kernel 5.8
Ubuntu 20.04.3, 21.04 : linux kernel 5.11
Ubuntu 20.04.4, 21.10 : linux kernel 5.13
Ubuntu 22.04.0, 20.04.5 : linux kernel 5.15


참고
 . ubuntu kernel : https://ubuntu.com/about/release-cycle#ubuntu-kernel-release-cycle
 . centos version : https://en.wikipedia.org/wiki/CentOS#CentOS_version_7
 
 
  

반응형
반응형

init 명령은 시스템을 종료, 재시작 등에 사용한다

init 명령의 옵션은 아래와 같다

  예) # init 0
 
  옵션 번호는 아래와 같다
    0 : halt (시스템 종료)
    1 : single user mode, 싱글 모드로 쉘로 바로 부팅, 복구시 주로 사용
    2 : multiuser mode without using NFS
    3 : multiuser mode console booting
    4 : no served
    5 : Muntiuser mode and X-windows booting
    6 : reboot


명령어 사용을 예를 들어보면,

1. 시스템 종료 명령
 - 즉시 종료 명령
  # shutdown -h now

  # halt
 
  # init 0

 - 예약 종료 명령

  # shutdown -h +10  // 10분 후 종료 (h = halt)

  # shutdown -r 22:00  // 22시정각에 재부팅 (r = reboot)

  # shutdown -c   // shutdown 취소 (c = cancel)
 
  # shutdown -k now  // 터미널 접속자에게 종료 메시지를 보낸다, 실제는 종료되지 않음)
 
 
2. 시스템 재부팅

  # shutdown -r now

  # reboot

  # init 6

 

반응형
반응형

이 주제에서는, 여러개의 NIC에 각각 IP주소를 설정하는 것과, 하나의 NIC에 여러개의 IP주소를 설정하는것을 알아본다.

먼저 서버에 어떤 Network Interface가 있는지 확인해보자.

Case1. 복수개의 물리적인 Network Interface가 있는 경우:

여러개의 물리적인 Network Interface를 사용할 수 있는 경우라면, 
eth0과 eth1에 각각 IP주소 한개씩을 설정할 수 있다.

 

Network Interface 확인하기

$ ifconfig -a
eth0      Link encap:Ethernet  HWaddr D4:AE:52:82:22:8D
          inet addr:192.168.0.70  Bcast:192.168.0.95  Mask:255.255.255.224
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:755405214 errors:0 dropped:0 overruns:0 frame:0
          TX packets:435394530 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:76448404243 (71.1 GiB)  TX bytes:54217830504 (50.4 GiB)

eth1      Link encap:Ethernet  HWaddr D4:AE:52:82:22:8E
          BROADCAST MULTICAST  MTU:1500  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:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:593638846 errors:0 dropped:0 overruns:0 frame:0
          TX packets:593638846 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:64571677188 (60.1 GiB)  TX bytes:64571677188 (60.1 GiB)
 
$

 

 

아래 그림과 같이 서버에 복수개 NIC (Network Interface card)가 있는 경우,
위 $ ifconfig -a 명령에서와 같이 여러개의 interface 이름이 나타난다.
 
'lo'는 local loopback interface라고 부르며, 모든 서버에 기본적으로 포함되어있다.
 
'eno0, eno1'라고 표시된다면, server main-board에 기본적으로 포함되어 있는 interface 이름으로,
embedded NIC (onboard Network Interface Card) 을 의미한다.

 


'eth0', 'eth1', 'eth2', ... 와 같이 표시되는 것은 추가 랜카드를 꽂은 경우의 interface 이름이된다.

최근에는 'enp0s10' 의 형태로 slot name이 interface 이름으로 표시된다.

 

eth1 에 IP 설정하기

eth0에 IP 설정하는 것과 같은 방법으로 eth1의 IP를 설정하면 된다.

먼저, 현재 설정된 네트워크 정보를 확인해보자.

$ ifconfig -a
$ cat /etc/sysconf/network
$ cat /etc/sysconfig/network-scripts/ifcfg-eth0

$ ifconfig -a
eth0      Link encap:Ethernet  HWaddr D4:AE:52:82:22:8D
          inet addr:192.168.0.70  Bcast:192.168.0.95  Mask:255.255.255.224
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:755405214 errors:0 dropped:0 overruns:0 frame:0
          TX packets:435394530 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:76448404243 (71.1 GiB)  TX bytes:54217830504 (50.4 GiB)

eth1      Link encap:Ethernet  HWaddr D4:AE:52:82:22:8E
          BROADCAST MULTICAST  MTU:1500  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:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:593638846 errors:0 dropped:0 overruns:0 frame:0
          TX packets:593638846 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:64571677188 (60.1 GiB)  TX bytes:64571677188 (60.1 GiB)
 
$

$ cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=myserver
GATEWAY=192.168.0.65
$

$ cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.0.95
HWADDR=d4:ae:52:82:22:8d
IPADDR=192.168.0.70
NETMASK=255.255.255.224
NETWORK=192.168.0.64
ONBOOT=yes
$

$ cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=dhcp
HWADDR=d4:ae:52:82:22:8e
ONBOOT=no
$

 

eth0의 설정을 참고하여, 새IP 192.168.0.88 을 eth1에 할당하는 것을 가정하여 보자.

$ sudo vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=static
BROADCAST=192.168.0.95
HWADDR=d4:ae:52:82:22:8e
IPADDR=192.168.0.80
NETMASK=255.255.255.224
NETWORK=192.168.0.64
ONBOOT=yes
$

 

Case2. 한개의 물리적인 Network Interface만 있는 경우, 복수개 IP 주소 설정하기:

 

위 경우와 달리, 물리적인 Network Interface가 한개뿐이거나, 하나의 물리적 Interface에 여러개의 IP주소를 설정해야하는 경우라면 아래의 방법을 사용할 수 있다.

eth0 라는 물리적 Network Interface에 IP주소가 한개 등록되어 있다고 가정하고,
동일 네트워크의 여러개 IP를 추가해보자.

현재 eth0 IP주소는, 192.168.0.70 이고, 새로 추가할 IP주소는 192.168.0.71, 192.168.0.72 라고 한다면,

절차는,
network-scripts 디렉토리에서 ifcfg-eth0 의 설정을 복사하여, ifcfg-eth0:0과 ifcfg-eth0:1 이라는 하위의 가상의 interface를 만들고, 여기에 새로 추가할 IP주소를 등록한다.

먼저 network-scripts 디렉토리로 이동하여, 설정파일을 여러개 복사한다.

$ cd /etc/sysconfig/network-scripts
$ sudo cp ifcfg-eth0 ifcfg-eth0:0
$ sudo cp ifcfg-eth0 ifcfg-eth0:1

$ ls
ifcfg-eth0
ifcfg-eth0:0
ifcfg-eth0:1
$

동일 네트워크의 IP주소 대역을 사용하므로, 새 설정파일들에서 IP주소만 변경해준다.
단, HWADDR은 삭제한다.

$ sudo vi ifcfg-eth0:0
DEVICE=eth0:0
BOOTPROTO=static
BROADCAST=192.168.0.95
IPADDR=192.168.0.71
NETMASK=255.255.255.224
NETWORK=192.168.0.64
ONBOOT=yes
$

$ sudo vi ifcfg-eth0:1
DEVICE=eth0:0
BOOTPROTO=static
BROADCAST=192.168.0.95
IPADDR=192.168.0.72
NETMASK=255.255.255.224
NETWORK=192.168.0.64
ONBOOT=yes
$

 

설정을 마쳤다면 네트워크를 재시작하거나 재부팅하면 새IP들이 적용된다

$ sudo /etc/rc.d/init.d/network restart
Shuuting down interfaceeth0: [OK]
...

끝으로, ifconfig -a 명령으로 적용된 Network interface와 IP주소를 확인해본다

$ ifconfig -a
eth0      Link encap:Ethernet  HWaddr D4:AE:52:82:22:8D
          inet addr:192.168.0.70  Bcast:192.168.0.95  Mask:255.255.255.224
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:755405214 errors:0 dropped:0 overruns:0 frame:0
          TX packets:435394530 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:76448404243 (71.1 GiB)  TX bytes:54217830504 (50.4 GiB)
 
eth0:0    Link encap:Ethernet  HWaddr D4:AE:52:82:22:8D
          inet addr:192.168.0.71  Bcast:192.168.0.95  Mask:255.255.255.224
          UP BROADCAST RUNNING MULTICAST  MTU:1500  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:1000
          RX bytes:0 (0 B)  TX bytes:0 (0 B)
 
eth0:1    Link encap:Ethernet  HWaddr D4:AE:52:82:22:8D
          inet addr:192.168.0.72  Bcast:192.168.0.95  Mask:255.255.255.224
          UP BROADCAST RUNNING MULTICAST  MTU:1500  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:1000
          RX bytes:0 (0 B)  TX bytes:0 (0 B)

 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:16436  Metric:1
          RX packets:593638846 errors:0 dropped:0 overruns:0 frame:0
          TX packets:593638846 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:64571677188 (60.1 GiB)  TX bytes:64571677188 (60.1 GiB)
 

 

 

 

 

반응형
반응형

firewalld 사용하여 port forwarding 설정하기 with CentOS7

1. firewalld 설치

# yum install -y firewalld



2. 사용중인 서비스 port 오픈 미리 허용 설정


  1)TCP 특정 포트 허용 (예 1~65535 전부 허용)

# firewall-cmd --permanent --zone=public --add-port=1-65535/tcp

 2) UDP 특정 포트 허용(예 3000번)

# firewall-cmd --permanent --add-port=3000/udp


 
3. redirect 80 to 443 설정하기 (http to httpd)


   1) 동일 서버내에서 redirect 하는 경우

# firewall-cmd --add-forward-port=port=80:proto=tcp:toport=443
# firewall-cmd --runtime-to-permanent

  2) A서버의 80포트를 B서버의 443포트로 redirect 하는 경우, Enable masquerade 추가

# firewall-cmd --add-forward-port=port=80:proto=tcp:toport=443:toaddr=SERVER_B_IP_ADDRESS
# firewall-cmd --add-masquerade


4. 설정 확인하기

# firewall-cmd --list-all
public
  target: default
  icmp-block-inversion: no
  interfaces:
  sources:
  services: dhcpv6-client ssh
  ports:
  protocols:
  masquerade: no
  forward-ports: port=80:proto=tcp:toport=443:toaddr=
  source-ports:
  icmp-blocks:
  rich rules:
#



5. 실행 명령

# systemctl enable firewalld  // 기능 활성화 
# systemctl disable firewalld  // 기능 비활성화
 
# systemctl start firewalld  // 시작
# systemctl stop  firewalld  // 중지 
# systemctl restart  firewalld  // 재시작



 참고자료:
   https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/security_guide/sec-port_forwarding
   

반응형
반응형

firewalld 사용하여 port forwarding 설정하기 with CentOS7

1. firewalld 설치

# yum install -y firewalld



2. 사용중인 서비스 port 오픈 미리 허용 설정


  1)TCP 특정 포트 허용 (예 1~65535 전부 허용)

# firewall-cmd --permanent --zone=public --add-port=1-65535/tcp

 2) UDP 특정 포트 허용(예 3000번)

# firewall-cmd --permanent --add-port=3000/udp


 
3. redirect 80 to 443 설정하기 (http to httpd)


   1) 동일 서버내에서 redirect 하는 경우

# firewall-cmd --add-forward-port=port=80:proto=tcp:toport=443
# firewall-cmd --runtime-to-permanent

  2) A서버의 80포트를 B서버의 443포트로 redirect 하는 경우, Enable masquerade 추가

# firewall-cmd --add-forward-port=port=80:proto=tcp:toport=443:toaddr=SERVER_B_IP_ADDRESS
# firewall-cmd --add-masquerade


4. 설정 확인하기

# firewall-cmd --list-all
public
  target: default
  icmp-block-inversion: no
  interfaces:
  sources:
  services: dhcpv6-client ssh
  ports:
  protocols:
  masquerade: no
  forward-ports: port=80:proto=tcp:toport=443:toaddr=
  source-ports:
  icmp-blocks:
  rich rules:
#



5. 실행 명령

# systemctl enable firewalld  // 기능 활성화 
# systemctl disable firewalld  // 기능 비활성화
 
# systemctl start firewalld  // 시작
# systemctl stop  firewalld  // 중지 
# systemctl restart  firewalld  // 재시작



 참고자료:
   https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/security_guide/sec-port_forwarding
   

반응형
반응형


현재 시간 확인, UTC로 확인됨 

# date
Thu May 19 00:36:53 UTC 2022 

# ll /etc/localtime
lrwxrwxrwx 1 root root 30 May 19 09:41 /etc/localtime -> /usr/share/zoneinfo/UTC


Seoul 시간으로 변경하기


# cd /etc
# mv localtime localtime_org    // 기존 설정 백업해두고
# ln -s /usr/share/zoneinfo/Asia/Seoul /etc/localtime   // 변경 


변경된 시간 확인

# date
Thu May 19 09:47:00 KST 2022

# ll /etc/localtime
lrwxrwxrwx 1 root root 30 May 19 09:41 /etc/localtime -> /usr/share/zoneinfo/Asia/Seoul

반응형
반응형

사전준비

  • NAS는 준비되어 있다고 가정한다
    • NAS volume Source (예) :192.168.20.254:/nasvolume1
  • 리눅스서버에는 Nas volume을 연결할 폴더를 준비한다
    • 리눅스 폴더 (예) /data

절차

    필요한 패키지 설치 > rpcbind 서비스 실행 > 폴더 생성 > mount > 확인    

step1. nfs 패키지를 설치한다 (nfs-utils, rpcbind)

     * linux가 Debian, Ubuntu 계열인 경우 : nfs-common, rpcbind 설치        

ubuntu / $ sudo apt-get install nfs-common rpcbind

     * linux가 CentOS, RedHat 계열인 경우 : nfs-utils, rpcbind 설치

centos / $ sudo yum install nfs-utils rpcbind

 

step2. rpcbind 서비스를 실행한다

$ sudo service rpcbind start
또는
$ sudo systemctl start rpcbind.service


step3. nas volume을 연결할 linux의 폴더를 생성한다

$ sudo mkdir /data


step4. mount 실행, 확인

명령어 포맷 : mount -t nfs {nas-source} {linux-mount-point-folder}
$ sudo mount -t nfs 192.168.20.254:/nasvolume1 /data

확인
$ df -h
192.168.20.254:/nasvolume1  285G  384K  285G   1% /data


step5. fstab에 영구 등록

    - linux 리부팅하면 mount 명령으로 실행한 것은 유지되지 않는다
    - 리부팅될 때에도 mount 실행되도록 fstab에 등록해둔다

$ sudo vi /etc/fstab
...
192.168.20.254:/nasvolume1 /data nfs defaults 1 2
...

이제, /data에 데이터를 등록하면, 같은 mount 정보를 이용하는 시스템들간에 데이터를 공유할 수 있다

추가설정. nfs mount version 3로 변경하기 (default= version 4)

  - version 3 사용하는 이유 : nfs v4에서는 파일 사용시 lock이 걸린 후 lock 해제가 바로 되지 않아서 파일 쓰기의 오류가 발생하는 사례가 있어서 nfs v3을 권장함   

1. client측 config 설정하기
    1)/etc/nfs.conf
        vers3=y   --> #제거 
    
   2) /etc/nfsmount.conf
      Defaultvers=3   --> 4를 3으로 
      Nfsvers=3       --> 4를 3으로 
   

2. nfs server측  설정
  1) /etc/autofs.conf 
      mount_nfs_default_protocol = 3

  2) /etc/sysconfig/nfs
      MOUNTD_NFS_V3 = "yes"
  
  3)  / etc / sysconfig / autofs   
     MOUNT_NFS_DEFAULT_PROTOCOL = 3 OPTIONS="-O vers=3"

3. umount 후 다시 mount 설정하기 
  $ sudo umount -l /data
  $ sudo mount -t nfs -o vers=3 192.168.0.254:nas1 /data 

3. mount 결과 확인하기 (vers=3 인지 vers=4 인지 확인하기 )
  $ sudo mount
  ...
  192.168.0.254:nas1 on /data type nfs (rw,relatime,vers=3,rsize=65536,wsize=65536,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,
  mountaddr=192.168.0.254,mountvers=3,mountport=635,mountproto=udp,local_lock=none,addr=192.168.0.254)

 

참고 : fstab 구문 구조 설명

    (예문) 192.168.20.254:/nasvolume1 /data nfs defaults 1 2
    (설명)
       192.168.20.254 = {filesystem-id}
                              ip 또는 url. NAS 또는 파일시스템에 접근할 수 있는 위치정보
       :/nasvolume1 = :/{devicename}
                              NAS 또는 파일시스템에 준비된 공유디바이스 정보, 공유폴더이름에 해당한다
       /data = {mount-point} 
                              리눅스 (클라이언트측)에 준비된 디렉토리 (폴더) 정보
                              여기에 NAS 공유 디바이스를 연결한다
       nfs = {filesystem-type}
                              여러 종류의 파일시스템 타입이 있다
                              ext, ext2, ext3, ext4, iso9660, nfs, swap, ufs, vfat, msdos, ntfs, hpfs, sysv, ramdisk 등이 있고,
                              일반적으로 네트워크상의 NAS는 nfs를 표준으로 사용한다
                              그 외, 클라이언트측이나 파일시스템측의 특성에 맞춰 타입을 써줘야할 경우가 있다
       default = {mount-option}
                             default : rw, nouser, auto, exec, suid 속성을 모두 갖는다
                             auto / noauto : 부팅시 자동으로 마운트한다 / 안한다 
                             exec / noexec : 실행파일의 실행을 허용한다 / 안한다 
                             suid / nosuid : SetUID, SetGID 사용을 허용한다 / 안한다 
                             ro / rw : 읽기전용 / 일기쓰기 허용한다 
                             user / nouser : 일반사용자 계정으로 마운트를 허용한다 / 안한다(root만 허용)
                             quota / noquota : Quota(용량제한) 설정이 가능 / 불가능하다      
        1 = {dump-option}
                             0 / 1 : dump 불가능 / 가능 
        2 = {fsck:file sequence check option}
                             0 : 무결성 검사를 하지 않는다 
                             1 : 1순위 검사대상이 된다 (주로 root (/)에 해당
                             2 : 2순위 대상이 된다 ( root 폴더 이외의 경우에 해당) 

이 정도 알면 사용할 수 있지 않을까              

 

 

 

 

 

 

 

반응형
반응형

 

1. routing table이란,

  • 네트워크상의 특정 목적지로 가는 경로 정보를 명시하고 있는 표

 

2. routing table 확인 (route)

command(type 1) : $ route or $ route -n or $ netstat -nr
목적지 IP 가 어느 Interface와 Gateway로 전달되는지 표시한다


  $ route
  Kernel IP routing table
  Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
  default         211.111.211.1   0.0.0.0         UG    0      0        0 eth0
  10.0.0.0        172.16.10.1     255.0.0.0       UG    0      0        0 eth1
  172.16.10.0     *               255.255.255.0   U     0      0        0 eth1
  211.111.211.0   *               255.255.255.128 U     0      0        0 eth0
  192.168.0.0     172.16.10.1     255.255.0.0     UG    0      0        0 eth1
  $
  $ netstat -nr
  Kernel IP routing table
  Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
  0.0.0.0         211.111.211.1   0.0.0.0         UG        0 0          0 eth0
  10.0.0.0        172.16.10.1     255.0.0.0       UG        0 0          0 eth1
  172.16.0.0      172.16.10.1     255.240.0.0     UG        0 0          0 eth1
  172.16.10.0     0.0.0.0         255.255.255.0   U         0 0          0 eth1
  211.111.211.0   0.0.0.0         255.255.255.128 U         0 0          0 eth0
  192.168.0.0     172.16.10.1     255.255.0.0     UG        0 0          0 eth1
  $
  

command(type 2) : $ ip route show or $ ip route list
내용은 동일하고 표현방법이 조금 다르다


$ ip route show
default via 211.111.211.1 dev eth0
10.0.0.0/8 via 172.16.10.1 dev eth1
172.16.0.0/12 via 172.16.10.1 dev eth1
172.16.10.0/24 dev eth1  proto kernel  scope link  src 172.16.10.45
211.111.211.0/25 dev eth0  proto kernel  scope link  src 183.111.198.45
192.168.0.0/16 via 172.16.10.1 dev eth1
$
$ ip route list
default via 211.111.211.1 dev eth0
10.0.0.0/8 via 172.16.10.1 dev eth1
172.16.0.0/12 via 172.16.10.1 dev eth1
172.16.10.0/24 dev eth1  proto kernel  scope link  src 172.16.10.45
211.111.211.0/25 dev eth0  proto kernel  scope link  src 183.111.198.45
192.168.0.0/16 via 172.16.10.1 dev eth1
$
반응형

3. routing table gateway 추가/삭제 (route add/del default gw)

3.1) gateway 경로 추가 (route add default gw)

리눅스 최초 설정으로 default gateway 경로가 없을 때 또는 gateway route ip가 바뀌었을 때 기존 경로 후 삭제 후 추가한다.
command(type 1) : $ route add default gw (gateway-ip-address) (interface-name)


$ route add default gw 211.111.211.1 eth0
$

command(type 2) : $ route add default gw (gateway-ip-address) netmask (netmask-address) dev (interface-name)


$ route add default gw 211.111.211.1 netmask 255.255.255.0 dev eth0

3.2) gateway 경로 삭제 (route del default gw)

경로 삭제할 때는 device interface name은 지정하지 않는다.
command : $ route del default gw (gateway-ip-address)


$ route del default gw 211.111.211.1
$

4. routing table 특정 목적지 경로 추가/삭제 (route add/del -net)

특정 목적지 IP로 가는 경로의 디바이스명을 추가/삭제 설정한다.

4.1) 특정 목적지 경로 추가 (route add -net)

command : $ route add -net (target-ip) netmask (netmask-address) dev (interface-name)


$ route add -net 172.16.10.0 netmask 255.255.255.0 dev eth1
$

4.2) 특정 목적지 경로 삭제 (route del -net)

command : $ route del -net (target-ip) netmask (netmask-address) dev (interface-name)


$ route del -net 172.16.10.0 netmask 255.255.255.0 dev eth1
$
반응형

+ Recent posts