顯示具有 linux 標籤的文章。 顯示所有文章
顯示具有 linux 標籤的文章。 顯示所有文章

2011年7月15日 星期五

Centos5透通防火牆

Centos5透通防火牆

1.首先先安裝 bridge-utils套件
yum -y install bridge-utils

2.設定/etc/rc.d/rc.local 加入這兩行
echo "1" > /proc/sys/net/ipv4/ip_forward
/root/fw/tfw
service network restart


3.新增/root/tfw檔案 加入這幾行 檔案權限755
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 eth1
ifup br0
ifup eth0
ifup eth1

4.新增ifcfg-br0檔案在/etc/sysconfig/network-scripts/

DEVICE=br0
BOOTPROTO=static
IPADDR=88.88.88.88  #==>SSH登入管理用的IP
NETMASK=255.255.255.240 #==>SSH登入管理用的IPMASK
ONBOOT=yes
GATEWAY=88.88.88.89 SSH#==>登入管理用的IP GATEWAY

5.修改/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.1.99  #==>隨便
NETMASK=255.255.255.0
ONBOOT=yes

6.修改/etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.2.99  #==>隨便
NETMASK=255.255.255.0
ONBOOT=yes

7.重新開機,之後看用ifconfig看ifcfg-br0 ifcfg-eth0 ifcfg-eth1有沒有起來 有就成功







linux bonding設置

linux bonding設置 (Debian,RedHat)
Debian:
    1. apt-get install ifenslave-2.6
    2. edit the "/etc/network/interfaces"
         
auto bond0
iface bond0 inet static
address 10.3.240.1
netmask 255.255.255.0
network 10.3.240.0
gateway 10.3.240.254
up /sbin/ifenslave bond0 eth2
up /sbin/ifenslave bond0 eth3
        然後把eht2,eth3原來的給註釋掉。

    3. edit the "/etc/modprobe.d/arch/i386"
             
alias bond0 bonding
options bonding mode=1 miimon=100 downdelay=200 updelay=200

RedHat:

    1. edit "/etc/sysconfig/network-scripts/ifcfg-bond0"
DEVICE=bond0
IPADDR=10.3.240.1
NETMASK=255.255.255.0
NETWORK=10.3.240.0
BROADCAST=10.3.240.255
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
        
    2. edit "/etc/sysconfig/network-scripts/ifcfg-eth{1,2}"
DEVICE=eth0 //eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
         

    3. edit "/etc/modprobe.conf"
alias bond0 bonding







Reference: bonding mode
 0    balance-rr       ‧負載平衡模式, 需有 switch 設定 (trunk) 支援才能發揮實質效果
‧具容錯功能, 其中一張 Slave 網卡失效仍可持續運作
 1     active-backup       ‧同一時間只有單一 Slave 網卡運作
‧Active Slave 網卡失效時自動啟用次一順位 Slave 網卡
‧不需 switch 支援
 2   balance-xor      
 3    broadcast       ‧所有 Slave 網卡一齊收送網路封包
‧具容錯功能, 其中一張 Slave 網卡失效仍可持續運作
 4    802.3ad         
 5    balance-tlb     ‧傳出自動負載平衡
‧傳入由 Current Active Slave 負責
‧具容錯功能, 其中一張 Slave 網卡失效仍可持續運作
‧不需 switch 支援及設定
 6    balance-alb     ‧傳出及傳入皆自動負載平衡
‧具容錯功能, 其中一張 Slave 網卡失效仍可持續運作
‧Slave 網卡 driver 需支援 setting hardware address 功能
‧不需 switch 支援及設定