회원 로그인
정보기억 정보기억에 체크할 경우 다음접속시 아이디와 패스워드를 입력하지 않으셔도 됩니다.
그러나, 개인PC가 아닐 경우 타인이 로그인할 수 있습니다.
PC를 여러사람이 사용하는 공공장소에서는 체크하지 마세요.
소셜네트워크 서비스를 통해서 로그인하시면 별도의 로그인 절차없이 회원서비스를 이용하실 수 있습니다.


최근 게시물

1.노션에서 작성 중

1.노션에서 작성 중

개편하기 전까지 노션에서 작성 중

2024.04.04//read more

2.ChatGPT

2.ChatGPT

OpenAI로 대규모 언어 모델대화형...

2023.03.16//read more

3.노코딩 게임 엔진 - 빌..

3.노코딩 게임 엔진 - 빌..

빌드 지원안드로이드iOS윈도우즈특이사...

2023.03.14//read more

4.(완료) 미접속 회원 정..

4.(완료) 미접속 회원 정..

[완료] 36명의 회원을 정리하였습니...

2023.02.16//read more

5.매뉴얼 플러스 - 전자제..



안정적인 DNS 서비스 DNSEver
DNS Powered by DNSEver.com


tc 명령어를 이용한 트래픽 제한 스크립트

푸딩뱃살 | 2015.03.07 18:44 | 조회 6460
tc 명령어를 이용한 트래픽 제한하기


설정은 아래만 수정하면 된다.

IF=eth0 #랜카드명, 주로 eth0 이름을 주소 사용
DNLD=1mbit #다운로드 제한, 단위 MB
UPLD=1mbit #업로드 제한, 단위 MB
IP=xxx.xxx.xxx.xxx #IF에 설정된 호스트 IP

tc.sh로 저장하고, 실행은
tc.sh start    #시작
tc.sh stop    #중지
tc.sh restart    #재시작
스크립트
#!/bin/bash
#
#  tc uses the following units when passed as a parameter.
#  kbps: Kilobytes per second 
#  mbps: Megabytes per second
#  kbit: Kilobits per second
#  mbit: Megabits per second
#  bps: Bytes per second 
#       Amounts of data can be specified in:
#       kb or k: Kilobytes
#       mb or m: Megabytes
#       mbit: Megabits
#       kbit: Kilobits
#  To get the byte figure from bits, divide the number by 8 bit
#

#
# Name of the traffic control command.
TC=/sbin/tc

# The network interface we're planning on limiting bandwidth.
IF=eth0             # Interface

# Download limit (in mega bits)
DNLD=1mbit          # DOWNLOAD Limit

# Upload limit (in mega bits)
UPLD=1mbit          # UPLOAD Limit

# IP address of the machine we are controlling
IP=xxx.xxx.xxx.xxx     # Host IP

# Filter options for limiting the intended interface.
U32="$TC filter add dev $IF protocol ip parent 1:0 prio 1 u32"

start() {

# We'll use Hierarchical Token Bucket (HTB) to shape bandwidth.
# For detailed configuration options, please consult Linux man
# page.

    $TC qdisc add dev $IF root handle 1: htb default 30
    $TC class add dev $IF parent 1: classid 1:1 htb rate $DNLD
    $TC class add dev $IF parent 1: classid 1:2 htb rate $UPLD
    $U32 match ip dst $IP/32 flowid 1:1
    $U32 match ip src $IP/32 flowid 1:2

# The first line creates the root qdisc, and the next two lines
# create two child qdisc that are to be used to shape download 
# and upload bandwidth.
#
# The 4th and 5th line creates the filter to match the interface.
# The 'dst' IP address is used to limit download speed, and the 
# 'src' IP address is used to limit upload speed.

}

stop() {

# Stop the bandwidth shaping.
    $TC qdisc del dev $IF root

}

restart() {

# Self-explanatory.
    stop
    sleep 1
    start

}

show() {

# Display status of traffic control status.
    $TC -s qdisc ls dev $IF

}

case "$1" in

    start)

        echo -n "Starting bandwidth shaping: "
        start
        echo "done"
        ;;

    stop)

        echo -n "Stopping bandwidth shaping: "
        stop
        echo "done"
        ;;

    restart)

        echo -n "Restarting bandwidth shaping: "
        restart
        echo "done"
        ;;

    show)

        echo "Bandwidth shaping status for $IF:"
        show
        echo ""
        ;;

    *)

        pwd=$(pwd)
        echo "Usage: tc.bash {start|stop|restart|show}"
        ;;

esac

exit 0

출처> http://www.xelloss.pe.kr/258
http://www.iplocation.net/tools/traffic-control.php
113개(1/6페이지)
운영체제
번호 제목 글쓴이 조회 날짜
113 [윈도우] onedrive(sharepoint) 네트워크 드라이브 연결 시 첨부파일 푸딩뱃살 262 2021.12.09 15:25
112 [윈도우] 탐색기에서 svn 오버레이 아이콘이 표시가 안될 때 첨부파일 푸딩뱃살 248 2021.10.20 15:17
111 [리눅스] CentOS 설치 후 오류 메시지 - vmwgfx 첨부파일 푸딩뱃살 849 2020.06.27 20:00
110 [윈도우] 윈도우 설치 프로그램 관리 (설치 / 삭제) 첨부파일 푸딩뱃살 732 2020.05.16 02:15
109 [윈도우] Visual Studio 2019 Community 설치 시 CPU 사용률 사진 첨부파일 푸딩뱃살 1229 2020.04.30 00:41
108 [맥] Mac에서 Windows 전환 푸딩뱃살 747 2020.03.16 22:40
107 [윈도우] batch 실행 명령창 숨기기 푸딩뱃살 1207 2019.10.07 14:45
106 [윈도우] 네트워크 드라이브 연결 batch 푸딩뱃살 819 2019.09.24 10:38
105 [윈도우] utorrentie 제거 푸딩뱃살 805 2019.09.01 01:03
104 [리눅스] vi 대소문자 구분 없이 검색 푸딩뱃살 1260 2019.08.09 00:22
103 [윈도우] 개체 참조가 개체의 인스턴스로 설정되지 않았습니다. 푸딩뱃살 823 2019.05.24 22:38
102 [리눅스] CUI 해상도 설정 푸딩뱃살 1219 2019.05.14 00:55
101 [리눅스] 리눅스 디렉토리 구조 첨부파일 푸딩뱃살 1618 2019.05.05 22:09
100 [리눅스] Kernel headers not found for target kernel 사진 첨부파일 푸딩뱃살 1987 2019.05.05 12:04
99 [윈도우] 맥북용 윈도우10 부팅 USB 만들기 첨부파일 푸딩뱃살 1854 2019.05.03 18:42
98 [맥] 크롬 비밀번호를 맥 키체인에 넣기 사진 첨부파일 푸딩뱃살 1007 2019.02.12 02:29
97 [윈도우] VirtualBox MacOS 설치 사진 첨부파일 푸딩뱃살 1358 2018.10.23 15:20
96 [윈도우] 윈도우즈 디펜더 검출된 리스트 삭제 푸딩뱃살 1476 2018.10.22 00:36
95 [리눅스] openssl 인증서 생성 푸딩뱃살 1863 2018.09.26 15:24
94 [윈도우] 전원 관리 hiberfil.sys 파일 삭제하기 푸딩뱃살 1197 2018.09.09 13:02