close

由於需要使用CUDA過濾封包程式進行壓力測試,又不希望被萬惡計算機中心封鎖網卡....又希望在家裡可以連至實驗室

因此需要雙網卡(外網+內網)的方式來達成,以下是設定說明。

1.Configure /etc/network/interface

sudo vim /etc/network/interface

auto eth0
iface eth0 inet static
address 192.168.0.137
netmask 255.255.255.0
gateway 192.168.0.1

auto eth1
iface eth1 inet static
address 140.128.X.X
netmask 255.255.255.0
gateway 140.128.X.X


auto lo
iface lo inet loopback

將內網設定為eth0

靜態取得 192.168.0.137 虛擬IP

使用eth1 設定為固定IP140.128.XX 可供外部通訊使用

 

2.設定ip route

Ubuntu 基本上內建都已配置 route的功能

因此使用route -n 查看內容

Destination         Gateway              Genmask                  Flags   Metric  Ref    Use Iface
192.168.0.137     0.0.0.0                255.255.255.255     UH       0         0        0 eth0
140.128.x.x   0.0.0.0                255.255.255.255     UH       0         0        0 eth1
140.128.x.x   0.0.0.0                255.255.255.255     UH       0         0        0 eth0
192.168.0.0         0.0.0.0                255.255.255.0         U         0         0        0 eth0
140.128.x.0       0.0.0.0                255.255.255.0         U         0         0        0 eth1
169.254.0.0         0.0.0.0                255.255.0.0             U         1000   0        0 eth0
0.0.0.0                 140.128.x.254  0.0.0.0                     UG       100     0        0 eth1
0.0.0.0                 192.168.0.1        0.0.0.0                     UG       100     0        0 eth0
 

雖然乍看之下配置都正常,但是由於未指定IP 該由哪個裝置來進行收發封包的動作,

因此整台伺服器網卡無法work,導致外網無法正常使用。

3.確認配置正確後,將使用route 來設定各IP所對應的網卡設備

sudo route add -host 192.168.0.1 dev eth0

sudo route add -host 140.128.x.x dev eth1

將192.168.0.137指定由eth0來進行封包收發,140.128.x.x指定由eth1來進行封包收發。

 

*透過以上設定之後,伺服器將可順利的利用雙網卡達成內網與外網共存的環境了。

 

最後透過Colasoft Packet Builder 1.0 封包製造軟體,來達到gigabit的測試環境。

 

參考於以下文章

linux下route add route del 用法


arrow
arrow

    忽倫 發表在 痞客邦 留言(1) 人氣()