4.2. Prioritizing Network Traffic


When running multiple network-related services on a single server system, it is important to define network priorities between these services. Defining these priorities ensures that packets originating from certain services have a higher priority than packets originating from other services. For example, such priorities are useful when a server system simultaneously functions as an NFS and Samba server. The NFS traffic must be of high priority as users expect high throughput. The Samba traffic can be deprioritized to allow better performance of the NFS server.
The net_prio subsystem can be used to set network priorities for processes in cgroups. These priorities are then translated into Type Of Service (TOS) bits and embedded into every packet. Follow the steps in Procedure 4.2, “Setting Network Priorities for File Sharing Services” to configure prioritization of two file sharing services (NFS and Samba).

Procedure 4.2. Setting Network Priorities for File Sharing Services

  1. The net_prio subsystem is not compiled in the kernel, it is a module that must be loaded manually. To do so, type:
    ~]# modprobe net_prio
    Copy to Clipboard Toggle word wrap
  2. Attach the net_prio subsystem to the /cgroup/net_prio cgroup:
    ~]# mkdir /cgroup/net_prio
    ~]# mount -t cgroup -o net_prio net_prio /cgroup/net_prio
    Copy to Clipboard Toggle word wrap
  3. Create two cgroups, one for each service:
    ~]# mkdir /cgroup/net_prio/nfs_high
    ~]# mkdir /cgroup/net_prio/samba_low
    Copy to Clipboard Toggle word wrap
  4. To automatically move the nfs services to the nfs_high cgroup, add the following line to the /etc/sysconfig/nfs file:
    CGROUP_DAEMON="net_prio:nfs_high"
    Copy to Clipboard Toggle word wrap
    This configuration ensures that nfs service processes are moved to the nfs_high cgroup when the nfs service is started or restarted. For more information about moving service processes to cgroups, refer to Section 2.9.1, “Starting a Service in a Control Group”.
  5. The smbd daemon does not have a configuration file in the /etc/sysconfig directory. To automatically move the smbd daemon to the samba_low cgroup, add the following line to the /etc/cgrules.conf file:
    *:smbd                net_prio                samba_low
    Copy to Clipboard Toggle word wrap
    Note that this rule moves every smbd daemon, not only /usr/sbin/smbd, into the samba_low cgroup.
    You can define rules for the nmbd and winbindd daemons to be moved to the samba_low cgroup in a similar way.
  6. Start the cgred service to load the configuration from the previous step:
    ~]# service cgred start
    Starting CGroup Rules Engine Daemon:                       [  OK  ]
    
    Copy to Clipboard Toggle word wrap
  7. For the purposes of this example, let us assume both services use the eth1 network interface. Define network priorities for each cgroup, where 1 denotes low priority and 10 denotes high priority:
    ~]# echo "eth1 1" > /cgroup/net_prio/samba_low
    ~]# echo "eth1 10" > /cgroup/net_prio/nfs_high
    Copy to Clipboard Toggle word wrap
  8. Start the nfs and smb services and check whether their processes have been moved into the correct cgroups:
    ~]# service smb start
    Starting SMB services:                                     [  OK  ]
    ~]# cat /cgroup/net_prio/samba_low
    16122
    16124
    ~]# service nfs start
    Starting NFS services:                                     [  OK  ]
    Starting NFS quotas:                                       [  OK  ]
    Starting NFS mountd:                                       [  OK  ]
    Stopping RPC idmapd:                                       [  OK  ]
    Starting RPC idmapd:                                       [  OK  ]
    Starting NFS daemon:                                       [  OK  ]
    ~]# cat /cgroup/net_prio/nfs_high
    16321
    16325
    16376
    
    Copy to Clipboard Toggle word wrap
    Network traffic originating from NFS now has higher priority than traffic originating from Samba.
Similar to Procedure 4.2, “Setting Network Priorities for File Sharing Services”, the net_prio subsystem can be used to set network priorities for client applications, for example, Firefox.
맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat