반응형

윈도우에서 IP를 확인하기 위해 커맨드 창에 'ipconfig'를 사용합니다.


리눅스에서는 명령어가 조금 다른데,


유사한 기능을 하는 명령어로 'ifconfig'를 사용합니다.



ifconfig의 help 페이지를 보면 다음과 같습니다.


parkch0708@chp-lab:~$ ifconfig --help

Usage:

  ifconfig [-a] [-v] [-s] <interface> [[<AF>] <address>]

  [add <address>[/<prefixlen>]]

  [del <address>[/<prefixlen>]]

  [[-]broadcast [<address>]]  [[-]pointopoint [<address>]]

  [netmask <address>]  [dstaddr <address>]  [tunnel <address>]

  [outfill <NN>] [keepalive <NN>]

  [hw <HW> <address>]  [metric <NN>]  [mtu <NN>]

  [[-]trailers]  [[-]arp]  [[-]allmulti]

  [multicast]  [[-]promisc]

  [mem_start <NN>]  [io_addr <NN>]  [irq <NN>]  [media <type>]

  [txqueuelen <NN>]

  [[-]dynamic]

  [up|down] ...


  <HW>=Hardware Type.

  List of possible hardware types:

    loop (Local Loopback) slip (Serial Line IP) cslip (VJ Serial Line IP) 

    slip6 (6-bit Serial Line IP) cslip6 (VJ 6-bit Serial Line IP) adaptive (Adaptive Serial Line IP) 

    ash (Ash) ether (Ethernet) ax25 (AMPR AX.25) 

    netrom (AMPR NET/ROM) rose (AMPR ROSE) tunnel (IPIP Tunnel) 

    ppp (Point-to-Point Protocol) hdlc ((Cisco)-HDLC) lapb (LAPB) 

    arcnet (ARCnet) dlci (Frame Relay DLCI) frad (Frame Relay Access Device) 

    sit (IPv6-in-IPv4) fddi (Fiber Distributed Data Interface) hippi (HIPPI) 

    irda (IrLAP) ec (Econet) x25 (generic X.25) 

    eui64 (Generic EUI-64) 

  <AF>=Address family. Default: inet

  List of possible address families:

    unix (UNIX Domain) inet (DARPA Internet) inet6 (IPv6) 

    ax25 (AMPR AX.25) netrom (AMPR NET/ROM) rose (AMPR ROSE) 

    ipx (Novell IPX) ddp (Appletalk DDP) ec (Econet) 

    ash (Ash) x25 (CCITT X.25) 

parkch0708@chp-lab:~$ 


단순히 IP 주소만 확인 하는 것이 아니라 많은 작업을 할 수 있습니다.



ifconfig 명령어로 확인할 수 있는 내용은


* MAC 주소

* 인터페이스에 할당된 IP 주소

* 브로드캐스트 주소

* 서브넷마스크

* MTU (Maximum Transfer Unit) : 최대 전송 단위

* RX packets : 부팅 후 현재까지 받은 패킷 수

* TC packets : 부팅 후 현재까지 보낸 패킷 수

* Collisions : 충돌된 데이터값

* Interrupt 주소

* 현재 UP(사용가능) 되어 있는지 여부


등이 있습니다.


생각보다 많은 정보를 확인 할 수 있습니다.



현재 활성화 되어 있는 모든 네트워크 인터페이스의 정보를 보고 싶으시다면


$ ifconfig


명령어를 사용하시면 되고,


특정 인터페이스의 정보만 확인하고 싶으시다면


$ ifconfig 인터페이스


명령어를 사용하시면 됩니다.


다음은 제 컴퓨터에서 $ ifconfig eth0 명령어를 사용하였을 때의 결과 입니다.


parkch0708@chp-lab:~$ ifconfig eth0

eth0      Link encap:Ethernet  HWaddr ae:1e:28:5d:c3:d7  

          inet addr:10.21.1.81  Bcast:10.21.255.255  Mask:255.255.0.0

          inet6 addr: fe80::ae9e:17ff:fe4c:c3d7/64 Scope:Link

          inet6 addr: 3ffe:501:ffff:100:e12d:b572:8320:13cc/64 Scope:Global

          inet6 addr: 3ffe:501:ffff:100:ae9e:17ff:fe4c:c3d7/64 Scope:Global

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:4956917 errors:0 dropped:0 overruns:0 frame:0

          TX packets:2428333 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:6626489492 (6.6 GB)  TX bytes:179942820 (179.9 MB)


parkch0708@chp-lab:~$ 


현재 제 PC는 고정 IP (10.21.1.81/255.255.0.0)를 사용하고 있고,


MAC 주소는 ae:1e:28:5d:c3:d7 이군요.


부팅 후 현재까지 약 6.6GB의 패킷을 내보냈고, 약 179.9MB 패킷만 받았습니다.



ifconfig 명령어를 사용하면 네트워크 인터페이스를 활성/비활성화 시킬 수도 있습니다.


각각 다음과 같이 하시면 됩니다.


$ sudo ifconfig 인터페이스 up (예 : sudo ifconfig eth0 up)


$ sudo ifconfig 인터페이스 down (예 : sudo ifconfig eth0 down)



인터페이스를 활성화 하신 다음에 ifconfig 명령어를 이용하여 직접 IP 설정도 가능합니다.


$ sudo ifconfig 인터페이스 IP주소 netmask 넷마스크


(예 : sudo ifconfig eth0 10.21.1.81 netmask 255.255.0.0)

반응형
Posted by 해리팍
BLOG main image

Chanhyun Park (해리팍)
Software Engineer @ SK hynix

Contact Info.
parkch0708@hanmail.net
chanhyun0708@gmail.com
chanhyun.park@sk.com

카테고리

All (1502)
Profile (2)
Park's Life (600)
Computer System (165)
Computer Programming (39)
Computer Study (54)
Computer Etc. (189)
Scuba Diving (137)
Golf (8)
Traveling (245)
생활 정보 (12)
Pokemon GO (50)