Linux雙網卡配置

查看網卡數量

#ifconfig -a|grep eth



第一步:配置網卡配置

#cd /etc/sysconfig/network-scripts/

#vi ifcfg-eth0


DEVICE=eth0

ONBOOT=yes #系統啓動時自動啓用該設備

BOOTPROTO=none    #啓動時不使用任何協議


#vi ifcfg-eth1


DEVICE=eth1

ONBOOT=yes #系統啓動時自動啓用該設備

BOOTPROTO=none    #啓動時不使用任何協議


#vi ifcfg-bond0


DEVICE=bond0 #虛擬網卡名稱

BOOTPROTO=static 

IPADDR=10.141.8.130 #IP地址

NETMASK=255.255.255.0 #子網掩碼

GATEWAY=10.141.8.254 #網關

ONBOOT=yes

TYPE=Ethernet


第二步:配置綁定模式

#cd /etc/modprobe.d/

#vi dist.conf

在後面加入  mode=0是負載模式,mode=1是主備模式

alias bond0 bonding

options bond0 miimon=100 mode=1


第三步:設置開機自動配置雙網卡綁定

#vi /etc/rc.local

加入:

ifenslave bond0 eth0 eth1


第四步:重啓網絡設置

#service network 


第五步:關閉Linux防火牆:

執行 service iptables stop

執行 chkconfig iptables off (重啓後不啓動)


第六步:重啓服務器

reboot


第七步:停止守護進程(注:一般操作到第六步後即可實現雙網卡綁定。如果沒有生效,可以嘗試以下步驟!)


#service NetworkManager stop

#chkconfig NetworkManager off


將NM_CONTROLLED改爲no。


查看Selinux狀態

1、/usr/sbin/sestatus -v     如果SELinux status參數爲enabled 即爲開啓狀態



關閉 SELinux:

1、臨時關閉(不用重啓機器)

Setenforce 0  ##設置SELinux成爲permissive模式

Setenforce 1  ##設置SELinux成爲enforcing模式

2、修改配置文件需要重啓機器

修改 /etc/selinux/config  文件

將SELINUX=enfocring改爲SELINUX=disables


配置完成後機器重啓再次驗證



ethtool 網卡驅動 來顯示網卡信息  


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章