ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • ifconfig vs ip 명령어
    Unix Linux Like 2021. 3. 8. 23:05

    아직도 대부분의 많은 시스템에서는 net-tools(ifconfig, route, arp, netstat)를 사용하고 있습니다..

    net-tools는 2001년 이후로 개발이 중단 되었으며, 최신의 배포판에서는 더 이상 사용되지 않고 대신 iproute2 패키지를 사용하고 있습니다.

     

    10년이 지난 지금도 아직 ifconfig를 사용하고, 대체하기 위해 나온ip 명령어가 있다는 것도 모르는 사람이 많은것 같네요.

     

    wiki.linuxfoundation.org/networking/net-tools 리눅스 재단에서도 net-tools는 현재 사용되지 않는다고 설명하고 있습니다.

     

     

    [다음은 기존에 사용하던 net-tools 명령어와 새로운 iproute2 명령어 비교]

    NET-TOOLS COMMANDS IPROUTE COMMANDS
    arp -a ip neigh
    arp -v ip -s neigh
    arp -s 192.168.1.1 1:2:3:4:5:6 ip neigh add 192.168.1.1 lladdr 1:2:3:4:5:6 dev eth0
    fconfig -a ip addr
    ifconfig eth0 down ip link set eth0 down
    ifconfig eth0 up ip link set eth0 up
    ifconfig eth0 192.168.1.1 ip addr add 192.168.1.1/24 dev eth0
    ifconfig eth0 netmask 255.255.255.0 ip addr add 192.168.1.1/24 dev eth0
    ifconfig eth0 mtu 9000 ip link set eth0 mtu 9000
    ifconfig eth0:0 192.168.1.2 ip addr add 192.168.1.2/24 dev eth0
    ifconfig eth0 delete 192.168.1.1
    ip addr del 192.168.1.1/24 dev eth0
    ifconfig eth0 hw ether 00:0c:29:33:4e:aa ip link set dev eth0 address 00:0c:29:33:4e:aa
    netstat ss
    netstat -neopa ss -neopa
    route ip route
    route add -net 192.168.1.0 netmask 255.255.255.0 dev eth0 ip route add 192.168.1.0/24 dev eth0
    route add default gw 192.168.1.1 ip route add default via 192.168.1.1
      ip route replace 192.168.1.0/24 dev eth0

     

    내가 사용해본 net-tools 대비 iproute2 장점으로는

    • 더 짧은 간략한 명령어
    • ifconfig를 통해 link를 Down/Up 하면 IP 정보가 날아가는데 ip 명령어를 통해서 링크를 Down/Up 하면 해당 정보가 유지
    • IPv6 주소를 설정 할 경우 Scope를 지정 가능
    • Alias 없이 IP를 여러개 추가 제거가 가능

    Android 박스에서도 net-tools가 없는 경우가 있으므로 빨리 적응해 두는게 좋습니다.

     

     

     

    참조:

     

    728x90
    반응형

    댓글

Designed by Tistory.