• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.
Xin chào ! Nếu đây là lần đầu tiên bạn đến với diễn đàn, xin vui lòng danh ra một phút bấm vào đây để đăng kí và tham gia thảo luận cùng VnPro.

Announcement

Collapse
No announcement yet.

DHCP for VLAN

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • DHCP for VLAN

    Xin bạn xem topology và các địa chỉ VLAN trong đó.


    + Khi ta cắm 1 PC vào 1 port trên Switch, thì ta muốn nó ở VLAN nào là thì ta cứ cắm vào Port đã qui định sẵn trong Database Vlan.

    + Tuy nhiên, khi được 1 PC nhận được địa chỉ IP từ DHCP SERVER , thì sẽ xảy ra tình trạng là IP được cấp fát có thể không đúng theo range IP của VLAN , vì vậy có thể dẫn đến problem.

    Giải fáp của mình : ỏ mỗi cái Switch, ta cần 1 cái DHCP server. Tuy nhiên , giải fáp này "hơi bị" tốn kém.

    Vậy theo các bạn , liệu có cần 1 DHCP Server thôi hay là fải cần tới 3. Và nếu chỉ cần 1 DHCP Server thì policy nào cho router hay DHCP Server, để có thể cấp fát chình xác địa chỉ IP cho từng Host khi được cắm vào các port trên switch , ứng với VLAN tương ứng


    Vnpro - The way to get knowledge
    Mikami - UMass
    E-mail : mikami@vnpro.org

  • #2
    hỏi về dhcp server

    Các anh cho em hỏi,

    Khi cấu hình DHCP Server trên router, em thấy có phần option. Cái này để làm gì? Có thể xem danh sách các option này ở đâu?

    Xin cám ơn.

    Comment


    • #3
      Re: Một vấn đề chưa có solution.

      Hi,

      Your problem seemed to be solved in:

      Configuring the DHCP Option 82 for Subscriber Identification


      Bests.

      Comment


      • #4
        Re: hỏi về dhcp server

        Mục option đó là để cấu hình các thông số cần thiết cho một số dịch vụ khác như Voice (trỏ đến TFTP Server để download file cấu hình, WWW, IP Forwarding).

        VD option 19 là để enable/disable IP forwarding cho client, option 72 là để chỉ rõ WEB Server cho clients, chi tiết về các loại option này, bạn search cái RFC 2131 về đọc là biết ngay. Xem link dưới đây để biết:

        Cisco offers a wide range of products and networking solutions designed for enterprises and small businesses across a variety of industries.


        Hope this helps

        Comment


        • #5
          Chính xác. Mình đã kiểm chứng lại.

          Comment


          • #6
            Nghĩa là theo duydq thì làm theo cách của Heke thì sẽ giải quyết được vấn đề.

            Nếu như thế minh sẽ kiểm chứng lại.
            Vnpro - The way to get knowledge
            Mikami - UMass
            E-mail : mikami@vnpro.org

            Comment


            • #7
              Đúng vậy đó Mikami.
              Mikami chỉ cần khai dhcp relay agent trên gateway của vlan đó là OK. Trên window cũng có service làm được chuyện đó.

              Thân chào.

              Comment


              • #8
                hi,

                Bổ sung thêm ý kiến của Duydq: trên cisco routers, bạn sẽ cấu hình dhcp agents bằng lệnh :

                ip helper address xxxx

                trong đó xxxx là địa chỉ của dhcp server.

                Thân,
                Minh
                Đặng Quang Minh, CCIEx2#11897 (Enterprise Infrastructure, Wireless), DEVNET, CCSI#31417

                Email : dangquangminh@vnpro.org
                https://www.facebook.com/groups/vietprofessional/

                Comment


                • #9
                  Tiếp tục 1 vấn đề về VLAN và DHCP Server:


                  ROUTER -------SWITCH ( có 3 VLAN )

                  VLAN 1 : 10.0.1.0 255.255.255.0
                  VLAN 2 : 10.0.2.0 255.255.255.0
                  VLAN 3 : 10.0.3.0 255.255.255.0

                  Router có nhiệm vụ vừa truncking và vừa có nhiệm vụ DHCP Server

                  Đây là cấu hình của Router :

                  Current configuration:
                  !
                  version 12.0
                  service timestamps debug uptime
                  service timestamps log uptime
                  no service password-encryption
                  !
                  hostname Router-Trunking
                  !
                  !
                  !
                  !
                  !
                  !
                  ip subnet-zero
                  !
                  ip dhcp pool net101
                  network 10.0.1.0 255.255.255.0
                  default-router 10.0.1.1
                  !
                  ip dhcp pool net102
                  network 10.0.2.0 255.255.255.0
                  --More--   default-router 10.0.2.2
                  !
                  ip dhcp pool net103
                  network 10.0.3.0 255.255.255.0
                  default-router 10.0.3.3
                  !
                  !
                  !
                  !
                  !
                  !
                  interface FastEthernet0/0
                  no ip address
                  no ip directed-broadcast
                  duplex auto
                  speed auto
                  !
                  interface FastEthernet0/0.1
                  encapsulation isl 1
                  ip address 10.0.1.1 255.255.255.0
                  no ip redirects
                  no ip directed-broadcast
                  !
                  --More--  interface FastEthernet0/0.2
                  encapsulation isl 2
                  ip address 10.0.2.2 255.255.255.0
                  no ip redirects
                  no ip directed-broadcast
                  !
                  interface FastEthernet0/0.3
                  encapsulation isl 3
                  ip address 10.0.3.3 255.255.255.0
                  no ip redirects
                  no ip directed-broadcast
                  !
                  interface Serial0/0
                  no ip address
                  no ip directed-broadcast
                  no ip mroute-cache
                  shutdown
                  no fair-queue
                  !
                  interface FastEthernet0/1
                  no ip address
                  no ip directed-broadcast
                  shutdown
                  --More--   duplex auto
                  speed auto
                  !
                  interface Serial0/1
                  no ip address
                  no ip directed-broadcast
                  shutdown
                  !
                  interface Ethernet1/0
                  no ip address
                  no ip directed-broadcast
                  shutdown
                  !
                  interface Ethernet1/1
                  no ip address
                  no ip directed-broadcast
                  shutdown
                  !
                  interface Ethernet1/2
                  no ip address
                  no ip directed-broadcast
                  shutdown
                  !
                  --More--  interface Ethernet1/3
                  no ip address
                  no ip directed-broadcast
                  shutdown
                  !
                  ip classless
                  no ip http server
                  !
                  !
                  line con 0
                  transport input none
                  line aux 0
                  line vty 0 4
                  !
                  no scheduler allocate
                  end

                  Còn đây là cấu hình của Switch :

                  Current configuration:
                  !
                  version 12.0
                  no service pad
                  service timestamps debug uptime
                  service timestamps log uptime
                  no service password-encryption
                  !
                  hostname SwitchVLAN
                  !
                  !
                  !
                  !
                  !
                  !
                  !
                  ip subnet-zero
                  !
                  !
                  !
                  interface FastEthernet0/1
                  switchport access vlan 2
                  --More--  !
                  interface FastEthernet0/2
                  switchport access vlan 2
                  !
                  interface FastEthernet0/3
                  switchport access vlan 2
                  !
                  interface FastEthernet0/4
                  switchport access vlan 2
                  !
                  interface FastEthernet0/5
                  switchport access vlan 2
                  !
                  interface FastEthernet0/6
                  switchport access vlan 3
                  !
                  interface FastEthernet0/7
                  switchport access vlan 3
                  !
                  interface FastEthernet0/8
                  switchport access vlan 3
                  !
                  interface FastEthernet0/9
                  --More--   switchport access vlan 3
                  !
                  interface FastEthernet0/10
                  switchport access vlan 3
                  !
                  interface FastEthernet0/11
                  switchport mode trunk
                  !
                  interface FastEthernet0/12
                  !
                  interface VLAN1
                  ip address 10.0.1.2 255.255.255.0
                  no ip directed-broadcast
                  no ip route-cache
                  !
                  interface VLAN2
                  no ip directed-broadcast
                  no ip route-cache
                  shutdown
                  !
                  interface VLAN3
                  no ip directed-broadcast
                  no ip route-cache
                  --More--   shutdown
                  !
                  !
                  line con 0
                  transport input none
                  stopbits 1
                  line vty 0 4
                  password cisco
                  login
                  line vty 5 15
                  login
                  !
                  end

                  Và 1 có 1 trường hợp mình kô thể hiểu :

                  Với 2 config như thế thì khi mình cấm bất kỳ PC nào vào Switch thì DHCP Server cấp phát chính xác vùng Range IP mà mình đã định nghĩa sẵn cho từng VLAN

                  Ví dụ theo config trên thì

                  F0/1 - F0/5 ----> VLAN 2 : 10.0.2.0 255.255.255.0
                  F0/6 - F0/10 ----> VLAN 3 : 10.0.3.0 255.255.255.0
                  F0/12 ----> VLAN 1 : 10.0.1.0 255.255.255.0

                  Khi mình cấm vào Port 1 thì PC nhận được IP là 10.0.2.1
                  Port 6 thì IP là 10.0.3.1
                  Port 12 thì IP là 10.0.1.2(vì 1.1 là địa chỉ củasubint)


                  Vậy các bạn có thể giải thích vì sao Router có thể hiểu và có thể cấp phát chính xác như thế đuợc.

                  Cũng với cấu hình như thế , có lần Router cấp phát tùm lum, kô đúng gì hết.
                  Vnpro - The way to get knowledge
                  Mikami - UMass
                  E-mail : mikami@vnpro.org

                  Comment


                  • #10
                    Re: Một vấn đề chưa có solution.

                    Hi Mikami,

                    Pls visit:
                    This document describes how to troubleshoot several common issues with Dynamic Host Configuration Protocol (DHCP) in a Cisco Catalyst switch network.


                    This may help u.

                    Comment


                    • #11
                      DHCP rất thông minh. Khi có nhiều pool ip, DHCP server sẽ tự tìm pool nào thích hợp nhất với ip tới xin cấp ip cho client (ip gateway của vlan1, vlan2,..) và sẽ không chấp nhận ip từ những pool khác.
                      Mikami tìm đọc cơ chế hoạt động của DHCP server sẽ hiểu ngay thôi.

                      Thân chào,
                      dqd.

                      Comment


                      • #12
                        Duy,

                        Duy có thể giải thích cơ chế đó ở đây không? Đặc điểm nào của dhcp làm cho một client trong một vlan nào đó có thể lấy được ip address trong pool tương ứng?

                        xin cám ơn,

                        Comment


                        • #13
                          Không nhớ chính xác cơ chế nhưng đại khái như thế này.
                          1. Client sẽ di tìm DHCPserver bằng cách gởi broadcast để discover. Alo alo, ai là DHCP server lên tiếng.
                          2. Many DHCP server nhận được broadcast sẽ apply tới client cho nó chọn lựa. Tui là DHCP server đây, tui sẽ cấp ip cho ông trong net này. Chịu không?
                          3. Client sẽ gởi broadcast lần nữa để hỏi. Tui cần 1 ip nhưng gateway phải là như vầy nghe. Ông cấp được không.
                          4. DHCP server sẽ tìm xem có pool nào cùng subnet với yêu cầu kg. Nếu có thì gởi lại. Sự cho và nhận bắt đầu.

                          Mọi người thấy sai thì sửa giùm nghe. Thanks.
                          Thân chào.

                          Comment


                          • #14
                            thanks Duy.

                            Vậy là mấu chốt của vấn đề nằm ở chổ dhcp server sẽ cấp ip nằm trong pool sao cho thoã mãn điều kiện có gateway biết trước.

                            Comment


                            • #15
                              Vây trường hợp như thế này tại sao IP bị cấp sai

                              Router ( DHCP Server ) --------- Router(Truncking) ----- Switch( VLAN )

                              Đây là cấu hình từng cái :

                              DHCP Server :
                              Building configuration...

                              Current configuration:
                              !
                              version 12.0
                              service timestamps debug uptime
                              service timestamps log uptime
                              no service password-encryption
                              !
                              hostname DHCP-Server
                              !
                              !
                              !
                              !
                              !
                              !
                              ip subnet-zero
                              !
                              ip dhcp pool net101
                              network 10.0.1.0 255.255.255.0
                              default-router 10.0.1.2
                              !
                              ip dhcp pool net102
                              network 10.0.2.0 255.255.255.0
                              --More--   default-router 10.0.2.1
                              !
                              ip dhcp pool net103
                              network 10.0.3.0 255.255.255.0
                              default-router 10.0.3.1
                              !
                              !
                              !
                              process-max-time 200
                              !
                              hub ether 0 1
                              link-test
                              auto-polarity
                              !
                              hub ether 0 2
                              link-test
                              auto-polarity
                              !
                              hub ether 0 3
                              link-test
                              auto-polarity
                              !
                              hub ether 0 4
                              --More--   link-test
                              auto-polarity
                              !
                              hub ether 0 5
                              link-test
                              auto-polarity
                              !
                              hub ether 0 6
                              link-test
                              auto-polarity
                              !
                              hub ether 0 7
                              link-test
                              auto-polarity
                              !
                              hub ether 0 8
                              link-test
                              auto-polarity
                              !
                              hub ether 0 9
                              link-test
                              auto-polarity
                              !
                              --More--  hub ether 0 10
                              link-test
                              auto-polarity
                              !
                              hub ether 0 11
                              link-test
                              auto-polarity
                              !
                              hub ether 0 12
                              link-test
                              auto-polarity
                              !
                              hub ether 0 13
                              link-test
                              auto-polarity
                              !
                              hub ether 0 14
                              link-test
                              auto-polarity
                              !
                              interface Ethernet0
                              ip address 10.0.4.1 255.255.255.0
                              no ip directed-broadcast
                              --More--  !
                              interface Serial0
                              no ip address
                              no ip directed-broadcast
                              no ip mroute-cache
                              shutdown
                              no fair-queue
                              !
                              interface Serial1
                              no ip address
                              no ip directed-broadcast
                              shutdown
                              !
                              interface BRI0
                              no ip address
                              no ip directed-broadcast
                              shutdown
                              isdn guard-timer 0 on-expiry accept
                              !
                              router rip
                              version 2
                              network 10.0.0.0
                              !
                              --More--  ip classless
                              no ip http server
                              !
                              !
                              line con 0
                              transport input none
                              line aux 0
                              line vty 0 4
                              !
                              end

                              Cấu hình truncking router :
                              show ip route
                              Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
                              D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
                              N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
                              E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
                              i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
                              * - candidate default, U - per-user static route, o - ODR
                              P - periodic downloaded static route

                              Gateway of last resort is not set

                              10.0.0.0/24 is subnetted, 4 subnets
                              C 10.0.2.0 is directly connected, FastEthernet0/0.2
                              C 10.0.3.0 is directly connected, FastEthernet0/0.3
                              C 10.0.1.0 is directly connected, FastEthernet0/0.1
                              C 10.0.4.0 is directly connected, FastEthernet0/1
                              Truncking-Router#show run
                              Building configuration...

                              Current configuration:
                              !
                              version 12.0
                              service timestamps debug uptime
                              service timestamps log uptime
                              no service password-encryption
                              !
                              hostname Truncking-Router
                              !
                              !
                              !
                              !
                              !
                              !
                              ip subnet-zero
                              !
                              !
                              !
                              !
                              voice-port 1/0/0
                              !
                              voice-port 1/0/1
                              --More--  !
                              !
                              !
                              interface FastEthernet0/0
                              no ip address
                              ip helper-address 10.0.4.1
                              no ip directed-broadcast
                              duplex auto
                              speed auto
                              !
                              interface FastEthernet0/0.1
                              encapsulation isl 1
                              ip address 10.0.1.2 255.255.255.0
                              no ip redirects
                              no ip directed-broadcast
                              !
                              interface FastEthernet0/0.2
                              encapsulation isl 2
                              ip address 10.0.2.1 255.255.255.0
                              no ip redirects
                              no ip directed-broadcast
                              !
                              interface FastEthernet0/0.3
                              --More--   encapsulation isl 3
                              ip address 10.0.3.1 255.255.255.0
                              no ip redirects
                              no ip directed-broadcast
                              !
                              interface Serial0/0
                              no ip address
                              no ip directed-broadcast
                              no ip mroute-cache
                              shutdown
                              no fair-queue
                              !
                              interface FastEthernet0/1
                              ip address 10.0.4.2 255.255.255.0
                              no ip directed-broadcast
                              duplex auto
                              speed auto
                              !
                              router rip
                              version 2
                              network 10.0.0.0
                              !
                              ip classless
                              --More--  no ip http server
                              !
                              !
                              line con 0
                              transport input none
                              line aux 0
                              line vty 0 4
                              !
                              no scheduler allocate
                              end
                              Cấu hình Switch :

                              show run
                              Building configuration...

                              Current configuration:
                              !
                              version 12.0
                              no service pad
                              service timestamps debug uptime
                              service timestamps log uptime
                              no service password-encryption
                              !
                              hostname Switch
                              !
                              !
                              !
                              !
                              !
                              !
                              !
                              ip subnet-zero
                              !
                              !
                              !
                              interface FastEthernet0/1
                              switchport access vlan 2
                              --More--  !
                              interface FastEthernet0/2
                              switchport access vlan 2
                              !
                              interface FastEthernet0/3
                              switchport access vlan 2
                              !
                              interface FastEthernet0/4
                              switchport access vlan 2
                              !
                              interface FastEthernet0/5
                              switchport access vlan 2
                              !
                              interface FastEthernet0/6
                              switchport access vlan 3
                              !
                              interface FastEthernet0/7
                              switchport access vlan 3
                              !
                              interface FastEthernet0/8
                              switchport access vlan 3
                              !
                              interface FastEthernet0/9
                              --More--   switchport access vlan 3
                              !
                              interface FastEthernet0/10
                              switchport access vlan 3
                              !
                              interface FastEthernet0/11
                              switchport mode trunk
                              !
                              interface FastEthernet0/12
                              !
                              interface VLAN1
                              ip address 10.0.1.1 255.255.255.0
                              no ip directed-broadcast
                              no ip route-cache
                              !
                              !
                              line con 0
                              transport input none
                              stopbits 1
                              line vty 5 15
                              !
                              end

                              Switch#show vlan
                              VLAN Name Status Ports
                              ---- -------------------------------- --------- -------------------------------
                              1 default active Fa0/12
                              2 vlan2 active Fa0/1, Fa0/2, Fa0/3, Fa0/4,
                              Fa0/5
                              3 vlan3 active Fa0/6, Fa0/7, Fa0/8, Fa0/9,
                              Fa0/10
                              1002 fddi-default active
                              1003 token-ring-default active
                              1004 fddinet-default active
                              1005 trnet-default active

                              VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
                              ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
                              1 enet 100001 1500 - - - - - 1002 1003
                              2 enet 100002 1500 - - - - - 0 0
                              3 enet 100003 1500 - - - - - 0 0
                              1002 fddi 101002 1500 - - - - - 1 1003
                              1003 tr 101003 1500 1005 0 - - srb 1 1002
                              1004 fdnet 101004 1500 - - 1 ibm - 0 0
                              1005 trnet 101005 1500 - - 1 ibm - 0 0

                              Viêc cấp IP hoàn toàn sai .
                              Duydq có thể giải thích cho mình được ko .
                              Vnpro - The way to get knowledge
                              Mikami - UMass
                              E-mail : mikami@vnpro.org

                              Comment

                              Working...
                              X