(已经解决)求高手赐教DHCP跨网段分配的问题
现有Cisco 3660和2950各一台,我架构了一台Linux做为DHCP server 具体情况如下描述
2950:
我在2950上划分了三个vlan 分别是vlan51 vlan52 vlan 53 将端口0/10,0/11放入vlan51,端口0/12 放入vlan 52 端口0/13 放入vlan 53,将端口0/9设置成trunk与3660的 0/0端口相连
3660:
在0/0端口设置子接口0/0.1,0/0.2,0/0.3.
0/0.1 下设置ip 地址为 192.168.1.1/24 封装成 dotq 51
0/0.2 下设置ip 地址为 192.168.2.1/24 封装成 dotq 52 设置ip help-address 192.168.1.10(DHCP服务器地址)
0/0.3 下设置ip 地址为 192.168.3.1/24 封装成 dotq 53 设置ip help-address 192.168.1.10(DHCP服务器地址)
在全局配置模式下配置
Service Dhcp
Ip Dhcp Relay Information Option
Linux server:
配置好DHCP服务器,建立三个作用域,分别为
192.168.1.0/24 网关为 192.168.1.1 server-indentifer 192.168.1.1
192.168.2.0/24 网关为 192.168.2.1 server-indentifer 192.168.2.1
192.168.3.0/24 网关为 192.168.3.1 server-indentifer 192.168.3.1
服务器IP地址是192.168.1.10 与2950 0/10端口连
当我测试时遇到如下问题:
当我把测试机连入任何一个网段都不能获取ip地址. 这个问题应该不是网络的问题我同样用一台Win2003做DHCP服务器就能测试机不管在哪个网段都能获取正确的ip地址.希望各位大虾能告诉我Linux服务器还需要什么配置.
Thanks in advance!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
你的测试机的IP是多少?
放在它的本网段试试.
我测试机是动态获取 IP的 如果我手动指定不同ip和网关的话 都可以ping 通 DHCP服务器. 说明网络没有问题 而且我的Win2003是可以分配正确的IP的
把你的 dhcpd.conf 帖上来看看.
下面是 dhcpd.conf的内容. 需要说明的是如果我把其他的两个网段注销掉,把测试机同服务器连接到同一个交换机上是可以获取ip地址的(当然也要把 server-identifier都注销掉)
#
# Sample configuration file for ISC dhcpd for Debian
#
# $Id: dhcpd.conf,v 1.4.2.2 2002/07/10 03:50:33 peloy Exp $
#
# option definitions common to all supported networks...
option domain-name "fugue.com";
option domain-name-servers toccata.fugue.com;
option subnet-mask 255.255.255.224;
default-lease-time 600;
max-lease-time 7200;
#subnet 204.254.239.0 netmask 255.255.255.224 {
# range 204.254.239.10 204.254.239.20;
# option broadcast-address 204.254.239.31;
# option routers prelude.fugue.com;
#}
# The other subnet that shares this physical network
#subnet 204.254.239.32 netmask 255.255.255.224 {
# range dynamic-bootp 204.254.239.10 204.254.239.20;
# option broadcast-address 204.254.239.31;
# option routers snarg.fugue.com;
#}
#subnet 192.5.5.0 netmask 255.255.255.224 {
# range 192.5.5.26 192.5.5.30;
# option name-servers bb.home.vix.com, gw.home.vix.com;
# option domain-name "vix.com";
# option routers 192.5.5.1;
# option subnet-mask 255.255.255.224;
# option broadcast-address 192.5.5.31;
# default-lease-time 600;
# max-lease-time 7200;
#}
# Hosts which require special configuration options can be listed in
# host statements. If no address is specified, the address will be
# allocated dynamically (if possible), but the host-specific information
# will still come from the host declaration.
#host passacaglia {
# hardware ethernet 0:0:c0:5d:bd:95;
# filename "vmunix.passacaglia";
# server-name "toccata.fugue.com";
#}
# Fixed IP addresses can also be specified for hosts. These addresses
# should not also be listed as being available for dynamic assignment.
# Hosts for which fixed IP addresses have been specified can boot using
# BOOTP or DHCP. Hosts for which no fixed address is specified can only
# be booted with DHCP, unless there is an address range on the subnet
# to which a BOOTP client is connected which has the dynamic-bootp flag
# set.
#host fantasia {
# hardware ethernet 08:00:07:26:c0:a5;
# fixed-address fantasia.fugue.com;
#}
# If a DHCP or BOOTP client is mobile and might be connected to a variety
# of networks, more than one fixed address for that host can be specified.
# Hosts can have fixed addresses on some networks, but receive dynamically
# allocated address on other subnets; in order to support this, a host
# declaration for that client must be given which does not have a fixed
# address. If a client should get different parameters depending on
# what subnet it boots on, host declarations for each such network should
# be given. Finally, if a domain name is given for a host's fixed address
# and that domain name evaluates to more than one address, the address
# corresponding to the network to which the client is attached, if any,
# will be assigned.
#host confusia {
# hardware ethernet 02:03:04:05:06:07;
# fixed-address confusia-1.fugue.com, confusia-2.fugue.com;
# filename "vmunix.confusia";
# server-name "toccata.fugue.com";
#}
#host confusia {
# hardware ethernet 02:03:04:05:06:07;
# fixed-address confusia-3.fugue.com;
# filename "vmunix.confusia";
# server-name "snarg.fugue.com";
#}
#host confusia {
# hardware ethernet 02:03:04:05:06:07;
# filename "vmunix.confusia";
# server-name "bb.home.vix.com";
#}
#subnet 192.168.1.0 netmask 255.255.255.0 {
# range 192.168.1.2 192.168.1.30;
# option domain-name-servers 202.96.209.5;
# option domain-name "vix.com";
# option routers 192.168.1.1;
# option subnet-mask 255.255.255.0;
# option broadcast-address 192.168.1.255;
# default-lease-time 600;
# max-lease-time 7200;
#}
subnet 192.168.1.0 netmask 255.255.255.0 {
server-identifier 192.168.1.1;
range 192.168.1.2 192.168.1.100;
# option domain-name-servers ns1.internal.example.org;
# option domain-name "internal.example.org";
option routers 192.168.1.1;
option broadcast-address 192.168.1.255;
default-lease-time 600;
max-lease-time 7200;
}
subnet 192.168.2.0 netmask 255.255.255.0 {
server-identifier 192.168.2.1;
range 192.168.2.2 192.168.2.100;
# option domain-name-servers ns1.internal.example.org;
# option domain-name "internal.example.org";
option routers 192.168.2.1;
# option server-identifier 192.168.2.1
option broadcast-address 192.168.2.255;
default-lease-time 600;
max-lease-time 7200;
}
subnet 192.168.3.0 netmask 255.255.255.0 {
server-identifier 192.168.3.1;
range 192.168.3.2 192.168.3.100;
# option domain-name-servers ns1.internal.example.org;
# option domain-name "internal.example.org";
option routers 192.168.3.1;
# option server-identifier 192.168.3.1
option broadcast-address 192.168.3.255;
default-lease-time 600;
max-lease-time 7200;
}
怎么你前面和后面的 netmask 不一样呢?
不如这样, 你先就做个网段的. 然后也不用那个 router 做 agent. 成了之后再用 router 做 agent 试试. 成了之后再加别的网段试试.
我这没有环境, 没法试.
其实我在上一篇帖子已经说过了.我注销两个网段,只用一个网段,然后把服务器和测试机连在同一个交换机上,也不要路由器,是可以获取ip 地址的.还有开头的 netmask是全局的,由于我在subnet中重新定义了netmask,并且单独一个网段是可行的 所以我也没去注销它. 说来很奇怪 这个实验我最初是在windows 2003上做的,也是不能真确分配ip地址,后来我参考网上linux配置看到了server-identifier选项,我就在 win2003 找有关选项,发现一个指定客护断交换机的选项,我把agent ip 地址输入就行了.好了,现在linux反而不行 真是让我哭笑不得
要不你试试给 linux 也来个 trunk 吧. 用 802.1q 封装, 然后一台 linux 就在好几个 vlan 里了.
switch 上启用 dhcp-relay
linux 上启用 802.1q
使 linux 可以根据 802.1q 里面的 tag 分配不同的 IP 地址
当然,事先要 vconfig 一些 VLAN 地址出来
switch 也支持 dhcp relay 了?