2009年10月15日 星期四

CentOS安裝dhcp server


dhcp server : CentOS
設定兩張網卡:
bridge:
  • 設定成dhcp,取得ip為140.137.217.95

host-only:
  • #setup
  • #選Network Configuration / EEdit a device param / eeth1
    • Use DHCP [ ] --->按空白鍵取消 *
    • static IP =192.168.182.100
    • mask = 255.255.255.0
    • GW:140.137.217.95
  • #service network restart
安裝dhcp
  • #rpm -qa | grep dhcp --->檢查是否有安裝
  • #yum -y install dhcp --->安裝dhcp
設定dhcp設定檔
  • #vi /etc/dhcpd.conf --->剛安裝好,是空白的.叫你去參考別支檔案.dhcp*表示dhcp的版本
  • #cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf --->將範例copy過來改
  • #vi /etc/dhcpd.conf--->以下為檔案修改的內容,粗體字為修改的部份

subnet 192.168.182.0 --->服務的網段netmask 255.255.255.0 {

# --- default gateway
        option routers                  192.168.182.100;--->路由
        option subnet-mask              255.255.255.0;

        option nis-domain               "domain.org";
        option domain-name              "domain.org";
        option domain-name-servers      168.95.1.1;--->dns,設成hinet

        option time-offset              -18000; # Eastern Standard Time
#       option ntp-servers              192.168.1.1;
#       option netbios-name-servers     192.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;

        range dynamic-bootp 192.168.182.200 192.168.182.201;--->提供的ip,這裏設成二個
        default-lease-time 21600;
        max-lease-time 43200;

        # 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;
        }
}

  • #vi /etc/sysconfig/dhcpd
DHCPDARGS="eth1"

  • #cd /etc/init.d/dhcpd start --->啟動dhcp
  • #tail -f /var/log/messages --->查看dhcp的log

dhcp client : Open Suse
  • 停止VMWare DHCP 服務
  • #dhcp -r --->釋放ip (#dhcp eth0 -r 指令網卡釋放dhcp ip)
  • #dhcp --->重新取得ip

沒有留言:

張貼留言