버전 비교

  • 이 줄이 추가되었습니다.
  • 이 줄이 삭제되었습니다.
  • 서식이 변경되었습니다.

...

  • Load Balancing 
    • 로드 밸런싱(Load Balancing)이란? - 수 많은 트래픽들을 처리하기 위해서 균등하게 모든 사용자에게 트래픽을 배분하여 제공해서 네트워크 과부하를 막는 기능.

    • 코드 블럭
      titleLoad Balancing
      //5 tuple에 hash알고리즘을 적용하고, 결과를 mata.ecmp_select에 저장하는 행동,
        ecmp_nhop 테이블은 이를 이용하여 전송 //
      action set_ecmp_select(bit<16> ecmp_base, bit<32> ecmp_count) {
      	hash(meta.ecmp_select,
      		HashAlgorithm.crc16,
      		ecmp_base,
      		{ hdr.ipv4.srcAddr,
      		  hdr.ipv4.dstAddr,
      		  hdr.ipv4.protocol,
      		  hdr.tcp.srcPort,
      	 	  hdr.tcp.dstPort },
      		ecmp_count);
      }
      
      // ipv4가 유효하고, ttl이 0에 도달하지 않았을 경우 전송을 실시한다. //
      apply {
      	if (hdr.ipv4.isValid() && hdr.ipv4.ttl > 0) {
      		ecmp_group.apply();
      		ecmp_nhop.apply();
      		}
      	}
      


  • QOS(Quality Of Service)
    • QOS란?

    • 코드 블럭
      titleQoS
      
      /* Default Forwarding */
      action default_forwarding() {
      hdr.ipv4.diffserv = 0;
      }
      
      
      /* Expedited Forwarding */
      action expedited_forwarding() {
      hdr.ipv4.diffserv = 46;
      }
      
      
      /* Voice Admit */
      action voice_admit() {
      hdr.ipv4.diffserv = 44;
      }
      
      
      /* Assured Forwarding */
      /* Class 1 Low drop probability */
      action af_11() {
      hdr.ipv4.diffserv = 10;
      }
      
      
      /* Class 1 Med drop probability */
      action af_12() {
      hdr.ipv4.diffserv = 12;
      }
      
      
      /* Class 1 High drop probability */
      action af_13() {
      hdr.ipv4.diffserv = 14;
      }
      
      
      /* Class 2 Low drop probability */
      action af_21() {
      hdr.ipv4.diffserv = 18;
      }
      
      
      /* Class 2 Med drop probability */
      action af_22() {
      hdr.ipv4.diffserv = 20;
      }
      
      
      /* Class 2 High drop probability */
      action af_23() {
      hdr.ipv4.diffserv = 22;
      }
      
      
      /* Class 3 Low drop probability */
      action af_31() {
      hdr.ipv4.diffserv = 26;
      }
      
      
      /* Class 3 Med drop probability */
      action af_32() {
      hdr.ipv4.diffserv = 28;
      }
      
      
      /* Class 3 High drop probability */
      action af_33() {
      hdr.ipv4.diffserv = 30;
      }
      
      
      /* Class 4 Low drop probability */
      action af_41() {
      hdr.ipv4.diffserv = 34;
      }
      
      
      /* Class 4 Med drop probability */
      action af_42() {
      hdr.ipv4.diffserv = 36;
      }
      
      
      /* Class 4 High drop probability */
      action af_43() {
      hdr.ipv4.diffserv = 38;
      }
      
      
      pply {
      if (hdr.ipv4.isValid()) {
      if (hdr.ipv4.protocol == IP_PROTOCOLS_UDP) {
      expedited_forwarding();
      }
      else if (hdr.ipv4.protocol == IP_PROTOCOLS_TCP) {
      voice_admit();
      }
      ipv4_lpm.apply();
      }
      }
      
      
      


2/22

2/23

2/24


Memo

P4를 이용하기 전  무조건 알아두면 좋은 점 및 소개