본문 바로가기

Linux/Ubuntu

네트워크 우선 순위 정하기

우분투에서 2개 이상의 네트워크 인터페이스를 사용한다면 다음과 같이 우선순위를 설정할 수 있다.

[출처] : https://superuser.com/questions/331720/how-do-i-set-the-priority-of-network-connections-in-ubuntu


'ifmetric'를 설치하여 설정한다.

$ sudo apt-get install ifmetric


$ route -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.42.0.1       0.0.0.0         UG    100    0        0 eth0
0.0.0.0         10.42.0.2       0.0.0.0         UG    600    0        0 wlan0

위와 같이 wlan0의 우선순위가 600이어서 순위가  eth0보다 낮다면 다음과 같이 수정하여 순위를 바꿀 수 있다.

$ sudo ifmetric wlan0 50


순위가 바뀐것을 확인할 수 있다.

$ route -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.42.0.2       0.0.0.0         UG    50     0        0 wlan0
0.0.0.0         10.42.0.1       0.0.0.0         UG    100    0        0 eth0