centos使用雙網絡卡時,如果要指定其中乙個網絡卡的閘道器作為預設路由,不能直接用route命令進行修改,或者只是刪除其中乙個預設路由。例如:
[expert@sec-cpsc-8001sz:0]# ifconfig
eth0
link
encap
:ethernet
hwaddr 00:50
:56:a6
:4f:9a
inet
addr
:99.1
.1.1
bcast
:99.1
.16.255
mask
:255
.255
.255
.0up
broadcast
running
multicast
mtu:1500
metric
:1rx
packets
:264636824
errors
:0dropped
:0overruns
:0frame
:0tx
packets
:1630865
errors
:0dropped
:0overruns
:0carrier
:0collisions
:0txqueuelen
:1000
rxbytes
:24486306913 (22.8
gib) tx
bytes
:2105592006 (1.9
gib)
eth1
link
encap
:ethernet
hwaddr 00:50
:56:a6
:7e:f4
inet
addr
:192
.168
.127
.8bcast
:192
.168
.127
.8mask
:255
.255
.255
.255
upbroadcast
multicast
mtu:1500
metric
:1rx
packets
:0errors
:0dropped
:0overruns
:0frame
:0tx
packets
:0errors
:0dropped
:0overruns
:0carrier
:0collisions
:0txqueuelen
:1000
rxbytes
:0 (0.0
b) tx
bytes
:0 (0.0
b)lo
link
encap
:local
loopback
inet
addr
:127
.0.0
.1mask
:255
.0.0
.0up
loopback
running
mtu:16436
metric
:1rx
packets
:132847578
errors
:0dropped
:0overruns
:0frame
:0tx
packets
:132847578
errors
:0dropped
:0overruns
:0carrier
:0collisions
:0txqueuelen
:0rx
bytes
:51965842204 (48.3
gib) tx
bytes
:51965842204 (48.3
gib)
有99.1.1.1和192.168.127.8兩個ip。如果希望預設路由從99.1.1.1的介面出:
cd /etc/sysconfig/network-scripts
echo 'iif eth1 table 1
from
192.168
.127
.8 table1' > rule-eth1
echo '192.168.127.0/24 dev eth1 table 1
default via 192.168
.127
.253 dev eth1 table 1
' > route-eth1
重啟網絡卡即可。 CentOS雙網絡卡配置預設路由
centos雙網絡卡,我們只需要乙個預設路由,如果兩個都有或都沒有會有一系列的問題 1.先route n 檢視路由配置 2.如果需要將 ifcfg eth1 設定為預設路由 修改 etc sysconfig network scripts 下 ifcfg eth1 網絡卡配置檔案中 defroute...
centos 雙網絡卡配置
對centname計算機進行配置 內網 em1 192.168.10.201 外網 em2 202.0.146.223 vi etc sysconfig network scripts ifcfg em2修改以下配置 device em2 type ethernet uuid d056c517 48...
centos雙網絡卡配置
對於學校來說 鳥哥的這種配置方案挺可行的。然後就會有一塊網路界面對內 假設為eth1 一塊網路介面對外 eth0 一 配置 etc sysconfig network scripts ifcfg eth0 1 如果是自動分配ip 示例 device eth0 onboot yes bootproto...