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

11/27/2011

設定 Red hat Enterprise Linux bonding 介面.

 

設定Red hat Enterprise Linux bonding 介面流程如下:

  1. 確認主機上至少有兩張網卡.
  2. 編輯或新增4個檔案:
    1. 編輯 /etc/sysconfig/network-scripts/ifcfg-eth0
    2. 編輯 /etc/sysconfig/network-scripts/ifcfg-eth1
    3. 新增 /etc/sysconfig/network-scripts/ifcfg-bond0
    4. 新增 /etc/mdoprobe.d/bonding.conf
  3. 重新啟動網路服務.
  4. 確認 bond0 介面,是否啟用.
  5. 查看目前 bond0,使用之實體網路埠.
  6. 手動切換 bond0,使用之實體網路埠.

我們接著看每個步驟較詳細的設定/檢查方法.

  1. 確認主機至少有兩張網卡.
    [root@XXOOXp ~]# dmesg | egrep 'eth.:'
    e1000: eth0: e1000_probe: Intel(R) PRO/1000 Network Connection
    e1000: eth1: e1000_probe: Intel(R) PRO/1000 Network Connection

  2. 編輯或新增4個檔案:
    1. 編輯 /etc/sysconfig/network-scripts/ifcfg-eth0 的內容.
      [root@XXOOXp network-scripts]# cat ifcfg-eth0
      DEVICE=eth0
      BOOTPROTO=static
      MASTER=bond0
      SLAVE=yes
      ONBOOT=yes

    2. 編輯 /etc/sysconfig/network-scripts/ifcfg-eth1 的內容.
      [root@XXOOXp network-scripts]# cat ifcfg-eth1
      DEVICE=eth1
      MASTER=bond0
      SLAVE=yes
      ONBOOT=yes

    3. 新增 /etc/sysconfig/network-scripts/ifcfg-bond0
      [root@XXOOXp network-scripts]# cat ifcfg-bond0
      DEVICE=bond0
      IPADDR=192.168.75.55
      NETMASK=255.255.255.0
      ONBOOT=yes
      BOOTPROTO=static
      BONDING_OPTS="mode=1 miimon=50"

    4. 新增 /etc/mdoprobe.d/bonding.conf
      [root@XXOOXp modprobe.d]# cat bonding.conf
      alias bond0 bonding

  3. 重新啟動網路服務:
    [root@XXOOXp ~]# service network restart

  4. 確認 bond0 介面,是否啟用.
    [root@XXOOXp ~]# ip addr show bond0
    5: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue
        link/ether 00:0c:29:0f:d7:c6 brd ff:ff:ff:ff:ff:ff
        inet 192.168.75.55/24 brd 192.168.75.255 scope global bond0
        inet6 fe80::20c:29ff:fe0f:d7c6/64 scope link
           valid_lft forever preferred_lft forever

  5. 查看目前 bond0,使用之實體網路埠.
    [root@XXOOXp ~]# cat /proc/net/bonding/bond0
    Ethernet Channel Bonding Driver: v3.4.0 (October 7, 2008)

    Bonding Mode: fault-tolerance (active-backup)
    Primary Slave: None
    Currently Active Slave: eth0
    MII Status: up
    MII Polling Interval (ms): 50
    Up Delay (ms): 0
    Down Delay (ms): 0

    Slave Interface: eth0
    MII Status: up
    Link Failure Count: 0
    Permanent HW addr: 00:0c:29:0f:d7:c6

    Slave Interface: eth1
    MII Status: up
    Link Failure Count: 0
    Permanent HW addr: 00:0c:29:0f:d7:d0
    [root@XXOOXp ~]#

  6. 手動切換 bond0,使用之實體網路埠.
    [root@XXOOXp ~]# ifenslave --change-active bond0 eth1
    [root@XXOOXp ~]# cat /proc/net/bonding/bond0 | egrep 'Currently'
    Currently Active Slave: eth1

參考資料:

Network Card Bonding On CentOS (bonding 不同 mode 的說明)

8.2.2. Channel Bonding Interfaces

23.7.2. Using Channel Bonding

Bonding on Debian

[root@XXOOXp ~]# modinfo bonding

[root@XXOOXp ~]# man modprobe.conf


10/13/2011

如何檢查 RHEL 5.X and AIX 的網卡連接狀態?

 

How to check RHEL 5.x (or above) and IBM AIX NIC link status?

 

這個是滿實用的一個功能...

有時人不在機器旁邊又不確定線到底有沒有接,

又或是線到底有沒有感應到...就會派上用場了!

 

關於 RHEL 5.x (或以上),可透過下面的指令..

[xxooxp ~]# ethtool eth0 | egrep 'Link'
        Link detected: yes

或是

[xxooxp ~]# mii-tool –v eth0

 

而在IBM AIX上,可透過下面的指令

root@aix61 / # netstat -v | egrep '(ETHERNET|Link)'
ETHERNET STATISTICS (ent3) :
Logical Port Link State: Up
Physical Port Link State: Down
ETHERNET STATISTICS (ent2) :
Logical Port Link State: Up
Physical Port Link State: Down
ETHERNET STATISTICS (ent0) :
Link Status : Up
ETHERNET STATISTICS (ent1) :
Link Status : UNKNOWN


1/07/2011

RHEL Login shells v.s. non-login shells

 

Login Shells

  1. Login Shells 使用的 Startup scripts 如下順序: (紅色只有 Login shells 才有)
    1. /etc/profile (global configuration)
    2. /etc/profile.d/*.sh
    3. $HOME/.bash_profile (user configuration)
    4. $HOME/.bashrc
    5. /etc/bashrc
  2. 有哪些是 Login Shells ?,任何在登入時建立的 shells,舉例有
    • Virtual Console (Ctrl + Alt F1 ~ F6)
    • X Login
    • Remote Login (SSH, Telnet …etc.)
    • su -
    • 用 su - 切換時使用者也是 login shells。

 

Non-Login Shells

  1. Non-Login Shells 使用的 Startup scripts 如下順序:
    1. $HOME/.bashrc
    2. /etc/bashrc
    3. /etc/profile.d/*.sh
  2. 有哪些是 Non-Login Shells ?,沒有登入的 shells (打帳號 / 密碼),舉例有
    • su
    • graphical terminals.
    • any other bash instances.
    • executed scripts.

 

應用方式

依 Login shells 與 Non-Login shells 使用不同 Startup script 的特色,來做一些環境變數(Environment variables)的調整。



12/10/2010

安裝 RHEL / CentOS 中文字型,以顯示中文。

 

若一開始是使用英文方式安裝,且又沒安裝中文語系,

之後在切換為 zh_TW.UTF-8 時,都會出現方塊字,

這個時候需要透過安裝字型來解決方塊字的問題。

 

作法是,在 RHEL / CentOS 光碟中的 \Server 資料夾內找到兩個 rpm 檔。

fonts-chinese-3.02-12.el5.noarch.rpm

fonts-ISO8859-2-75dpi-1.0-17.1.noarch.rpm

在 X-Windows 下直接點擊該檔執行即可。

若是使用指令的話則是如下:

### 假設剛說的兩個 rpm 檔都放在 /tmp 下。

/ # cd /tmp

/tmp # rpm –ivh fonts-chinese-3.02-12.el5.noarch.rpm

/tmp # rpm –ivh fonts-ISO8859-2-75dpi-1.0-17.1.noarch.rpm

結束,現在登出系統在重新登入即可。(重開機也行)