2005/8/20
WinXp 不提 名稱解析 ---2276先講完
Module 1:
OSI (Open systems Interconnection)
ISO (International Standards Organization ) 於1978 制定OSI
TCP/IP 於1974年制定
Unix 於1969年
Physical Layer 實體層: 1.媒體定義:接腳.訊號0.1
2.編碼方式:曼徹斯特.微分曼徹斯特
對應設備:Repeator,Hub(1.Active Hub 2.Passive Hub)
Ex:Passive Hub 有線電視分接頭
線材部份
category 1 2M telphone
2 4M tokenring
3 10M
4 16M tokenring
5 100M
6 2.4G
EIA/TIA 568B
白橙 橙 白綠 藍 白藍 綠 白棕 棕
Tx+ Tx- Rx+ Rx-
1 2 3 6
Data-Link Layer 連結層: 1.MAC:定址.框架化. 存取CSMA/CD
2.LLC:錯誤控制.流量控管
對應設備: Switch, Bridge (介紹Switch and Hub 的差異)
定址的部份: Lab:使用ipconfig /all 觀察
Physical Address . . . . . . . . . . . . : 00-00-00-00-00-00
(48bits Physical Address / 6 Bytes Physical Address)
框架化: 以乙太網路介紹
--------------------------------------------------------------
| D MAC | S MAC | 0800 | Data | CRC |
--------------------------------------------------------------
存取:CSMA/CD
<---------. ------->
-----------------------------------------------------------
| | | |
A B C D
CSMA:多重載波
CD: 碰撞偵測
LLC 錯誤控制:利用CRC 檢查正確性
流量控制:利用buffer
Network Layer 網路層: 1.定址: 區域性, 唯一性
2.路由:
對應設備: Router, Layer 3 Switch
------------------
------------------------- | Router |------------------------------
------------------
<---collision------> <---collision------------->
<---broadcast----> <---broadcast----------->
------------------
------------------------- | Switch |------------------------------
------------------
<---collision------> <---collision------------->
<--------------------------broadcast------------------------------->
------------------
------------------------- | Hub |------------------------------
------------------
<-----------------------collision Domain------------------------->
<---------------------broadcast Domain------------------------->
以下的環境要採購那些設備?
------------------
-----IP----------------- | Router |-----------------IP---------
------------------
------------------
-----IPX--------------- | Router |----------------IPX---------
------------------
------------------
-----BNC------------- | Hub |---------------UTP---------
------------------
------------------
-----ethernet------- | Bridge |------Token Ring--------
------------------
Layer 3 Switch
----------------------------------------------------
| 0 0 <-----> 0 0 |
----------------------------------------------------
VLAN1 VLAN2
Transport Layer傳輸層: 1.錯誤控制 2.流量控制
Session Layer 會議層: 1.連線維護
2.資料交換方式: 全雙工, 半雙工, 單工
單工: 收音機
半雙工: 對講機
雙工: 電話
Lab:開啟兩個browser 觀察session
Presentation Layer 表現層: 資料格式 加密/解密 字元碼(ASCII,EBCDIC)
Lab:開啟網頁觀察原始檔
Application Layer 應用層: Server 服務 Client 要求
介紹光碟的內容(OSI多媒體部份)......概述
光碟內
addread ----> RFC文件
multimedia --> 上課用的多媒體及flash練習
flash ----> Flash程式
介紹RFC
http://www.ietf.org/rfc.html
LAB: 輸入書上的1180觀察文件內容(TCP/IP)
介紹TCP/IP Protocol Suite
TCP: connection-oriented reliable communications
http://tw.yahoo.com
Three way and shake
A ------------------> B
<-----------------
------------------>
UDP: connectionless communications
for example: DNS service
Ipv4: 32 bits
Ipv6: 128 bits
ARP: Address Resolution Protocol IP ---> MAC (將IP轉換成MAC address)
RARP: MAC ---> IP (將MAC address轉換成IP)
OSI 7 Layer 只有 Physical Layer 有實體連結,其他都是虛擬連結
ICMP:Internet Control Message Protocol Ex: ping and router 回覆錯誤訊息
Lab: ping www.microsoft.com ---> Request timed out
http://www.microsoft.com ---> Ok
ICMP 不保證網路是否正常或是不正常,單純測試用. 但某些網站會拒絕回應
ICMP request: type 8 code 0
ICMP reply: type 0 code o
Unicast: 目的是一台主機
--->
--------------------------------------------------
| | | |
A B C D
A unicast B
------------------------------------
| D B_MAC | S A_MAC |
------------------------------------
Broadcast: 目的是同一實體網路上的所有主機
--->
--------------------------------------------------
| | | |
A B C D
A broadcast
---------------------------------------------------
| FF:FF:FF:FF:FF:FF | S A_MAC |
---------------------------------------------------
broadcast and unicast 都是傳送一個封包,所以不會遽增網路流量.只是因為 broadcat 封包每台主機都要處理.會影響效能
Multicast: 目的是一群主機
--->
--------------------------------------------------
| | | |
A B C D
A Multicast (for B and C)
IP address range 224~239開頭的ip Multicast
---------------------------------------------------
| 01:00:5E:xx:xx:xx | S A_MAC |
---------------------------------------------------
固定以 01:00:5E開頭
後面xx:xx:xx 取TCP/IP 低23位元的組合
例如:ip為 224.0.1.10
D MAC為 01:00:5E:00:01:0A
00:01:10對應224.0.1.10中的0.1.10使用16位元轉換
0 --> 00 1 --> 01 10 --> 0A
概略介紹
SMTP: Simple Mail Transport Protocol郵件傳送及交換
SNMP: Simple Network Management Protocol
What is ping?
Lab: ping 10.0.1.254 -----> ping 區網應該< 10以下的ms
ping 168.95.1.1 -----> ping 外網應該< 200以下的ms
了解網路品質及狀況
Network Monitor
在2000 & 2003 server上才有server端但是為簡易版
在 Microsoft Systems Management Server (SMS) 為全功能版
XP --> 只有client端 --> 被監控
可以使用 http://www.ethereal.com 上面的工具 ---> 全功能版
Lab: Install Network Monitor
1.Start --> Control Panel --> Add or Remove Programs
2.Add/Remove Windows components
3.Management and Monitoring Tools --> Details
4.Network Monitor Tools --> Select --> Ok --> Next -->select source --> open --> Finish
在教室的環境由於是用image所以必須開啟my computer
1.E:\Document and Setting\Administrator --> Mouse Right click --> Properties
2.Security --> Remove unknown user and add administrator --> 勾選Full control --> OK
在家中練習不需要更改以上!!
Lab: ping 10.0.1.254並用Network Monitor監看
Network Monitor
1.Start --> All Programs --> Administrative Tools --> Network Monitor
2.Select a network --> Local computer --> Local Area Connection --> OK
3.Capture --> Start
4.使用command prompt -->ping 10.0.1.254
5.Capture --> Stop and View
6.觀察
1.ETHERNET: Destination address, Source address
2.IP: Source Address, Destination address
3.ICMP:
How Dotted Decimal Notation Relates to Binary Numbers
27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
Ex:
228 --> 1 1 1 0 0 1 0 0
0 --> 0 0 0 0 0 0 0 0
255 --> 1 1 1 1 1 1 1 1
What are the classes of IP Addresses?
class A Network host
w . x . y . z
第一個bit為必須0, 1~126開頭的網段 27-2個網路
Ex: ping apple.com
class B Network host
w . x . y . z
前兩個bits為必須10, 128~191開頭的網段 2(16-2) 個網路
class C Network host
w . x . y . z
前三個bits為必須110, 192~223開頭的網段 2(24-3) 個網路
class D Multicast
前三個bits為必須1110, 224~239開頭的網段
Subnet Mask
1 bits to indicate the network ID
0 bits to indicate the host ID
Example: 10.0.1.200/255.0.0.0
00001010.00000000.00000001.11001000 (IP)
AND 11111111.00000000.00000000.00000000 (Subnet Mask)
------------------------------------------------------------------------------------------------
00001010.00000000.00000000.00000000
10 . 0 . 0 . 0 (網段)
練習Module2 p15
介紹Private IP range
練習Module2 p15
為何要切割子網路?
1.Mix different network technologies
2.Overcome limitations of current technologies
3.Reduce network congestion
4.security
如何切割子網路 CIDR (Classless Inter Domain Routing)
1.依實際需求算出subnet mask (依照網路數量或是主機數量)
網路數量 小於等於 2的n次方
主機數量 小於等於 2的n次方
例如切割3個網路 小於等於2的2次方
192.168.0.0/255.255.255.192
192.168.0.0/11111111.11111111.11111111.11000000
向右邊移動兩個bits
例如需要100台主機 小於等於2的7次方
192.168.0.0/255.255.255.128
192.168.0.0/11111111.11111111.11111111.10000000
向右邊移動一個bits --> 因為host id 要大於100 故至少要27
2.根據subnet mask 展開每一個網路
192.168.0. 00000000~~00111111 192.168.0.0~63
01000000~~01111111 192.168.0.64~127
10000000~~10111111 192.168.0.128~191
11000000~~11111111 192.168.0.192~255
3.host id 全為0 --> Network, host id 全為1 --> Broadcast
CIDR
切割出來的subnet mask and host 都一樣
提一下速算法
2005/8/21
提一下IP浪費的問題及如何解決
使用private network (proxy & nat)
VLSM (variable length subnet masks)
介紹 192.168.0.0/255.255.255.0 及 192.168.0.0/24
假設有切割子網路的需求, 需求主機數量分別為
1.100 hosts 2.60 hosts 3. 20 hosts 4.16 hosts
其切割方式
192.168.0. 00000000
CIDR 00000000 --> 192.168.0.0/25 給100 hosts
10000000 剩下的子網路再切割
CIDR 10000000 --> 192.168.0.128/26 給 60 hosts
11000000 剩下的子網路再切割
CIDR 11000000 --> 192.168.0.192/27 給 20 hosts
11100000 --> 192.168.0.224/27 給 16 hosts
可搭配p51回去練習
What is Supernetting?
參考Module2 P53頁
220.78.168.0 11011100 01001110 10101000 00000000 -->start
220.78.175.0 11011100 01001110 10101111 00000000 -->end
<------------ 21 bits相同------->
將network Id往左邊移三個位址合併其網路
所以此連續的網段可以記為 220.78.168.0/21
Module 2 P.25 提到
RFC 950 文件提到舊的router設備只支援RFC 950, RFC 950 不允許subneting網路id全為0以及全為1. 故要將兩個子網路刪除,不可以使用!!
但現今的設備都支援RFC 1812的文件, RFC 1812的文件就允許網路id全為0以及全為1的subnet. 故可以使用所有的subnet.
Using IP Routing Tables
What is a Router?
1.啟動路由
2.有兩個以上的網路介面
The default gateway
1.Routes packets to other network.
2.Is used when the interal routing table on the host has no information on the destination subnet.
default gateway 通常為router
internet
| public ip
------------------
| Router |
------------------
.254 | | .254
--------------------- -------------------
| |
.1 A .1 B
192.168.1.0/24 192.168.0.0/24
default gateway default gateway
192.168.1.254 192.168.0.254
Practice: Determining Whether an IP Address is a Local or Remote
Your IP address 176.149.115.8
Subnet mask 255.255.252.0
Destination 176.149.117.201
Subnet mask 255.255.252.0
Is the destination address local or remote?
Ans: remote
256-252=4 115/4 = 28 28*4=112 --> 自己
117/4 = 29 29*4=116 --> remote
What is static and dynamic routing
Windows 2003 只支援 RIP(Routing Information Protocol) and OSPF(Open Shortest Path First) 兩種協定
路由表不是路由器的專屬.支援TCP/IP 的host 也有routing table
route print & netstat -r 兩個指令可以觀察路由表
255.255.255.255/255.255.255.255 limit broadcast 實體廣播
下表摘要列出用於指派連結至不同速度的網路介面之路由的標準。
連結速度
公制
大於 200 MB
10
大於 20 MB 且小於或等於 200 MB
20
大於 4 MB 且小於或等於 20 MB
30
大於 500 KB 且小於或等於 4 MB
40
小於或等於 500 KB
50
Lab: 觀察routing table
Teacher綁兩個ip
| 172.16.200.1
| 10.0.1.200
-----------------------------------------------
| |
A B 10.0.1.x
於B主機上
ping 10.0.1.200 --> OK
ping 172.16.200.1 --> timeout
解決此一問題 --> 新增一筆routing
route add _____________ mask ___________________ ______________
主機 255.255.255.255 gateway
網路 network subnetMask
Default gateway 0.0.0.0
route add 172.16.200.1 mask 255.255.255.255 10.0.1.200 (新增主機路由)
route print
ping 172.16.200.1 --> OK
route delete 172.16.200.1 mask 255.255.255.255 (刪除主機路由)
route print
ping 172.16.200.1 --> timeout
route add 172.16.200.0 mask 255.255.255.0 10.0.1.200 (新增網路路由)
route print
ping 172.16.200.1 --> OK
如果於route 指令後面加上 -p (persistent route) 就可以永遠生效, 沒有加上 -p 為暫時性的生效
Module 3 configuring a client IP address
IP addresses can be:
1.Static 靜態IP
2.Dynamic 動態IP
練習static ip 設定 並使用ipconfig來檢視
使用DHCP設定 IP
Discover
------------------->
Offer
<------------------- ------
Host A Request | |
DHCP --------------------> | | scope
client Ack ------
<-------------------- DHCP Server
View DHCP Assigned Setting on the client
使用ipconfig /all查看
DHCP Enabled yes --> Dhcp client
DHCP Server ip --> Dhcp server ip
Node type --> Dhcp type
Lease Obtained -->何時租用
Lease Expires -->租約到期
Renewing an IP Address
lease time
|----------------|----------------|---------|
1∕ 2 7/8
renew rebind
(use unicast) (use broadcast)
(T1) (T2)
|---------------------------------------------| (成功就將租約延長)
To release and renew an IP address
ipconfig /release
ipconfig /renew
APIPA(Automatic Private IP Addressing)
Windows 98 之後支援APIPA
range from 169.254.0.1 through 169.254.255.254
Lab: APIPA 練習 and Alternate configuration
前置動作:關閉DHCP server
ipconfig /release
ipconfig /renew
取得DHCP client Ip失敗 --> 使用APIPA
ipconfig /all
使用Alternate configuration
1.start --> control panel --> network connections --> localarea connection
2.properties --> TCP/IP --> properties --> Alternate Configuration --> User configured --> ok --> close
ipconfig /all
Disable APIPA on the entire computer (停用APIPA)
1.start --> run --> regedit --> ok
2.HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
3.Edit --> New --> DWORDValue
4.Type “IPAutoconfigurationEnabled” --> Enter
5.Reboot
Module 4: Configuring a client for Name Resolution
NetBIOS(Network Basic Input/Output System)
DNS(Domain Name System)
DNS (computer name) Wins
DNS Host name Application NetBIOS Name
Hosts 255個字 15個字 lmhosts
Socket NetBIOS
Transport
TCP UDP
Internet
使用arp -a 看arp cache
arp cache dynamic 2 mins ~ 10 mins
arp cache static (使用arp -s 設定)
example:
arp -s 10.0.1.201 33-33-33-33-33-33
IP MAC
arp -d 10.0.1.201 (刪除 arp cache)
arp -g -N 10.0.1.200 (觀察10.0.1.200網卡上的arp cache)
arp -g 10.0.1.254 (只查看10.0.1.254)
ping 10.0.1.254
arp -a
Lab: 修改computer name ( 修改為Serverxx)
start --> My computer --> right click --> Properties --> computer name --> change -->type “Server6” --> ok --> ok
reboot
NetBIOS Name
第16 byte name
Suffix(Hex) First 15 Characters Networking Service
00 Computer name Workstation service用戶端
00 Domain name Domain Name
03 Computer name Messenger service 信差服務
20 Computer name File Server Service
1C Domain name Domain controllers
1B Domain name Domain master browser
使用nbtstat -n 查看
NetBT(NetBIOS over TCP/IP)
Run on top of the TCP/IP network protocol
Supports discovery, registration and release of NetBIOS names
Uses broadcast of a NetBIOS name server, depending on node type
NetBT Node type
1 2 4
B-node P-node Mix-nod
NetBIOS cache NetBIOS cache NetBIOS cache
| | |
Broadcast Wins Broadcast
| | |
lmhosts lmhosts Wins
|
lmhosts
8
H-node
NetBIOS cache
|
Wins
|
Broadcast
|
lmhosts
---------------------
|
DNS cache
|
localhost name
|
hosts (2003 會將 hosts 寫入DNS cache)
|
DNS
如果下ipconfig /all
Node type ...............Unknown --> H-node
2003 可以填上12筆wins server
9x 只可以填上2筆wins server
Lab:如何修改node type
1.start --> run --> regedit --> ok
2.HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters
3.Edit --> New --> DWORDValue
4.Type “Nodetype” --> Enter
5.select “nodetype” --> modify --> 填入適當的值 --> ok
6.Restart network
7.ipconfig /all
nbtstat -c 查看NetBIOS 資訊
nbtstat -R 根據lmhosts 來update cache
Lab: 設定lmhosts
lmhosts 檔案存放於 (沒有副檔名,其目錄下的lmhosts.sam為sample)
系統安裝目錄\System32\drivers\etc
於該目錄下新增一檔案lmhosts (沒有副檔名)
10.0.1.200 london #PRE
ip NetBIOSname 一定要大寫...設為#PRE會放入cache永遠生效
nbtstat -R
nbtstat -c
ping 旁邊的同學ip
nbtstat -c (cache 為10mins)
What is WINS?
-------
| |
| |WINS server
-------
|
----------------------------------------------------------------
|
A
WINS client
開機會註冊名稱關機會release名稱
2003 可以填上12筆wins server
9x & nt 只可以填上2筆wins server
DNS search
DNS cache (windows 2000之後有DNS cache)
|
localhost name
|
hosts (2003 會將 hosts 寫入DNS cache)
|
DNS
----------------------------------------
NetBIOS cache
| ------
Wins |
| |
Broadcast | H-node
| |
lmhosts ------
Using a Hosts File
hosts 存放於
Microsoft Windows NT, 2000,and XP :
系統安裝目錄\System32\drivers\etc\hosts
Microsoft Windows 95 or Windows 98:
系統安裝目錄\hosts
Lab: 編輯hosts
修改系統安裝目錄\System32\drivers\etc\hosts
加入
10.0.1.200 router
ping router --> 成功
ipconfig /displaydns --> 顯示 DNS cache
ipconfig /flushdns --> 清除 DNS cache
http://www.icann.org/registries/listing.html (DNS Top-level domain註冊類別)
The DNS Suffix
www.pchome.com.tw
<----><------------------->
Host DNS Suffix
<---------------------------->
FQDN
nslookup
Lab:
nslookup www.microsoft.com
nslookup
server 168.95.1.1
>www.microsoft.com
hostname
netstat
netstat -a -o (-o process id)
ping 127.0.0.1
ping 自己的ip
ping gateway
ping 168.95.1.1
ping FQDN
ping -i 3 168.95.1.1 ( -i 3 #TTL 為3)
tracert -d 168.95.1.1 ( -d 不做名稱解析)
pathping 168.95.1.1
星期日, 8月 28, 2005
星期六, 8月 13, 2005
LINUX SERVER HACKS 心得
歐萊禮LINUX SERVER HACKS 讀書小雜記
Chapter 1 伺服器基礎
Hack #10
#export TMOUT=600
當bash 閒置600秒也就是十分鐘就將閒置的使用者踢出去
Hack #15
#alias ducks='du -cks * |sort -rn|head -11'
找出目前目錄下前十名磁碟使用量的檔案
Hack #16
/proc 的樂趣
#cd /proc
#cat version
顯示目前啟動的核心
#ls -hl kcore
觀察所安裝的RAM
#cat partitions
觀察開機期間找到的硬碟分割區與裝置
#cd 1
#ls -hl
觀察個別行程的結構
其中cwd 指向該行程目潛得工作目錄
exe 指向啟動該行程的binary
root 指向該行程的根目錄
cmdline 與 environ 分別記載啟動該行程的完整命令列及完整環境.不過這兩個檔案個別項目都是以NULL字元 ('\0') 相隔的.所以必須先用tr將檔案內容的輸出格式加以美化.才適合閱讀.
#cat environ | tr '\0' '\n'
Chapter 1 伺服器基礎
Hack #10
#export TMOUT=600
當bash 閒置600秒也就是十分鐘就將閒置的使用者踢出去
Hack #15
#alias ducks='du -cks * |sort -rn|head -11'
找出目前目錄下前十名磁碟使用量的檔案
Hack #16
/proc 的樂趣
#cd /proc
#cat version
顯示目前啟動的核心
#ls -hl kcore
觀察所安裝的RAM
#cat partitions
觀察開機期間找到的硬碟分割區與裝置
#cd 1
#ls -hl
觀察個別行程的結構
其中cwd 指向該行程目潛得工作目錄
exe 指向啟動該行程的binary
root 指向該行程的根目錄
cmdline 與 environ 分別記載啟動該行程的完整命令列及完整環境.不過這兩個檔案個別項目都是以NULL字元 ('\0') 相隔的.所以必須先用tr將檔案內容的輸出格式加以美化.才適合閱讀.
#cat environ | tr '\0' '\n'
星期六, 7月 30, 2005
轉貼 使用 yum 升級你的系統 (redhat9 升級到 CentOS 3.3) from SA
原文出處
http://phorum.study-area.org/viewtopic.php?t=28648
找個時間來Lab一下
由於 RedHat 9 已經沒有更新了, Fedora 雖然有個遺產計畫在更新, 但是好像沒什麼動靜, 上頭的異動速度又不快. 所以機房內的幾台安裝 RedHat 9 的主機, 也很久沒有更新了.
所以想利用今天開始的過年假期, 把這幾台機器升級到別的版本上頭.
我們選擇的是使用 CentOS 3, 因為這是一套與 RHEL 3 相容的版本, 而 RHEL 3 是基於 RedHat 9 發展的. 這樣子我們升級的異動會比較少一點.
升級主要參考 http://www.owlriver.com/tips/centos-31-ex-rhl-9/ 這一篇文章.
1. 到 http://linux.duke.edu/projects/yum/download.ptml 抓 yum 2.0.7 回來安裝.
2. 把 CentOS 3.3 的光碟中的 RPMS 目錄複製到主機中. 如 /centos/os/RPMS 下頭. 共有三片光碟.
3. 如果可能, 也把 CentOS 網站上頭的 updates 下頭的 rpm 也抓一份回來, 放到 /centos/updates/RPMS 下頭.
4. 建立兩個目錄 /centos/os/headers 與 /centos/updates/headers, 然後在 /centos/os 與 /centos/updates 下頭執行這個指令:
代碼:
cd /centos/os
yum-arch .
cd /centos/updates
yum-arch .
以便於建立 yum 的資料庫.
5. 匯入 CentOS 的 PGP Key.
代碼:
rpm --import http://mirror.caosity.org/centos-3/RPM-GPG-KEY-CentOS-3
上頭那個檔案在光碟內也有, 也可以直接匯入光碟內的 key.
6. 使用 rpm -e 指令, 移除非必要的 -devel 套件. (非必要)
7. 建立 /etc/yum-upgrade.conf 如下:
代碼:
#
[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
installonlypkgs=kernel kernel-smp kernel-hugemem kernel-enterprise kernel-debug kernel-unsupported kernel-smp-unsupported kernel-hugemem-unsupported
tolerant=1
exactarch=1
[upgrade]
name=Centos upgrade
baseurl=file://localhost/centos/os/
[update]
name=CentOS-$releasever - Updates
baseurl=file://localhost/centos/updates/
如果沒有事先抓下這些 rpm, 也可以設成
代碼:
#
[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
installonlypkgs=kernel kernel-smp kernel-hugemem kernel-enterprise kernel-debug kernel-unsupported kernel-smp-unsupported kernel-hugemem-unsupported
tolerant=1
exactarch=1
[upgrade]
name=Centos upgrade
baseurl=http://mirror.centos.org/centos/3.3/os/$basearch/
[update]
name=CentOS-$releasever - Updates
baseurl=http://mirror.centos.org/centos/3.3/updates/$basearch/
這樣子 yum 會在更新時上網抓檔案. 因為我們要更新好幾台, 所以先抓回來, 以免每次更新都再抓一次.
update 的部份也可以不設, 等升級到 CentOS 3.3 後, 再使用 yum update 去更新也可以.
8. 先更新 kernel 與 rpm.
代碼:
rpm -vv --rebuilddb
yum -y -t -c /etc/yum-upgrade.conf upgrade rpm kernel
rpm -vv --rebuilddb
yum -y -t -c /etc/yum-upgrade.conf upgrade rpm kernel
原本的文件說這兒要重開機, 不過似乎不用, 可以直接往下做.
9. 再更新整個系統
代碼:
yum -y -t -c /etc/yum-upgrade.conf upgrade
等 yum 跑完後, 你的 RedHat 9 就變成 CentOS 3.3 了, 再重開機使用新的 kernel.
如果檔案都抓回來, 在 local 的主機或網路上頭時, 整個更新的動作應該可以在 30 分到 1 小時之內完成.
我們的主機上頭有 mysql, postgresql, httpd, php, openldap-server, 整個更新完成後, 系統運作都很正常.
更新後, 跑了一天, 目前看起來只有一個問題, 就是有些機器在 su 到 root 的時候, 會發生 segment fault 的錯誤 (裝的東西都類似, 但有些機器會, 有些不會).
如果你有發生類似的情形, 可以在使用 su 指令前, 先 export LD_ASSUME_KERNEL=2.4.4 再執行, 就不會有問題了.
如果 2.4.4 不行.... 自己換個版本再試試.
同樣的升級方式, 應該適用於同樣是使用 rpm 格式的 linux 版本. 也就是不管是 redhat 8 -> 9, 9 -> fc1 .... 都應該可以適用.
這個星期週末, 順便把公司內的主機由 CentOS 3.4 換到 4.0 上頭了. 也是使用 yum 來處理.
之前在 CentOS 4 剛出來時, 找了一台機器試過, 會有些衝突 (kernel 與 udev), 前幾天在 CentOS 的討論區看到似乎有人成功轉換. 所以... 也跟著試看看.
結果... 發現... 那篇文章似乎有點問題, 連 yum 都先升級... 結果 yum 就不能用了...
我參考該說明, 修正一下, 步驟約如下 (x86-64 檔名有些不同):
1. rpm --import RPM-GPG-KEY-centos4
2. rpm -Uvh --force centos-release-4-0.1.i386.rpm
3. rpm -Uvh --force centos-yumconf-4-2.noarch.rpm
4. 安裝新的 kernel
rpm -ivh --force --nodeps kernel-2.6.9-5.0.3.EL.i686.rpm
5. 安裝 udev
rpm -ivh --force --nodeps udev-039-10.8.EL4.i386.rpm
6. rpm --rebuilddb
7. 設定好 yum-upgrade.conf, 然後執行
yum -c /etc/yum-upgrade.conf upgrade
8. 如果沒問題, 再安裝一次 kernel
rpm -ivh --force --nodeps kernel-2.6.9-5.0.3.EL.i686.rpm
9. rpm --rebuilddb
10. yum update 看看有沒有其他的要更新.
11. 更改 /boot/grub/menu.lst 指定用新的 kernel 開機
12. 重開機看看. (可能會移除一些舊的 driver, 加上一些新的 driver)
大致上是這樣處理.
其中可能有問題的是在 upgrade 那一個步驟, 可能會說有那些軟體是有衝突的. 就想辦法一個個先安裝或先移除, 等升級後再安裝.
我們碰到的有:
MySQL, 這個由 3.x 升到 4.1.x. 如果有裝 mysql-server, 會有問題.
我們的處理方式是先強迫安裝
rpm -Uvh --force --nodeps mysql-4.1.7-4.RHEL4.1.i386.rpm mysql-server-4.1.7-4.RHEL4.1.i386.rpm mysqlclient10-3.23.58-4.RHEL4.1.i386.rpm
然後在 yum-upgrade.conf 的 [main] 中加上
exclude=mysql-server mysql
後就可以避開這個問題. 至於原本的 mysql 資料庫, 原則上檔案可以相容, 並不用 dump 出來再 restore. 不過.... 如果你怕有問題... 就自己 dump 吧.
PostgreSQL, 這個由 7.3.x 升到 7.4.x 似乎不能直接使用原本的檔案. 所以我們只好先用 pg_dumpall 把資料複製下來, 等升級後再放回去. 因為要做這個動作, 所以就順便到 postgresql 網站抓了 8.0.1 的版本回來, 直接升到 8.0.1 上頭去.
在 upgrade 先備份
pg_dumpall > dbxxx.out
備份後執行 upgrade, 等 upgrade 後
移除 postgresql
rpm -e postgresql-libs postgresql perl-DBD-Pg php-pgsql
安裝 8.0.1 版本
rpm -ivh postgresql-8.0.1-2PGDG.i686.rpm postgresql-server-8.0.1-2PGDG.i686.rpm postgresql-libs-8.0.1-2PGDG.i686.rpm postgresql-contrib-8.0.1-2PGDG.i686.rpm postgresql-pl-8.0.1-2PGDG.i686.rpm postgresql-python-8.0.1-2PGDG.i686.rpm
把資料庫放回去
psql -f dbxxx.out template1
postfix, 在 upgrade 過程不會有問題, 但是 upgrade 後, aliases, aliases.db 會被改名, 要改回來才能啟動.
subversion, 先強迫升級
rpm -Uvh --force --nodeps subversion-1.1.1-2.1.i386.rpm subversion-perl-1.1.1-2.1.i386.rpm subversion-devel-1.1.1-2.1.i386.rpm
openldap, 升到 2.2.x 版, 由於新版的設定比較嚴格, 原本的 schema 可能要修改才會符合. 且 ACL 的語法不太一樣, 也要重設.
除此之外, 並沒有發現有其它的問題.
http://phorum.study-area.org/viewtopic.php?t=28648
找個時間來Lab一下
由於 RedHat 9 已經沒有更新了, Fedora 雖然有個遺產計畫在更新, 但是好像沒什麼動靜, 上頭的異動速度又不快. 所以機房內的幾台安裝 RedHat 9 的主機, 也很久沒有更新了.
所以想利用今天開始的過年假期, 把這幾台機器升級到別的版本上頭.
我們選擇的是使用 CentOS 3, 因為這是一套與 RHEL 3 相容的版本, 而 RHEL 3 是基於 RedHat 9 發展的. 這樣子我們升級的異動會比較少一點.
升級主要參考 http://www.owlriver.com/tips/centos-31-ex-rhl-9/ 這一篇文章.
1. 到 http://linux.duke.edu/projects/yum/download.ptml 抓 yum 2.0.7 回來安裝.
2. 把 CentOS 3.3 的光碟中的 RPMS 目錄複製到主機中. 如 /centos/os/RPMS 下頭. 共有三片光碟.
3. 如果可能, 也把 CentOS 網站上頭的 updates 下頭的 rpm 也抓一份回來, 放到 /centos/updates/RPMS 下頭.
4. 建立兩個目錄 /centos/os/headers 與 /centos/updates/headers, 然後在 /centos/os 與 /centos/updates 下頭執行這個指令:
代碼:
cd /centos/os
yum-arch .
cd /centos/updates
yum-arch .
以便於建立 yum 的資料庫.
5. 匯入 CentOS 的 PGP Key.
代碼:
rpm --import http://mirror.caosity.org/centos-3/RPM-GPG-KEY-CentOS-3
上頭那個檔案在光碟內也有, 也可以直接匯入光碟內的 key.
6. 使用 rpm -e 指令, 移除非必要的 -devel 套件. (非必要)
7. 建立 /etc/yum-upgrade.conf 如下:
代碼:
#
[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
installonlypkgs=kernel kernel-smp kernel-hugemem kernel-enterprise kernel-debug kernel-unsupported kernel-smp-unsupported kernel-hugemem-unsupported
tolerant=1
exactarch=1
[upgrade]
name=Centos upgrade
baseurl=file://localhost/centos/os/
[update]
name=CentOS-$releasever - Updates
baseurl=file://localhost/centos/updates/
如果沒有事先抓下這些 rpm, 也可以設成
代碼:
#
[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
installonlypkgs=kernel kernel-smp kernel-hugemem kernel-enterprise kernel-debug kernel-unsupported kernel-smp-unsupported kernel-hugemem-unsupported
tolerant=1
exactarch=1
[upgrade]
name=Centos upgrade
baseurl=http://mirror.centos.org/centos/3.3/os/$basearch/
[update]
name=CentOS-$releasever - Updates
baseurl=http://mirror.centos.org/centos/3.3/updates/$basearch/
這樣子 yum 會在更新時上網抓檔案. 因為我們要更新好幾台, 所以先抓回來, 以免每次更新都再抓一次.
update 的部份也可以不設, 等升級到 CentOS 3.3 後, 再使用 yum update 去更新也可以.
8. 先更新 kernel 與 rpm.
代碼:
rpm -vv --rebuilddb
yum -y -t -c /etc/yum-upgrade.conf upgrade rpm kernel
rpm -vv --rebuilddb
yum -y -t -c /etc/yum-upgrade.conf upgrade rpm kernel
原本的文件說這兒要重開機, 不過似乎不用, 可以直接往下做.
9. 再更新整個系統
代碼:
yum -y -t -c /etc/yum-upgrade.conf upgrade
等 yum 跑完後, 你的 RedHat 9 就變成 CentOS 3.3 了, 再重開機使用新的 kernel.
如果檔案都抓回來, 在 local 的主機或網路上頭時, 整個更新的動作應該可以在 30 分到 1 小時之內完成.
我們的主機上頭有 mysql, postgresql, httpd, php, openldap-server, 整個更新完成後, 系統運作都很正常.
更新後, 跑了一天, 目前看起來只有一個問題, 就是有些機器在 su 到 root 的時候, 會發生 segment fault 的錯誤 (裝的東西都類似, 但有些機器會, 有些不會).
如果你有發生類似的情形, 可以在使用 su 指令前, 先 export LD_ASSUME_KERNEL=2.4.4 再執行, 就不會有問題了.
如果 2.4.4 不行.... 自己換個版本再試試.
同樣的升級方式, 應該適用於同樣是使用 rpm 格式的 linux 版本. 也就是不管是 redhat 8 -> 9, 9 -> fc1 .... 都應該可以適用.
這個星期週末, 順便把公司內的主機由 CentOS 3.4 換到 4.0 上頭了. 也是使用 yum 來處理.
之前在 CentOS 4 剛出來時, 找了一台機器試過, 會有些衝突 (kernel 與 udev), 前幾天在 CentOS 的討論區看到似乎有人成功轉換. 所以... 也跟著試看看.
結果... 發現... 那篇文章似乎有點問題, 連 yum 都先升級... 結果 yum 就不能用了...
我參考該說明, 修正一下, 步驟約如下 (x86-64 檔名有些不同):
1. rpm --import RPM-GPG-KEY-centos4
2. rpm -Uvh --force centos-release-4-0.1.i386.rpm
3. rpm -Uvh --force centos-yumconf-4-2.noarch.rpm
4. 安裝新的 kernel
rpm -ivh --force --nodeps kernel-2.6.9-5.0.3.EL.i686.rpm
5. 安裝 udev
rpm -ivh --force --nodeps udev-039-10.8.EL4.i386.rpm
6. rpm --rebuilddb
7. 設定好 yum-upgrade.conf, 然後執行
yum -c /etc/yum-upgrade.conf upgrade
8. 如果沒問題, 再安裝一次 kernel
rpm -ivh --force --nodeps kernel-2.6.9-5.0.3.EL.i686.rpm
9. rpm --rebuilddb
10. yum update 看看有沒有其他的要更新.
11. 更改 /boot/grub/menu.lst 指定用新的 kernel 開機
12. 重開機看看. (可能會移除一些舊的 driver, 加上一些新的 driver)
大致上是這樣處理.
其中可能有問題的是在 upgrade 那一個步驟, 可能會說有那些軟體是有衝突的. 就想辦法一個個先安裝或先移除, 等升級後再安裝.
我們碰到的有:
MySQL, 這個由 3.x 升到 4.1.x. 如果有裝 mysql-server, 會有問題.
我們的處理方式是先強迫安裝
rpm -Uvh --force --nodeps mysql-4.1.7-4.RHEL4.1.i386.rpm mysql-server-4.1.7-4.RHEL4.1.i386.rpm mysqlclient10-3.23.58-4.RHEL4.1.i386.rpm
然後在 yum-upgrade.conf 的 [main] 中加上
exclude=mysql-server mysql
後就可以避開這個問題. 至於原本的 mysql 資料庫, 原則上檔案可以相容, 並不用 dump 出來再 restore. 不過.... 如果你怕有問題... 就自己 dump 吧.
PostgreSQL, 這個由 7.3.x 升到 7.4.x 似乎不能直接使用原本的檔案. 所以我們只好先用 pg_dumpall 把資料複製下來, 等升級後再放回去. 因為要做這個動作, 所以就順便到 postgresql 網站抓了 8.0.1 的版本回來, 直接升到 8.0.1 上頭去.
在 upgrade 先備份
pg_dumpall > dbxxx.out
備份後執行 upgrade, 等 upgrade 後
移除 postgresql
rpm -e postgresql-libs postgresql perl-DBD-Pg php-pgsql
安裝 8.0.1 版本
rpm -ivh postgresql-8.0.1-2PGDG.i686.rpm postgresql-server-8.0.1-2PGDG.i686.rpm postgresql-libs-8.0.1-2PGDG.i686.rpm postgresql-contrib-8.0.1-2PGDG.i686.rpm postgresql-pl-8.0.1-2PGDG.i686.rpm postgresql-python-8.0.1-2PGDG.i686.rpm
把資料庫放回去
psql -f dbxxx.out template1
postfix, 在 upgrade 過程不會有問題, 但是 upgrade 後, aliases, aliases.db 會被改名, 要改回來才能啟動.
subversion, 先強迫升級
rpm -Uvh --force --nodeps subversion-1.1.1-2.1.i386.rpm subversion-perl-1.1.1-2.1.i386.rpm subversion-devel-1.1.1-2.1.i386.rpm
openldap, 升到 2.2.x 版, 由於新版的設定比較嚴格, 原本的 schema 可能要修改才會符合. 且 ACL 的語法不太一樣, 也要重設.
除此之外, 並沒有發現有其它的問題.
星期三, 7月 13, 2005
C's note
soft: Dev C++
凡介於/* */ 之間的文字會視為註解 //為開頭的也是註解
所有的C語言程式都是以main為開頭….Tourbo C會執行
左大括號{
和右大括號 }
之間的指令
舉個例子以下為hello.c的內容
/* 使用 #include file 將某個檔案包含在目前程式內*/
#include
#include
/*以下為程式的開始 */
main()
{
/* 請注意要以分號(;) 為結束一個指令字元 */
/*使用printf 列出字串 如果要換行使用 \n */
/*使用backslash 取消控制字元的使用 例如使用\" 來顯示雙引號 用\\ 來顯示\ */
printf("\"Hello world with double quote test \"\n ");
printf("Hello world\n");
printf("C:\\C\\Hello.c\n");
/* 使用system指令去執行 命令提示字元的指令pause ->可以暫停 */
system("pause");
/* 變數的使用是有限制的---使用大寫或是小寫字母或是底線(_) 為開頭*/
/* 變數的名稱則可為 1.大寫字母 2.小寫字母 3.底線 4.阿拉伯數字 */
/* 變數的宣告皆以分號(;) 作為結束 */
/* 如果變數於程式的起始位置就宣告了那則為整體(global)變數,對程式的任何部分中使用 */
/* 如果變數在函數程式內宣告.....則為區域變數(local variable) 只在宣告的函數中使用 */
/* 如果變數在函數參數位置宣告----則為用來接收呼叫程式所傳遞的值 */
int i;
// i的值為當時記憶體目前殘留的資料
printf("i=%d\n",i);
// 重新定義 i=0 所以列印出來會是零
i=0;
printf("i=%d\n",i);
// sizeof( ) 計算資料所佔的記憶體空間
printf("sizeof(i)=%d , sizeof(int)=%d\n",sizeof(i),sizeof(int));
// short int 值的範圍 -32768 ~ 32767 , 給超過範圍的值會變成其他的值
short si;
si=32767;
printf("si=%d\n",si);
si=32768;
printf("si=%d\n",si);
si=32769;
printf("si=%d\n",si);
si=32770;
printf("si=%d\n",si);
si=-32768;
printf("si=%d\n",si);
si=-32769;
printf("si=%d\n",si);
si=-32770;
printf("si=%d\n",si);
}
凡介於/* */ 之間的文字會視為註解 //為開頭的也是註解
所有的C語言程式都是以main為開頭….Tourbo C會執行
左大括號{
和右大括號 }
之間的指令
舉個例子以下為hello.c的內容
/* 使用 #include file 將某個檔案包含在目前程式內*/
#include
#include
/*以下為程式的開始 */
main()
{
/* 請注意要以分號(;) 為結束一個指令字元 */
/*使用printf 列出字串 如果要換行使用 \n */
/*使用backslash 取消控制字元的使用 例如使用\" 來顯示雙引號 用\\ 來顯示\ */
printf("\"Hello world with double quote test \"\n ");
printf("Hello world\n");
printf("C:\\C\\Hello.c\n");
/* 使用system指令去執行 命令提示字元的指令pause ->可以暫停 */
system("pause");
/* 變數的使用是有限制的---使用大寫或是小寫字母或是底線(_) 為開頭*/
/* 變數的名稱則可為 1.大寫字母 2.小寫字母 3.底線 4.阿拉伯數字 */
/* 變數的宣告皆以分號(;) 作為結束 */
/* 如果變數於程式的起始位置就宣告了那則為整體(global)變數,對程式的任何部分中使用 */
/* 如果變數在函數程式內宣告.....則為區域變數(local variable) 只在宣告的函數中使用 */
/* 如果變數在函數參數位置宣告----則為用來接收呼叫程式所傳遞的值 */
int i;
// i的值為當時記憶體目前殘留的資料
printf("i=%d\n",i);
// 重新定義 i=0 所以列印出來會是零
i=0;
printf("i=%d\n",i);
// sizeof( ) 計算資料所佔的記憶體空間
printf("sizeof(i)=%d , sizeof(int)=%d\n",sizeof(i),sizeof(int));
// short int 值的範圍 -32768 ~ 32767 , 給超過範圍的值會變成其他的值
short si;
si=32767;
printf("si=%d\n",si);
si=32768;
printf("si=%d\n",si);
si=32769;
printf("si=%d\n",si);
si=32770;
printf("si=%d\n",si);
si=-32768;
printf("si=%d\n",si);
si=-32769;
printf("si=%d\n",si);
si=-32770;
printf("si=%d\n",si);
}
星期五, 7月 01, 2005
研討會結束 對postfix 的初體驗
實驗平台 Fedora core 3
Package: postfix-2.1.5-5
檢查是否有安裝rpm
#rpm -qa grep postfix
備份設定檔
#cp /etc/postfix/main.cf /etc/postfix/main.cf.bak
修改postfix的設定檔
#vi /etc/postfix/main.cf
將原來只在localhost listen 標記起來並對所有界面服務
#inet_interfaces = localhost
inet_interfaces = all
設定信任的內網
mynetworks = 192.168.0.0/24, 127.0.0.0/8
#service postfix restart
#netstat -tupln grep :25
此時postfix就在 port 25 listen
可以使用下列指令觀看postfix設定
#postconf
以下指令為觀看預設值
#postconf -d
Client傳送信件給Server的程序為
HELO / EHLO 網域名稱
MAIL FROM: 寄件者e-mail
RCPT TO: 收件者e-mail
DATA 信件內容然後以 . 為結束
QUIT 寄信完離開
針對 Client進行設限.....
請注意參數的部分由於要接續前面設定
....故要用以空白為首來開始撰寫代表續接
#vi /etc/postfix/main.cf
#針對client的ip/domain設限
smtpd_client_restrictions =
#允許內網不必檢查
permit_mynetworks,
#反解失敗就拒絕
reject_unknown_client,
#根據access清單拒絕client
#請先建立/etc/postfix/access檔案
#內容為 dynamic.hinet.net REJECT
#拒絕動態ip的client
#使用 #postmap hash:/etc/postfix/access 來建立DB
check_client_access hash:/etc/postfix/access,
#使用正規表示式拒絕名稱中有dynamic的主機連線
# 請先建立 /etc/postfix/access_re
#內容為 /dynamic/ REJECT
check_client_access regexp:/etc/postfix/access_re
reject_rbl_client cbl.abuseat.org,
#使用DNS Block List 黑名單機制
#如果 #host 57.41.61.66.cbl.abuseat.org --> 會出現 127.0.0.2
#代表 66.61.41.57 (host的時候要倒過來寫)這個 ip是廣告信server黑名單中的ip
#如果是正常的ip那會出現not found
#故利用此機制block spam mail server
reject_rbl_client sbl.spamhaus.org,
reject_rbl_client relays.ordb.org,
reject_rbl_client list.dsbl.org,
permit
#要求寄信前要提出helo的要求-------預設為no
smtpd_helo_required = yes
smtpd_helo_restrictions =
permit_mynetworks,
#拒絕不正確/未知的helo domain
reject_invalid_hostname,
reject_non_fqdn_hostname,
reject_unknown_hostname,
#拒絕外界但是宣稱是自己domain的helo
#請先建立 /etc/postfix/fake_helo
#內容 example.com REJECT
#利用#postmap hash:/etc/postfix/fake_helo 建立DB
check_helo_access hash:/etc/postfix/fake_helo
permit
#馬上拒絕不delay
smtpd_delay_reject = no
#根據Mail from來限制
smtpd_sender_restrictions =
permit_mynetworks,
#拒收來自於外界卻宣稱發自內部的信件
#建立 /etc/postfix/fake_from
#內容 example.com REJECT --> example.com 為自己公司的domain
#使用 #postmap hash:/etc/postfix/fake_from
check_sender_access hash:/etc/postfix/fake_from,
#拒絕不正確和未知的domain
reject_non_fqdn_sender,
reject_unknown_sender_domain,
permit
#只允許內網Relay
smtpd_recipient_restrictions =
permit_mynetworks,
reject_unauth_destination
#service postfix reload
Enjoy it ^^
P.S: 在Redhat 9.0中的postfix為postfix-1.1.12-1 有些許功能不支援
Package: postfix-2.1.5-5
檢查是否有安裝rpm
#rpm -qa grep postfix
備份設定檔
#cp /etc/postfix/main.cf /etc/postfix/main.cf.bak
修改postfix的設定檔
#vi /etc/postfix/main.cf
將原來只在localhost listen 標記起來並對所有界面服務
#inet_interfaces = localhost
inet_interfaces = all
設定信任的內網
mynetworks = 192.168.0.0/24, 127.0.0.0/8
#service postfix restart
#netstat -tupln grep :25
此時postfix就在 port 25 listen
可以使用下列指令觀看postfix設定
#postconf
以下指令為觀看預設值
#postconf -d
Client傳送信件給Server的程序為
HELO / EHLO 網域名稱
MAIL FROM: 寄件者e-mail
RCPT TO: 收件者e-mail
DATA 信件內容然後以 . 為結束
QUIT 寄信完離開
針對 Client進行設限.....
請注意參數的部分由於要接續前面設定
....故要用以空白為首來開始撰寫代表續接
#vi /etc/postfix/main.cf
#針對client的ip/domain設限
smtpd_client_restrictions =
#允許內網不必檢查
permit_mynetworks,
#反解失敗就拒絕
reject_unknown_client,
#根據access清單拒絕client
#請先建立/etc/postfix/access檔案
#內容為 dynamic.hinet.net REJECT
#拒絕動態ip的client
#使用 #postmap hash:/etc/postfix/access 來建立DB
check_client_access hash:/etc/postfix/access,
#使用正規表示式拒絕名稱中有dynamic的主機連線
# 請先建立 /etc/postfix/access_re
#內容為 /dynamic/ REJECT
check_client_access regexp:/etc/postfix/access_re
reject_rbl_client cbl.abuseat.org,
#使用DNS Block List 黑名單機制
#如果 #host 57.41.61.66.cbl.abuseat.org --> 會出現 127.0.0.2
#代表 66.61.41.57 (host的時候要倒過來寫)這個 ip是廣告信server黑名單中的ip
#如果是正常的ip那會出現not found
#故利用此機制block spam mail server
reject_rbl_client sbl.spamhaus.org,
reject_rbl_client relays.ordb.org,
reject_rbl_client list.dsbl.org,
permit
#要求寄信前要提出helo的要求-------預設為no
smtpd_helo_required = yes
smtpd_helo_restrictions =
permit_mynetworks,
#拒絕不正確/未知的helo domain
reject_invalid_hostname,
reject_non_fqdn_hostname,
reject_unknown_hostname,
#拒絕外界但是宣稱是自己domain的helo
#請先建立 /etc/postfix/fake_helo
#內容 example.com REJECT
#利用#postmap hash:/etc/postfix/fake_helo 建立DB
check_helo_access hash:/etc/postfix/fake_helo
permit
#馬上拒絕不delay
smtpd_delay_reject = no
#根據Mail from來限制
smtpd_sender_restrictions =
permit_mynetworks,
#拒收來自於外界卻宣稱發自內部的信件
#建立 /etc/postfix/fake_from
#內容 example.com REJECT --> example.com 為自己公司的domain
#使用 #postmap hash:/etc/postfix/fake_from
check_sender_access hash:/etc/postfix/fake_from,
#拒絕不正確和未知的domain
reject_non_fqdn_sender,
reject_unknown_sender_domain,
permit
#只允許內網Relay
smtpd_recipient_restrictions =
permit_mynetworks,
reject_unauth_destination
#service postfix reload
Enjoy it ^^
P.S: 在Redhat 9.0中的postfix為postfix-1.1.12-1 有些許功能不支援
星期二, 6月 28, 2005
Fedora Legacy Project
有鑑於Fedora已經出到 core 4
但是還是有些主機使用就版本的RedHat 9.0 or older
觀看網路上有些apt都開始慢慢沒有維護9.0
故上台南教網中心還有Fedora Legacy Project的官網去
download 套件希望讓使用RedHat9.0的user可以繼續升級套件
台南教網中心
http://sys.tnc.edu.tw/up.php
Fedora Legacy Project
http://fedoralegacy.org/#main
目前使用yum更新RedHat 9.0中^^
但是還是有些主機使用就版本的RedHat 9.0 or older
觀看網路上有些apt都開始慢慢沒有維護9.0
故上台南教網中心還有Fedora Legacy Project的官網去
download 套件希望讓使用RedHat9.0的user可以繼續升級套件
台南教網中心
http://sys.tnc.edu.tw/up.php
Fedora Legacy Project
http://fedoralegacy.org/#main
目前使用yum更新RedHat 9.0中^^
星期日, 6月 12, 2005
好用的tar ball 管理軟體checkinstall
當安裝source code如tall balls 的軟體時
好處是彈性很大缺點是管理不易
故使用一個小軟體check install來管理tall balls的軟體
他會把tall ball 包裝成rpm or slackwave or debin package
並安裝.使用上粉方便
官方網站
http://asic-linux.com.mx/~izto/checkinstall/
使用方法
當./configure
make之後
下checkinsatll他就會幫我們make install
並詢問要包裝成何種package
相當的方便喔
好處是彈性很大缺點是管理不易
故使用一個小軟體check install來管理tall balls的軟體
他會把tall ball 包裝成rpm or slackwave or debin package
並安裝.使用上粉方便
官方網站
http://asic-linux.com.mx/~izto/checkinstall/
使用方法
當./configure
make之後
下checkinsatll他就會幫我們make install
並詢問要包裝成何種package
相當的方便喔
星期四, 6月 09, 2005
awk and quota
於課堂上有討論到quota policy的問題
就寫了一個shell script來套用
[root@nb ~]# cat quota.sh
#!/bin/bash
awk -F: '$3 > 499' /etc/passwd|cut -d: -f1 > /tmp/test
echo "Please Input your quota policy user"
read b
for i in $( cat /tmp/test )
do
echo "set quota for user"
edquota -p $b $i
echo finish
done
就寫了一個shell script來套用
[root@nb ~]# cat quota.sh
#!/bin/bash
awk -F: '$3 > 499' /etc/passwd|cut -d: -f1 > /tmp/test
echo "Please Input your quota policy user"
read b
for i in $( cat /tmp/test )
do
echo "set quota for user"
edquota -p $b $i
echo finish
done
星期五, 6月 03, 2005
VMware on Fedora core 3
VMware on Fedora core 3
安裝環境Fedora core 3 and VMware workstation 5
安裝Guest O/S RedHat 9.0
注意事項
1.網卡的部份使用NAT
2.如果是使用DHCP根據user Guide
#vi /etc/sysconfig/network-scripts/ifcfg-eth 加入
check_link_down () {
return 1;
}
3.Edit -->preference-->Hot Keys 改為Ctrl+Shift+Fn
安裝環境Fedora core 3 and VMware workstation 5
安裝Guest O/S RedHat 9.0
注意事項
1.網卡的部份使用NAT
2.如果是使用DHCP根據user Guide
#vi /etc/sysconfig/network-scripts/ifcfg-eth
check_link_down () {
return 1;
}
3.Edit -->preference-->Hot Keys 改為Ctrl+Shift+Fn
星期四, 5月 26, 2005
安裝Fedora core 3 kernel source
方法kernel-2.6.9為例
1. rpm -ivh kernel-2.6.9-1.667.src.rpm
2. cd /usr/src/redhat/SPEC
3. rpmbuild -bp --target i586 kernel-2.6.spec
4. cd /usr/src/redhat/BUILD/kernel-2.6.9/linux-2.6.9
5. cp configs/kernel-2.6.9-i586.config .config
6. make oldconfig
7. make menuconfig
8. make bzImage
1. rpm -ivh kernel-2.6.9-1.667.src.rpm
2. cd /usr/src/redhat/SPEC
3. rpmbuild -bp --target i586 kernel-2.6.spec
4. cd /usr/src/redhat/BUILD/kernel-2.6.9/linux-2.6.9
5. cp configs/kernel-2.6.9-i586.config .config
6. make oldconfig
7. make menuconfig
8. make bzImage
訂閱:
文章 (Atom)