欢迎来到天天文库
浏览记录
ID:55737280
大小:27.00 KB
页数:5页
时间:2020-06-03
《周见资料DHCP,单个网卡,多个网段.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、DHCP,单个网卡,多个网段如果你的DHCP服务只监听一个网卡,这个网卡绑定多个IP,比如192.168.0.1,192.168.1.1而想要DHCP同时可以分配2个网段的IP请求,像下面这样的配置(dhcpd.conf)subnet192.168.0.0netmask255.255.255.0{ range192.168.0.100192.168.0.200; optionrouters192.168.0.1; optiondomain-name-servers192.168.2.1,202.
2、112.31.58;}subnet192.168.1.0netmask255.255.255.0{ range192.168.1.100192.168.2.200; optionrouters192.168.1.1; optiondomain-name-servers192.168.2.1,202.112.31.58;}DHCP服务是启动不起来的,会提示Interfaceeth0matchesmultiplesharednetworks此时只要把上面的配置放到shared-network中就行了
3、,像下面这样:shared-networknetwork_tag{ ...}一般情况下,单网卡DHCP服务器分配多网段主要用于VLAN场合,当然DHCP服务器本生也要能支持VLAN,linux内核已经对802.1q支持了,只需要下载vconfig软件包进行配置下就行了,具体就不说了,网上很多关于这样的帖子。下面是一个典型的应用例子:ClientAreaA-----Switch-----VLAN1-----------,ClientAreaB-----Switch-----VLAN2--------Sw
4、itch----Trunk---DHCPServer ClientAreaC-----Switch-----VLAN3-----------'DHCP服务器在分配IP时,会根据DHCP请求数据包中VLAN的标识来决定分配哪个网段的IP,这样可以保证同一VLAN的用户分配的IP始终是同一网段的,当然交换机必须得支持VLAN和DHCPrelay功能我的配置文件(Ubuntu下)1:/etc/network/interfaceautoeth0ifaceeth0i
5、netstaticaddress192.168.0.1netmask255.255.255.0network192.168.0.0broadcast192.168.0.255gateway192.168.0.254autoeth0:0ifaceeth0:0inetstaticaddress192.168.1.1netmask255.255.255.0network192.168.0.0broadcast192.168.0.255gateway192.168.1.2542:/etc/dhcpd.conf
6、default-lease-time 21600;max-lease-time 21600;optiondomain-name-servers222.92.109.230,61.177.7.1,61.147.37.1;optiondomain-name "glfsoft.com";shared-networknetwork_tag{subnet192.168.0.0netmask255.255.255.0{# range192.168.0.21192.168.0.31; optionbr
7、oadcast-address192.168.0.255; optionsubnet-mask255.255.255.0; optionrouters192.168.0.254; next-server192.168.0.254; hostkook{ hardwareethernet00:1A:4B:58:36:9D; fixed-address192.168.0.9; }}subnet192.168.1.0netmask255.255.255.0{# range192.168.1.21192.
8、168.1.31; optionbroadcast-address192.168.1.255; optionsubnet-mask255.255.255.0; optionrouters192.168.1.254; next-server192.168.1.254; hostkook2{ hardwareethernet00:E0:A0:11:BE:21; fixed-address192.168.1.9; }}}测试后成功!
此文档下载收益归作者所有