iT邦幫忙

0

LINUX 雙網卡雙IP(一個是PPPOE,另外一個是固定IP)

大家好!

我適用centOS6.4
想請問一下,我有設定2組IP於2張網卡上,一張是設定成PPPOE撥號才能上網,另外一張是設定成固定IP就可以上網(不是動態式的固定IP)。
2張網卡的網路線都各自直接連到中華電信的小烏龜。
當我輸入「ping tw.yahoo.com -I 動態IP」時,是正常回應。
但是當我輸入「ping tw.yahoo.com -I 固定IP」時,就無法正常回應。

這我的route table
代碼:

route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
168.95.98.254   0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
125.227.246.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     1002   0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U     1003   0        0 eth0
0.0.0.0         0.0.0.0         0.0.0.0         U     0      0        0 ppp0

想請問我是哪邊還需要設定才能讓2張網卡都能上網呢~?

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

2 個回答

6
ganymede
iT邦好手 1 級 ‧ 2013-11-04 16:36:13
最佳解答

關鍵字 multipath

Rick Hsu iT邦新手 4 級 ‧ 2013-11-06 15:40:40 檢舉

不太懂您的意思....

2
xxoo1122
iT邦新手 3 級 ‧ 2013-11-10 13:15:47

使用IPROUTE2
先定義一下rt_tables

<pre class="c" name="code">
vi /etc/iproute2/rt_tables
新增
1       cht.dymaics
2       cht.fixip





<pre class="c" name="code">
vi /etc/sysconfig/network-scripts/route-eth1
先來定義外網路由
xxx.xxx.xxx,xxx/x dev ppp0 table cht.dynamics
xxx.xxx.xxx.xxx/x dev eth1 table cht.fixip
default via pppoe線的GW dev PPP0 table cht.dynamics

xxx.xxx.xxx,xxx/x dev ppp0 table cht.dynamics
xxx.xxx.xxx.xxx/x dev eth1 table cht.fixip
default via 固定ip線的GW dev eth1 table cht.fixip





<pre class="c" name="code">
vi /etc/sysconfig/network-scripts/route-eth0
再來定義內網怎麼走
192.168.0.0/24 dev eth0 table cht.dymamics
192.168.0.0/24 dev eth0 table cht.fixip





<pre class="c" name="code">

vi /etc/sysconfig/network-scripts/rule-eth1
from xxx.xxx.xxx/xx table cht.dynamics
from xxx.xxx.xxx/xx table cht.fixip

最後 /etc/init.d/network restart
這樣就搞定了,IP在自己替換一下

我要發表回答

立即登入回答