請問linux高手三個問題



贊助商連結


bigmichael
2002-10-20, 09:35 AM
我是用linux redhat 7.1

一、我下linuxconf這個指令要做一些設定,但
是它竟然說bash: linuxconf: command not found
可是在重灌以前還在啊!
為什摸會不見呢?我在灌都是選擇everything的也。
我要如何把這個指令再加進來呢?

二、我要做開機片 我下 mkbootdisk`uname -r`
可是失敗也,用新的磁片也是一樣,
可是以前可以啊!為什摸呢?

三、在linux我要如何做dhcp的設定呢?
我參考過下列這兩個站的設法,但是都不能成功
http://netlab.kh.edu.tw/document/NAT_dhcp設定.htm
http://www.study-area.net/linux/linuxfr.htm
要如何設呢?我搞了一星期了,快轟了!
我的環境:linux redhat 7.1 我用和信的計時制768/128 ADSL 有一個固定IP 61.70.199.30
已設好可用PPP0上網,也做好NAT,也架好DNS。
我插了兩張卡 外卡 61.70.199.30
內卡 192.168.1.254
我做DHCP是不是只要去改/etc/dhcpd.conf這個檔就好了呢?
不論是或不是,那要如何改了,煩請高手將步驟寫出來,3 q la~~~

贊助商連結


dominic
2002-10-26, 11:59 AM
這裡只是針對單純的一個區網網段來架設 DHCP server
一、安裝 DHCP server 的 rpm 包裝...

先下載 dhcp-2.0pl5-8.i386.rpm 並安裝 :

rpm -ivh dhcp-2.0pl5-8.i386.rpm

設定為開機時即啟動 DHCP 服務,鍵入 ntsysv

勾選 dhcpd 即可

二、使用dhcpd.conf範本來建立 dhcpd.conf

cp /usr/share/doc/dhcp-2.0pl5/dhcpd.conf.sample /etc/dhcpd.conf

修改 /etc/dhcpd.conf 為如下 (vi /etc/dhcpd.conf)

註 : 下面檔案中的最後一行都要以 ; 結尾
------------------------------------------------
default-lease-time 259200; (設定預設租用ip時間,單位為秒,即3天)
max-lease-time 777600; (設定最大租用ip時間,單位為秒,即9天)
server-identifier 192.168.1.2; (宣告 dhcp server 位置)
option domain-name "shizuka.adsldns.org"; (宣告網域)
option broadcast-address 192.168.1.255; (宣告廣播的位置)
option domain-name-servers 139.175.10.20,163.28.112.1; (宣告使用的DNS server)

#上面的部份為 global 宣告,對整個範圍都有效,下面則是宣告可動態分配ip的可用區塊
#可同時宣告多個可用區塊!

subnet 192.168.1.0 netmask 255.255.255.0 { (想使用的網段為 192.168.1)
# --- default gateway
range 192.168.1.20 192.168.1.255; (特別指定出想使用的特定範圍,可指定多個)
option routers 192.168.1.2; (宣告 gateway 的位置)
#option nis-domain"domain.org";
option time-offset -18000;# Eastern Standard Time
#option ntp-servers192.168.1.1;
#option netbios-name-servers192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
#option netbios-node-type 2;

#下面為如果您想保留某個ip,固定的指定給某台電腦來使用,如可在區網內以固定ip
#來架站所使用,須以下面的 host 方式來宣告
# we want the nameserver to appear at a fixed address
#host ns {
#next-server marvin.redhat.com;
#hardware ethernet 12:34:56:78:AB:CD;
#fixed-address 207.175.42.254;
#}
}

三、啟動 dhcp

service dhcpd start, restart , stop , status

四、如果想在linux client上以dhcp方式取得ip,須安裝 dhcpcd 的 rpm 包裝

可用 rpm -qa | grep dhcpcd 查詢

轉貼自淺倉中的網站.......

