일단 IP 설정 상태를 확인한다.

[root@linuxbunny♥Bunny♥/etc]# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:xx:xx:BF:xx:xx
          inet addr:192.168.200.50  Bcast:192.168.200.255  Mask:255.255.255.0
          inet6 addr: fexx::xxc:xxff:febf:cfxx/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:229282 errors:0 dropped:0 overruns:0 frame:0
          TX packets:120136 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:341392669 (325.5 MiB)  TX bytes:7162292 (6.8 MiB)
          Interrupt:67 Base address:0x2024

==> 네트워크 IP를 일단 확인합니다.

밑에 제가 네트워크 명령어 사용 옵션을 적은 겁니다. 참고 하세요.

#ifconfig eth0 61.251.13.216 netmask 255.255.255.0 broadcast 255.255.255.255 up

#route -ne  è 현재 시스템 게이트웨이 상태 조회

#route add -net <네트워크 주소> netmask <넷매스크 값> dev <인터페이스 이름> 

라우팅 정보 추가 
#route del -net <네트워크 주소> netmask <넷매스크 값> dev <인터페이스 이름> 

라우팅 정보 삭제 
#route add default gw <기본 게이트웨이 주소> dev <인터페이스 이름>  기본 게이트웨이 추가
#route del default gw <기본 게이트웨이 주소> dev <인터페이스 이름>  기본 게이트웨이 삭제

#netstat -apo   è 일반적인 네트워크 소켓 정보 모니터 조회

#netstat -atupc: 네트워크 상태 알아보기.  è  -a : 연결된 모든 소켓 출력.

-t : tcp 연결 소켓 출력 -u : udp 소켓 출력

-p : 소켓과 연결된 프로그램 출력   -c : 연속적 출력   -r : 라우팅 테이블 출력

-i : 인터페이스 테이블 출력

제일 먼저 호스트네임를 설정한다.

[root@linuxbunny♥Bunny♥/etc]# hostname linuxbunny.pe.kr  ==> 호스트를 명령어로 설정

[root@linuxbunny♥Bunny♥/etc]# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=linuxbunny.pe.kr  ==> 호스트를 vi로 열어서 입력한다.

네트워크 IP를 고정으로 변경하는 방법이다.

[root@linuxbunny♥Bunny♥/etc]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
ONBOOT=yes
HWADDR=xx:xx:xx:xx:xx:xx

BOOTPROTO=static

IPADDR=192.168.200.50

NETMASK=255.255.255.0

GATEWAY=192.168.200.2

==> 이런 형식으로 네트워크 설정을 고정 IP로 변경해 줄수 있습니다.

네트워크 호스트 리스트를 설정하는 방법이다.

[root@linuxbunny♥Bunny♥/etc]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
192.168.200.50     bunny.linuxbunny.pe.kr       bunny
192.168.200.50     ns.linuxbunny.pe.kr       ns
192.168.200.50     www.linuxbunny.pe.kr       www
192.168.200.50     ftp.linuxbunny.pe.kr       ftp
192.168.200.50     apple.linuxbunny.pe.kr       apple

==> 자신만의 호스트리스트를 설정한다.

네임서버를 설정한다.

[root@linuxbunny♥Bunny♥/etc]# cat /etc/resolv.conf

; generated by /sbin/dhclient-script
search localdomain
nameserver 192.168.200.2
nameserver 164.124.101.2
nameserver 211.238.200.50
==> 네임서버 목록을 설정 한다.

모든 설정을 다 했다면 네트워크를 다시 재시작해서 적용시킨다.

다음에 모든 서버 네트워크 상태를 점검해 본다. 잘못된 부분이 없는지.. 

[root@linuxbunny♥Bunny♥/etc]# service network restart  ==> 지금까지 설정한 내용을 적용하기 위해 다시 재 시작

