設定各網卡IP
#cd /etc/sysconfig/network-scripts/
A網段(192.168.4.X)
#vi ifcfg-eth0
BOOTPROTO=static
HWADDR=00:01:03:45:20:A1
DEVICE=eth0
NETMASK=255.255.255.0
BROADCAST=192.168.4.255
IPADDR=192.168.4.254
NETWORK=192.168.4.0
ONBOOT=yes
B網段(伺服器對外IP)
#vi ifcfg-eth1
BOOTPROTO=static
HWADDR=00:07:**:**:**:**
DEVICE=eth1
NETMASK=255.255.255.0
BROADCAST=192.168.1.255
IPADDR=192.168.1.12
NETWORK=192.168.1.0
ONBOOT=yes
C網段(192.168.88.X)
#vi ifcfg-eth2
BOOTPROTO=static
HWADDR=00:01:03:45:20:AB
DEVICE=eth2
NETMASK=255.255.255.0
BROADCAST=192.168.88.255
IPADDR=192.168.88.8
NETWORK=192.168.88.0
ONBOOT=yes
D網段(192.168.5.X)
#vi ifcfg-eth3
BOOTPROTO=static
HWADDR=00:40:C7:7A:69:24
DEVICE=eth3
NETMASK=255.255.255.0
BROADCAST=255.255.255.255
IPADDR=192.168.5.254
NETWORK=192.168.5.0
ONBOOT=yes
啟動網卡
#/etc/rc.d/init.d/network start
A網段(192.168.4.X)
#vi ifcfg-eth0
BOOTPROTO=static
HWADDR=00:01:03:45:20:A1
DEVICE=eth0
NETMASK=255.255.255.0
BROADCAST=192.168.4.255
IPADDR=192.168.4.254
NETWORK=192.168.4.0
ONBOOT=yes
B網段(伺服器對外IP)
#vi ifcfg-eth1
BOOTPROTO=static
HWADDR=00:07:**:**:**:**
DEVICE=eth1
NETMASK=255.255.255.0
BROADCAST=192.168.1.255
IPADDR=192.168.1.12
NETWORK=192.168.1.0
ONBOOT=yes
C網段(192.168.88.X)
#vi ifcfg-eth2
BOOTPROTO=static
HWADDR=00:01:03:45:20:AB
DEVICE=eth2
NETMASK=255.255.255.0
BROADCAST=192.168.88.255
IPADDR=192.168.88.8
NETWORK=192.168.88.0
ONBOOT=yes
D網段(192.168.5.X)
#vi ifcfg-eth3
BOOTPROTO=static
HWADDR=00:40:C7:7A:69:24
DEVICE=eth3
NETMASK=255.255.255.0
BROADCAST=255.255.255.255
IPADDR=192.168.5.254
NETWORK=192.168.5.0
ONBOOT=yes
啟動網卡
#/etc/rc.d/init.d/network start
網路指令備忘錄
ifup eth1 //啟動eth1網卡
ifdown eth1 //停止eth1網卡
重新開機後發現網路無法自動啟動
檢查一下自動啟動服務
#chkconfig --list network //列出網路服務的項目
network 0:off 1:off 2:off 3:off 4:off 5:off 6:off
#chkconfig --levl 3 network on //levl 3 多人使者模式的文字介面
network 0:off 1:off 2:off 3:on 4:off 5:off 6:off
設定YUM
#vi /etc/redora.repo
[fedora]
name=Fedora $releasever - $basearch
failovermethod=priority
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
baseurl=http://ftp.isu.edu.tw/pub/Linux/Fedora/linux/releases/$releasever/Everything/$basearch/os/
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch
enabled=1
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
[fedora-debuginfo]
name=Fedora $releasever - $basearch -
Debugfailovermethod=priority
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/debug/
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-debug-$releasever&arch=$basearch
enabled=0
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
[fedora-source]
name=Fedora $releasever - Source
failovermethod=priority
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/source/SRPMS/
baseurl=http://ftp.isu.edu.tw/pub/Linux/Fedora/linux/releases/$releasever/Everything/$basearch/debug/
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-source-
$releasever&arch=$basearch
enabled=0
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
修改updates部份
#vi /etc/yum.repos.d/fedora-updates-testing.repo
[updates-testing]
name=Fedora $releasever - $basearch - Test Updates
failovermethod=priority
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/updates/testing/$releasever/$basearch/ baseurl=http://ftp.isu.edu.tw/pub/Linux/Fedora/linux/updates/testing/$releasever/$basearch/ mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-f$releasever&arch=$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
[updates-testing-debuginfo]
name=Fedora $releasever - $basearch - Test Updates Debug
failovermethod=priority
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/updates/testing/$releasever/$basearch/debug/
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-debug-f
$releasever&arch=$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
[updates-testing-source]
name=Fedora $releasever - Test Updates Source
failovermethod=priority
#baseurl=http://dow
nload.fedoraproject.org/pub/fedora/linux/updates/testing/$releasever/SRPMS/
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-source-f$releasever&arch=$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
設定DHCP
#rpm -qa | grep dhcp //檢查是否安裝DHCP
dhcp-4.2.0-21.P2.fc14.i686
未安裝時(利用yum)
#yum install dhcp
設定BIND
#rpm -qa | grep bind //檢查是否安裝DNS Server
bind-libs-9.7.4-0.2.b1.fc14.i686
bind-chroot-9.7.4-0.2.b1.fc14.i686
bind-9.7.4-0.2.b1.fc14.i686
bind-utils-9.7.4-0.2.b1.fc14.i686
未安裝時(利用yum)
#yum install bind
建立正解記錄檔
#vi /var/named/XXX.XXX.edu.tw.hosts
$ttl 38400
dwvs.cy.edu.tw. IN SOA NAT2. dwvs11.dns.dwvs.cy.edu.tw ( 1309075466 10800 3600 604800 38400 )
dwvs.cy.edu.tw. IN NS NAT.
www IN A 163.XX.XX.XX //設定主機記錄
mail IN CNAME 163.XX.XX.XX //設定別名
dns IN MX 10 163.XX.XX.XX //設定MX記錄
建立反解記錄檔
#vi /var/named/XXX.XXX.163.ver
$ttl 38400
0.XX.XX.163.in-addr.arpa. IN SOA NAT2. XXXX.XXX.XXX.XXX.edu.tw. ( 1309076203 10800 3600 604800 38400 )
XX.XX.XX.163.in-addr.arpa. IN NS NAT2.
XX.XX.XX.163.in-addr.arpa. IN PTR dns.XXX.XXX.tw.
設定 named.conf
#vi /etc/named.conf
// listen-on {127.0.0.1;}; (註解,因為預設只限本機查詢)
文件最後面
zone "dwvs.cy.edu.tw" {
type master;
file "/var/named/XXX.XXX.XXX.tw.hosts";
};
zone "0.XX.XX.163.in-addr.arpa" {
type master;
file "/var/named/163.XXX.XXX.0.rev";
};
/etc/rc.d/init.d/named start //啟動dns