bigmichael
2002-10-26, 04:39 PM
最初由 dominic 發表
這裡只是針對單純的一個區網網段來架設 DHCP server
一、安裝 DHCP server 的 rpm 包裝...

先下載 dhcp-2.0pl5-8.i386.rpm 並安裝 :

rpm -ivh dhcp-2.0pl5-8.i386.rpm

設定為開機時即啟動 DHCP ...

我照上面的設定也不能用,後來我用自已的設定方法,他的錯誤訊息和您的方法所出現的錯誤訊息一樣?我的設定如下:

[root@linux /root]# vi /etc/dhcpd.conf
default-lease-time 259200;
default-lease-time 259200;
max-lease-time 777600;
server-identifier 192.168.1.254;
option domain-name "balin.idv.tw";
option broadcast-address 192.168.1.255;



subnet 192.168.1.0 netmask 255.255.255.0 {
option domain-name-servers 168.95.1.1;
range 192.168.1.100 192.168.1.150;
option routers 192.168.1.254;
option subnet-mask 255.255.255.0;
option time-offset -18000;
}


我在啟動dhcp時出現的錯誤訊息如下:

[root@linux /root]# /etc/rc.d/init.d/dhcpd start
Starting dhcpd: Internet Software Consortium DHCP Server 2.0pl5
Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.
All rights reserved.

Please contribute if you find this software useful.
For info, please visit http://www.isc.org/dhcp-contrib.html


Listening on Socket/eth1/192.168.1.0
Sending on Socket/eth1/192.168.1.0
No subnet declaration for eth0 (61.70.199.30).
Please write a subnet declaration in your dhcpd.conf file for the
network segment to which interface eth0 is attached.
exiting.

[FAILED]


看到這樣的錯誤的訊息好像和eth0 61.70.199.30有關,可是這個地方我看不太懂要如何設,及他的原理是什摸??
煩請高手指導!


補充:
我的環境:linux redhat 7.1 我用和信的計時制768/128 ADSL 有一個固定IP 61.70.199.30
我插了兩張卡 外卡 61.70.199.30
內卡 192.168.1.254

我下ifconfig指令如下:
[root@linux /root]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:00:01:00:59:83
inet addr:61.70.199.30 Bcast:61.70.199.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1767 errors:0 dropped:0 overruns:0 frame:0
TX packets:1709 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
Interrupt:9 Base address:0xc800

eth1 Link encap:Ethernet HWaddr 00:40:F4:30:F9:13
inet addr:192.168.1.254 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2555 errors:0 dropped:0 overruns:0 frame:0
TX packets:2228 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
Interrupt:12 Base address:0xbf00

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:33 errors:0 dropped:0 overruns:0 frame:0
TX packets:33 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0

ppp0 Link encap:Point-to-Point Protocol
inet addr:61.70.199.38 P-t-P:203.133.3.34 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
RX packets:1671 errors:0 dropped:0 overruns:0 frame:0
TX packets:1615 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3

有這四個介面eth0
eth1
lo
ppp0

上述的情況是直接將eth0這個介面上設固定ip 61.70.199.30
這是我出問題,的環境。

但是當我將eht0上面的ip全部拿掉之後,再下ifconfig如下:
[root@linux /root]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:00:01:00:59:83
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1767 errors:0 dropped:0 overruns:0 frame:0
TX packets:1709 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
Interrupt:9 Base address:0xc800

eth1 Link encap:Ethernet HWaddr 00:40:F4:30:F9:13
inet addr:192.168.1.254 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2555 errors:0 dropped:0 overruns:0 frame:0
TX packets:2228 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
Interrupt:12 Base address:0xbf00

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:33 errors:0 dropped:0 overruns:0 frame:0
TX packets:33 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0

ppp0 Link encap:Point-to-Point Protocol
inet addr:61.70.199.38 P-t-P:203.133.3.34 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
RX packets:1671 errors:0 dropped:0 overruns:0 frame:0
TX packets:1615 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
如此我的eth0上沒有ip我的dhcp即可以正常運作了!
到此好像解決,但是沒有,因為我們公司是用固定制的固定Ip,不像我家裡測用的和信計時制的浮動固定ip,所以不會有ppp0這個介面,所以還是必須用上面有問題的方法,煩請各路高指導!要如何作

