2014年3月28日 星期五

IP Alias

需求:
  1. 人機有兩顆實體網路port ,而系統只有一個,切換人機按鈕決定走哪一port。
  2. UDP協定
問題:
    人機兩個實體port網域(30.x , 29.x) 不同,而系統預設網域為.30.x,若切換到port2,會發生  ENETUNREACH 101     /* Network is unreachable */

解決方法:
    系統端產生網路IP Alias,同一實體網卡包兩組IP


 人機網卡配置
eth0      Link encap:Ethernet  HWaddr 00:19:23:05:37:B1
          inet addr:192.168.30.1  Bcast:192.168.30.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:66267 errors:0 dropped:0 overruns:0 frame:0
          TX packets:50736 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:15513046 (14.7 MiB)  TX bytes:6076898 (5.7 MiB)
          Interrupt:29

eth1      Link encap:Ethernet  HWaddr 00:E0:3D:F4:61:17
          inet addr:192.168.29.1  Bcast:192.168.29.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:79

系統終端下指令,產生網路IP Alias,且設定IP
ifconfig eth0:0 192.168.29.100
系統端網卡配置結果:
eth0      Link encap:Ethernet  HWaddr 12:34:56:78:9A:BC
          inet addr:192.168.30.2  Bcast:192.168.30.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:55863 errors:0 dropped:0 overruns:0 frame:0
          TX packets:50735 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:7074697 (6.7 MiB)  TX bytes:12358948 (11.7 MiB)
          Interrupt:67

eth0:0    Link encap:Ethernet  HWaddr 12:34:56:78:9A:BC
          inet addr:192.168.29.100  Bcast:192.168.29.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:67

沒有留言:

張貼留言

try comments