Server/Linux
[Linux] Network Interface 우선 순위 변경하기
1nfra
2022. 10. 9. 03:22
728x90
안녕하세요 ~
오늘은 Ubuntu에서 Network Interface 가 여러 개 존재할 경우 우선순위를 바꾸는 방법을 알아봤습니다.
apt install ifmetric
1. 먼저 ifmetric를 설치합니다.
root@zabbix:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 ens160
0.0.0.0 192.168.100.1 0.0.0.0 UG 50 0 0 ens192
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 ens160
192.168.100.0 0.0.0.0 255.255.255.0 U 50 0 0 ens192
2. route -n 명령어로 metric을 확인을 합니다. (metric이 작을수록 우선순위가 높다!)
ifmetric ens160 60
3. ifmetric 명령어로 metric을 변경해봅니다.
root@zabbix:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.100.1 0.0.0.0 UG 50 0 0 ens192
0.0.0.0 192.168.1.1 0.0.0.0 UG 60 0 0 ens160
192.168.1.0 0.0.0.0 255.255.255.0 U 60 0 0 ens160
192.168.100.0 0.0.0.0 255.255.255.0 U 50 0 0 ens192
4. route -n 명령어로 metric을 확인을 해보면 우선순위가 변경된 것을 확인할 수 있습니다.
728x90