dominic
2002-10-26, 09:10 PM
在Giga(我就是用gigaㄉ)eth0是不需指定ip且不要設定on boot....當ppp撥號時它就會啟動...用giga就一定會有ppp0(這個介面的ip就是真實ip了)


giga跟hinet固定制不同......因為hinet是不需撥號就沒有ppp0..真實ip就是指定給eth0

bigmichael
2002-10-26, 09:26 PM
最初由 dominic 發表
在Giga(我就是用gigaㄉ)eth0是不需指定ip且不要設定on boot....當ppp撥號時它就會啟動...用giga就一定會有ppp0(這個介面的ip就是真實ip了)


giga跟hinet固定制不同......因為hinet是不需撥號就沒有ppp0..真實ip?..

您說的沒錯,但是固定制的eth0給他61.70.199.30
就會出現我上面的錯誤了也,如下:

[root@linux /root]# /etc/rc.d/init.d/dhcpd start
Starting dhcpd: Internet Software Consortium DHCP Server 2.0pl5
Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.
All rights reserved.

Please contribute if you find this software useful.
For info, please visit http://www.isc.org/dhcp-contrib.html


Listening on Socket/eth1/192.168.1.0
Sending on Socket/eth1/192.168.1.0
No subnet declaration for eth0 (61.70.199.30).
Please write a subnet declaration in your dhcpd.conf file for the
network segment to which interface eth0 is attached.
exiting.

[FAILED]




我覺的eth0一定要做什摸的宣告(在/etc/dhcpd.conf內),上面declaration就要我宣告什摸東西的,只是我試過所有的方法都不行!
能告訴我要如何設嗎?

dominic
2002-10-26, 09:42 PM
能貼上dhcpd.confㄇ???這樣可能比較好找問題

bigmichael
2002-10-26, 09:50 PM
最初由 dominic 發表
能貼上dhcpd.confㄇ???這樣可能比較好找問題
我的設定如下:

[root@linux /root]# vi /etc/dhcpd.conf
default-lease-time 259200;
default-lease-time 259200;
max-lease-time 777600;
server-identifier 192.168.1.254;
option domain-name "balin.idv.tw";
option broadcast-address 192.168.1.255;



subnet 192.168.1.0 netmask 255.255.255.0 {
option domain-name-servers 168.95.1.1;
range 192.168.1.100 192.168.1.150;
option routers 192.168.1.254;
option subnet-mask 255.255.255.0;
option time-offset -18000;
}


我在啟動dhcp時出現的錯誤訊息如下:

[root@linux /root]# /etc/rc.d/init.d/dhcpd start
Starting dhcpd: Internet Software Consortium DHCP Server 2.0pl5
Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.
All rights reserved.

Please contribute if you find this software useful.
For info, please visit http://www.isc.org/dhcp-contrib.html


Listening on Socket/eth1/192.168.1.0
Sending on Socket/eth1/192.168.1.0
No subnet declaration for eth0 (61.70.199.30).
Please write a subnet declaration in your dhcpd.conf file for the
network segment to which interface eth0 is attached.
exiting.

[FAILED]

dominic
2002-10-26, 09:52 PM
server-identifier 192.168.1.2; (宣告 dhcp server 位置)


你的是????

dominic
2002-10-26, 09:57 PM
找 /etc/rc.d/init.d/dhcpd 這個檔的這一行
daemon /usr/sbin/dhcpd xxxxxxx
把它改成
daemon /usr/sbin/dhcpd eth1
試試看

bigmichael
2002-10-26, 11:05 PM
最初由 dominic 發表
server-identifier 192.168.1.2; (宣告 dhcp server 位置)


你的是????

是啊!沒錯那是我的主機內卡的ip