文書更新:2020年11月23日(月) 午後2時00分24秒

Home > 備忘録(Fedora) > ネットワーク構築 > 複数 nic の優先順位の変更( 134 )

複数 nic の優先順位の変更

metric の値は 0〜429,496,729(32ビット整数)で、windowsの場合は1〜9999までです。その値の最小値のインターフェイスが最優先される。
  1. metric の確認
  2. metric の値が最小のインターフェイス優先するので、enp3s0(100)が優先される。
    優先順位は:enp3s0(100)ー>wlp2s0(600)
    [root@server]# route
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    default         _gateway        0.0.0.0         UG    100    0        0 enp3s0
    default         _gateway        0.0.0.0         UG    600    0        0 wlp2s0
    192.168.10.0    0.0.0.0         255.255.255.0   U     100    0        0 enp3s0
    192.168.10.0    0.0.0.0         255.255.255.0   U     600    0        0 wlp2s0
  3. metric の変更
  4. [root@server]# nmcli connection modify enp3s0の接続名 ipv4.route-metric 600		// 100 -> 600
    
    [root@server]# nmcli connection modify wlp2s0の接続名 ipv4.route-metric 100		// 600 -> 100
  5. metric の反映
  6. [root@server]# nmcli connection up enp3s0の接続名		// 反映
    
    [root@server]# nmcli connection up wlp2s0の接続名		// 反映
  7. metric の確認
  8. enp3s0 の metric が (100->600) , wlp2s0 の metric が (600->100) に変更されていることが確認できる。
    優先順位は:wlp2s0(100)ー>enp3s0(600)
    [root@server]# route
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    default         _gateway        0.0.0.0         UG    100    0        0 wlp2s0
    default         _gateway        0.0.0.0         UG    600    0        0 enp3s0
    192.168.10.0    0.0.0.0         255.255.255.0   U     100    0        0 wlp2s0
    192.168.10.0    0.0.0.0         255.255.255.0   U     600    0        0 enp3s0