Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3436625
  • 博文数量: 349
  • 博客积分: 5771
  • 博客等级: 大校
  • 技术积分: 4193
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-06 11:52
个人简介

it

文章分类

全部博文(349)

文章存档

2019年(2)

2018年(2)

2017年(1)

2016年(2)

2015年(18)

2014年(36)

2013年(69)

2012年(100)

2011年(62)

2010年(57)

分类: 系统运维

2012-06-15 09:59:53

机房的核心交换机S9303上划分了多个VLAN,这些VLAN需要使用DHCP自动获取IP地址。

如何使用一个DHCP服务器给多个VLAN分配IP,网上有不少资料,但是有一些设置比较繁琐,比如需要做trunk到DHCP服务器,然后DHCP服务器的网卡,需要创建多个VLAN子网卡。经过测试,下面是一个方便简化的方法:

1、华为S9303上的设置

设置到DHCP服务器的接口,其中vlan100是dhcp所在vlan

interface Vlanif100 description TO DHCP Server ip address 172.16.255.2 255.255.255.252 interface GigabitEthernet2/1/23 description to DHCP Server port hybrid pvid vlan 100 port hybrid untagged vlan 100

打开 DHCP relay

dhcp server group dhcp-srv dhcp-server 172.16.255.1 0 dhcp enable

然后在每一个需要做dhcp的vlan里加入:

interface Vlanif90 description office ip address 192.168.29.1 255.255.255.0 dhcp select relay dhcp relay server-select dhcp-srv

2、设置 dhcp 服务器

dhcp服务器采用ubuntu,单网卡,配置一个IP:

vi /etc/network/interfaces auto eth0 iface eth0 inet static address 172.16.255.1 netmask 255.255.255.252

dhcp的配置文件,注意

采用 shared-network 包含多个subnet,所有需要获取地址的vlan,都要单独一个 subnet
网卡所在地址段172.16.255.0,也必须配置一个空的 subnet,否则无法启动

shared-network pubyun { next-server 192.168.29.2; filename "/pxelinux.0"; # 必须有,否则无法启动 subnet 172.16.255.0 netmask 255.255.255.0 { } #每个 vlan 一个 subnet subnet 172.16.0.0 netmask 255.255.255.0 { option routers 172.16.0.1; range 172.16.0.200 172.16.0.240; } subnet 192.168.29.0 netmask 255.255.255.0 { option routers 192.168.29.1; range 192.168.29.128 192.168.29.199; } }
阅读(4103) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~