回覆列表
  • 1 # 藍風24

    DHCP多作用域設定

    DHCP伺服器使用單一的作用域,大部分時間能夠滿足網路的需求,但是有些特殊情況下,按照網路規劃我們需要配置多作用域。

    網路中如果計算機和其他裝置數量增加,IP地址需要進行擴容才能滿足需求。小型網路可以對所有裝置重新分配IP地址,其網路內部客戶機和伺服器數量較少,實現起來比較簡單。但如果是一個大型網路,重新配置整個網路的IP地址是不明智的,如果操作不當,可能會造成通訊暫時中斷以及其他網路故障。我們可以透過多作用域的設定,即DHCP伺服器釋出多個作用域實現IP地址增容的目的。

    公司IP地址規劃為192.168.2.0/24網段,可以容納254臺裝置,使用DHCP伺服器建立一個192.168.2.0網段的作用域,動態管理網路IP地址,但網路規模擴大到500臺機器,顯然一個C類網的地址無法滿足要求了。這時,可以再為DHCP伺服器新增一個新作用域,管理分配192.168.3.0/24網段的IP地址,為網路增加254個新的IP地址,這樣既可以保持原有IP地址的規劃,又可以擴容現有的網路IP地址。

    (1)簡單實現DHCP多作用域

    對於多作用域的配置,必須保證DHCP伺服器能夠偵聽所有子網客戶機的請求資訊,下面將講解配置多作用域的基本方法,為DHCP新增多個網絡卡連線每個子網,併發布多個作用域的宣告。

    注意:劃分子網時,如果選擇直接配置多作用域實現動態IP分配的任務,則必須要為DHCP伺服器新增多塊網絡卡,並配置多個IP地址,否則DHCP伺服器只能分配與其現有網絡卡IP地址對應網段的作用域。

    採用雙網絡卡實現兩個作用域

    1)網絡卡配置IP地址

    DHCP伺服器有多塊網絡卡時,需要使用ifconfig命令為每塊網絡卡配置獨立的IP地址,但要注意,IP地址配置的網段要與DHCP伺服器釋出的作用域對應哈~

    ifconfig eth0 192.168.2.1 netmask 255.255.255.0

    ifconfig eth1 192.168.3.1 netmask 255.255.255.0

    2)編輯dhcpd.conf主配置檔案

    當DHCP伺服器網路環境搭建完畢後,我們可以編輯dhcpd.conf主配置檔案完成多作用域的設定。

    ddns-update-style none;

    ignore client-updates;

    subnet 192.168.2.0 netmask 255.255.255.0 {

    # --- default gateway

    option routers 192.168.2.1;

    option subnet-mask 255.255.255.0;

    option nis-domain "domain.org";

    option domain-name "domain.org";

    option domain-name-servers 192.168.2.2;

    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.2.50 192.168.2.250;

    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;

    }

    }

    subnet 192.168.3.0 netmask 255.255.255.0 {

    # --- default gateway

    option routers 192.168.3.1;

    option subnet-mask 255.255.255.0;

    option nis-domain "domain.org";

    option domain-name "domain.org";

    option domain-name-servers 192.168.2.2;

    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.3.50 192.168.3.250;

    default-lease-time 21600;

    max-lease-time 43200;

    max-lease-time 43200;

    }

    儲存退出哈~

    3)測試驗證

    重啟DHCP服務後檢查系統日誌,檢測配置是否成功,使用tail命令動態顯示日誌資訊。

    tail -F /etc/log/messages

    經過設定,對於DHCP伺服器將透過eth0和eth1兩塊網絡卡偵聽客戶機的請求,併發送相應的迴應。

    Jan 19 16:02:51 rhel5 dhcpd: DHCPDISCOVER from 00:19:21:bd:a3:da via eth1

    Jan 19 16:02:51 rhel5 dhcpd: DHCPDISCOVER from 00:19:21:bd:a3:da via eth0

    Jan 19 16:02:52 rhel5 dhcpd: DHCPOFFER . 192.168.3.250 to 00:19:21:bd:a3:da (mis) via eth1

    Jan 19 16:02:52 rhel5 dhcpd: DHCPOFFER . 192.168.2.250 to 00:19:21:bd:a3:da (mis) via eth0

    Jan 19 16:02:52 rhel5 dhcpd: DHCPREQUEST for 192.168.3.250 (192.168.3.1) from 00:19:21:bd:a3:da (mis) via eth1

    Jan 19 16:02:52 rhel5 dhcpd: DHCPACK . 192.168.3.250 to 00:19:21:bd:a3:da (mis) via eth1

    Jan 19 16:02:52 rhel5 dhcpd: DHCPREQUEST for 192.168.3.250 (192.168.3.1) from 00:19:21:bd:a3:da (mis) via eth0: ignored (not authoritative).

    Jan 19 16:02:53 rhel5 dhcpd: DHCPDISCOVER from 00:19:21:bd:a3:da (mis) via eth1

    Jan 19 16:02:53 rhel5 dhcpd: DHCPOFFER . 192.168.3.250 to 00:19:21:bd:a3:da (mis) via eth1

    Jan 19 16:02:53 rhel5 dhcpd: DHCPDISCOVER from 00:19:21:bd:a3:da (mis) via eth0

    Jan 19 16:02:53 rhel5 dhcpd: DHCPOFFER . 192.168.2.250 to 00:19:21:bd:a3:da (mis) via eth0

    Jan 19 16:02:53 rhel5 dhcpd: DHCPREQUEST for 192.168.3.250 (192.168.3.1) from 00:19:21:bd:a3:da (mis) via eth1

    Jan 19 16:02:53 rhel5 dhcpd: DHCPACK . 192.168.3.250 to 00:19:21:bd:a3:da (mis) via eth1

    Jan 19 16:02:53 rhel5 dhcpd: DHCPREQUEST for 192.168.3.250 (192.168.3.1) from 00:19:21:bd:a3:da (mis) via eth0: ignored (not authoritative).

    Jan 19 16:02:54 rhel5 dhcpd: DHCPDISCOVER from 00:19:21:bd:a3:da (mis) via eth1

    Jan 19 16:02:54 rhel5 dhcpd: DHCPOFFER . 192.168.3.250 to 00:19:21:bd:a3:da (mis) via eth1

    Jan 19 16:02:54 rhel5 dhcpd: DHCPDISCOVER from 00:19:21:bd:a3:da (mis) via eth0

    Jan 19 16:02:54 rhel5 dhcpd: DHCPOFFER . 192.168.2.250 to 00:19:21:bd:a3:da (mis) via eth0

    Jan 19 16:02:54 rhel5 dhcpd: DHCPREQUEST for 192.168.3.250 (192.168.3.1) from 00:19:21:bd:a3:da (mis) via eth1

    Jan 19 16:02:54 rhel5 dhcpd: DHCPACK . 192.168.3.250 to 00:19:21:bd:a3:da (mis) via eth1

    Jan 19 16:02:54 rhel5 dhcpd: DHCPREQUEST for 192.168.3.250 (192.168.3.1) from 00:19:21:bd:a3:da (mis) via eth0: ignored (not authoritative).

    Jan 19 16:02:55 rhel5 dhcpd: DHCPDISCOVER from 00:19:21:bd:a3:da (mis) via eth1

    Jan 19 16:02:55 rhel5 dhcpd: DHCPOFFER . 192.168.3.250 to 00:19:21:bd:a3:da (mis) via eth1

    Jan 19 16:02:55 rhel5 dhcpd: DHCPDISCOVER from 00:19:21:bd:a3:da (mis) via eth0

    Jan 19 16:02:55 rhel5 dhcpd: DHCPOFFER . 192.168.2.250 to 00:19:21:bd:a3:da (mis) via eth0

    Jan 19 16:02:55 rhel5 dhcpd: DHCPREQUEST for 192.168.3.250 (192.168.3.1) from 00:19:21:bd:a3:da (mis) via eth1

    Jan 19 16:02:55 rhel5 dhcpd: DHCPACK . 192.168.3.250 to 00:19:21:bd:a3:da (mis) via eth1

    Jan 19 16:02:55 rhel5 dhcpd: DHCPREQUEST for 192.168.3.250 (192.168.3.1) from 00:19:21:bd:a3:da (mis) via eth0: ignored (not authoritative).

  • 中秋節和大豐收的關聯?
  • 大白菜是感光食物嗎?