[root@linuxbunny♥Bunny♥/etc]# ifconfig -a eth0   ==> IP설정상태 확인
[root@linuxbunny♥Bunny♥/etc]# route -nv  ==> 라우터 경로 설정 확인
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.200.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0
0.0.0.0         192.168.200.2   0.0.0.0         UG    0      0        0 eth0
[root@linuxbunny♥Bunny♥/etc]# netstat -anp  ==> 현재 네트워크 상태 확인
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 0.0.0.0:110                 0.0.0.0:*                   LISTEN      3359/xinetd
tcp        0      0 0.0.0.0:143                 0.0.0.0:*                   LISTEN      3359/xinetd
tcp        0      0 0.0.0.0:21                  0.0.0.0:*                   LISTEN      3376/vsftpd
tcp        0      0 0.0.0.0:25                  0.0.0.0:*                   LISTEN      3401/sendmail: acce
tcp        0      0 :::22                       :::*                        LISTEN      4259/sshd
tcp        0      0 ::ffff:192.168.200.50:22    ::ffff:192.168.200.1:4544   ESTABLISHED 3635/1
udp        0      0 0.0.0.0:68                  0.0.0.0:*                               5634/dhclient

[root@linuxbunny♥Bunny♥/etc]# ping -c 5 bunny.linuxbunny.pe.kr  ==> bunny 호스트 응답 확인
PING bunny.linuxbunny.pe.kr (192.168.200.50) 56(84) bytes of data.
64 bytes from bunny.linuxbunny.pe.kr (192.168.200.50): icmp_seq=1 ttl=64 time=0.020 ms
64 bytes from bunny.linuxbunny.pe.kr (192.168.200.50): icmp_seq=2 ttl=64 time=0.038 ms
64 bytes from bunny.linuxbunny.pe.kr (192.168.200.50): icmp_seq=3 ttl=64 time=0.037 ms
64 bytes from bunny.linuxbunny.pe.kr (192.168.200.50): icmp_seq=4 ttl=64 time=0.036 ms
64 bytes from bunny.linuxbunny.pe.kr (192.168.200.50): icmp_seq=5 ttl=64 time=0.038 ms

--- bunny.linuxbunny.pe.kr ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4118ms
rtt min/avg/max/mdev = 0.020/0.033/0.038/0.010 ms
[root@linuxbunny♥Bunny♥/etc]# ping -c 5 www.linuxbunny.pe.kr  ==> www 호스트 응답 확인
PING www.linuxbunny.pe.kr (192.168.200.50) 56(84) bytes of data.
64 bytes from bunny.linuxbunny.pe.kr (192.168.200.50): icmp_seq=1 ttl=64 time=0.040 ms
64 bytes from bunny.linuxbunny.pe.kr (192.168.200.50): icmp_seq=2 ttl=64 time=0.032 ms
64 bytes from bunny.linuxbunny.pe.kr (192.168.200.50): icmp_seq=3 ttl=64 time=0.025 ms
64 bytes from bunny.linuxbunny.pe.kr (192.168.200.50): icmp_seq=4 ttl=64 time=0.020 ms
64 bytes from bunny.linuxbunny.pe.kr (192.168.200.50): icmp_seq=5 ttl=64 time=0.038 ms

--- www.linuxbunny.pe.kr ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4120ms
rtt min/avg/max/mdev = 0.020/0.031/0.040/0.007 ms
[root@linuxbunny♥Bunny♥/etc]# ping -c 5 ftp.linuxbunny.pe.kr  ==> ftp 호스트 응답 확인
PING ftp.linuxbunny.pe.kr (192.168.200.50) 56(84) bytes of data.
64 bytes from bunny.linuxbunny.pe.kr (192.168.200.50): icmp_seq=1 ttl=64 time=0.016 ms
64 bytes from bunny.linuxbunny.pe.kr (192.168.200.50): icmp_seq=2 ttl=64 time=0.024 ms
64 bytes from bunny.linuxbunny.pe.kr (192.168.200.50): icmp_seq=3 ttl=64 time=0.036 ms
64 bytes from bunny.linuxbunny.pe.kr (192.168.200.50): icmp_seq=4 ttl=64 time=0.037 ms
64 bytes from bunny.linuxbunny.pe.kr (192.168.200.50): icmp_seq=5 ttl=64 time=0.037 ms

--- ftp.linuxbunny.pe.kr ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4116ms
rtt min/avg/max/mdev = 0.016/0.030/0.037/0.008 ms

 

이 정도만 알아도 네트워크 관리는 어느정도 할수 있습니다.

 

 

 

 

+ Recent posts