Dhcp server vlan linux

ISC DHCP Server for Multiple VLANs

I need some help on this one. I am trying to implement a new DHCP server on my network, and I need it to serve up IPs to multiple VLANs. I have an Ubuntu box running ISC DHCP server, but it has a single nic, so my idea was to create multiple virtual interfaces, tag them for the appropriate VLAN and feed that through a trunked port on my main switch at the site (the switch that has all the VLANs defined).

Here is my /etc/network/interfaces file:

# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface # Management Interface auto eth0 iface eth0 inet static address 10.10.15.100 netmask 255.255.0.0 gateway 10.10.0.1 dns-nameservers 10.1.1.205, 10.1.1.213 # A Wing Student VLAN 212 auto eth0:1.212 iface eth0:1.212 inet static address 10.21.20.2 netmask 255.255.252.0 broadcast 10.21.23.255 # B Wing Student VLAN 222 auto eth0:2.222 iface eth0:2.222 inet static address 10.22.20.2 netmask 255.255.252.0 broadcast 10.22.23.255 # C Wing Student VLAN 232 auto eth0:3.232 iface eth0:3.232 inet static address 10.23.20.2 netmask 255.255.252.0 broadcast 10.23.23.255 # D Wing Student VLAN 242 auto eth0:4.242 iface eth0:4.242 inet static address 10.24.20.2 netmask 255.255.252.0 broadcast 10.24.23.255 # E Wing Student VLAN 252 auto eth0:5.252 iface eth0:5.252 inet static address 10.25.20.2 netmask 255.255.252.0 broadcast 10.25.23.255 # F Wing Student VLAN 262 auto eth0:6.262 iface eth0:6.262 inet static address 10.26.20.2 netmask 255.255.252.0 broadcast 10.26.23.255 # G Wing Student VLAN 272 auto eth0:7.272 iface eth0:7.272 inet static address 10.27.20.2 netmask 255.255.252.0 broadcast 10.27.23.255 # PAC Wing Student VLAN 282 auto eth0:8.282 iface eth0:8.282 inet static address 10.28.20.2 netmask 255.255.252.0 broadcast 10.28.23.255
# # Sample configuration file for ISC dhcpd for Debian # # Attention: If /etc/ltsp/dhcpd.conf exists, that will be used as # configuration file instead of this file. # # # The ddns-updates-style parameter controls whether or not the server will # attempt to do a DNS update when a lease is confirmed. We default to the # behavior of the version 2 packages ('none', since DHCP v2 didn't # have support for DDNS.) ddns-update-style none; # option definitions common to all supported networks. option domain-name "mpcsd.org"; option domain-name-servers 10.1.1.205, 10.1.1.213; default-lease-time 3600; max-lease-time 7200; # If this DHCP server is the official DHCP server for the local # network, the authoritative directive should be uncommented. authoritative; # Use this to send dhcp log messages to a different log file (you also # have to hack syslog.conf to complete the redirection). log-facility local7; # No service will be given on this subnet, but declaring it helps the # DHCP server to understand the network topology. # Assignment for the A Wing (VLAN 212) subnet 10.21.20.0 netmask 255.255.252.0  range 10.21.20.3 10.21.23.254; option routers 10.21.22.1; option subnet-mask 255.255.252.0; option broadcast-address 10.21.23.255; option domain-name-servers 10.1.1.205,10.1.1.213; option domain-name "mpcsd.org"; default-lease-time 3600; max-lease-time 7200; > # Assignment for the B Wing (VLAN 222) subnet 10.22.20.0 netmask 255.255.252.0  range 10.22.20.3 10.22.23.254; option routers 10.22.22.1; option subnet-mask 255.255.252.0; option broadcast-address 10.22.23.255; option domain-name-servers 10.1.1.205,10.1.1.213; option domain-name "mpcsd.org"; default-lease-time 3600; max-lease-time 7200; > # Assignment for the C Wing (VLAN 232) subnet 10.23.20.0 netmask 255.255.252.0  range 10.23.20.3 10.23.23.254; option routers 10.23.22.1; option subnet-mask 255.255.252.0; option broadcast-address 10.23.23.255; option domain-name-servers 10.1.1.205,10.1.1.213; option domain-name "mpcsd.org"; default-lease-time 3600; max-lease-time 7200; > # Assignment for the D Wing (VLAN 242) subnet 10.24.20.0 netmask 255.255.252.0  range 10.24.20.3 10.24.23.254; option routers 10.24.22.1; option subnet-mask 255.255.252.0; option broadcast-address 10.24.23.255; option domain-name-servers 10.1.1.205,10.1.1.213; option domain-name "mpcsd.org"; default-lease-time 3600; max-lease-time 7200; > # Assignment for the E Wing (VLAN 252) subnet 10.25.20.0 netmask 255.255.252.0  range 10.25.20.3 10.25.23.254; option routers 10.25.22.1; option subnet-mask 255.255.252.0; option broadcast-address 10.25.23.255; option domain-name-servers 10.1.1.205,10.1.1.213; option domain-name "mpcsd.org"; default-lease-time 3600; max-lease-time 7200; > # Assignment for the F Wing (VLAN 262) subnet 10.26.20.0 netmask 255.255.252.0  range 10.26.20.3 10.26.23.254; option routers 10.26.22.1; option subnet-mask 255.255.252.0; option broadcast-address 10.26.23.255; option domain-name-servers 10.1.1.205,10.1.1.213; option domain-name "mpcsd.org"; default-lease-time 3600; max-lease-time 7200; > # Assignment for the G Wing (VLAN 272) subnet 10.27.20.0 netmask 255.255.252.0  range 10.27.20.3 10.27.23.254; option routers 10.27.22.1; option subnet-mask 255.255.252.0; option broadcast-address 10.27.23.255; option domain-name-servers 10.1.1.205,10.1.1.213; option domain-name "mpcsd.org"; default-lease-time 3600; max-lease-time 7200; > # Assignment for the PAC (VLAN 282) subnet 10.28.20.0 netmask 255.255.252.0  range 10.28.20.3 10.28.23.254; option routers 10.28.22.1; option subnet-mask 255.255.252.0; option broadcast-address 10.28.23.255; option domain-name-servers 10.1.1.205,10.1.1.213; option domain-name "mpcsd.org"; default-lease-time 3600; max-lease-time 7200; > 
# Defaults for isc-dhcp-server initscript # sourced by /etc/init.d/isc-dhcp-server # installed at /etc/default/isc-dhcp-server by the maintainer scripts # # This is a POSIX shell fragment # # Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf). #DHCPD_CONF=/etc/dhcp/dhcpd.conf # Path to dhcpd's PID file (default: /var/run/dhcpd.pid). #DHCPD_PID=/var/run/dhcpd.pid # Additional options to start dhcpd with. # Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead #OPTIONS="" # On what interfaces should the DHCP server (dhcpd) serve DHCP requests? # Separate multiple interfaces with spaces, e.g. "eth0 eth1". INTERFACES="eth0:1.212 eth0:2.222 eth0:3.232 eth0:4.242 eth0:5.252 eth0:6.262 eth0:7.272 eth0:8.282" 
interface GigabitEthernet0/xx description Link to Student DHCP Server switchport trunk encapsulation dot1q switchport mode trunk srr-queue bandwidth share 1 30 35 5 priority-queue out mls qos trust cos auto qos trust spanning-tree portfast

When I try to start the ISC DHCP server I get the error: interface eth0 matches multiple shared networks and it won’t start. Google is failing me on this, all I can seem to work out is that the issue has something to do with the VLANs.

Please help! I have 1000 devices walking onto the campu in the morning and this has to be working!

User: Jarrod Coombes

This person is a Verified Professional

JRC

Источник

Best Practices of Embedded Software Development and Testing

PC1 and PC2 are connected to Access port of VLAN switch 1 with VLAN ID 100 and 200.

The DHCP server was supposed to server both the VLAN.

1) VLAN S/W 1 will be connected to VLAN S/W 2 «trunk Port».

2) DHCP Server should be connected to VLAN S/W 2 «trunk port».

3) All trunk port should expect tagged traffic

4) PC1 and PC2 will send untagged traffic to VLAN S/W 1 , the switch will tag with respective vlan id and send to switch 2.

5) The DHCP Server should support both VLAN otherwise it will drop the packets. The DHCP Server should be configured for both VLAN.

Command to enable multiple VLAN on Linux:

ifconfig eth0 0.0.0.0

vconfig add eth0 100

ifconfig add eth0.100 10.1.1.1 netmask 255.0.0.0

vconfig add eth0 200

ifconfig add eth0.200 20.1.1.1 netmask 255.0.0.0

Command to enable DHCP

subnet 10.1.1.0 netmask 255.0.0.0 range 10.1.1.10 10.1.1.20;
option routers 10.1.1.1;
option broadcast-address 10.1.1.255;
>

subnet 20.1.1.0 netmask 255.0.0.0
range 20.1.1.10 10.1.1.20;
option routers 20.1.1.1;
option broadcast-address 20.1.1.255;
>

6) Now make PC1 and PC2 as DHCP client

Both should be able to get IP address from DHCP server in their respective VLAN.

Источник

Thread: DHCP Server for multiple Vlan’s

KLStringer is offlineFrothy Coffee!

DHCP Server for multiple Vlan’s

I’m working on setting up a Ubuntu DHCP server as part of a network restructuring. I’ve read a couple guides:

on how to set up the initial configuration.

The network that I’m setting up will have:

Vlan 3 IP Address 192.168.3.1 /24 Gateway 192.168.3.1
Vlan 4 IP Address 192.168.4.1 /24 Gateway 192.168.4.1
Vlan 5 IP Address 192.168.5.1 /24 Gateway 192.168.5.1
Vlan 6 IP Address 192.168.6.1 /24 Gateway 192.168.6.1
Vlan 7 IP Address 192.168.7.1 /24 Gateway 192.168.7.1
Vlan 8 IP Address 192.168.8.1 /24 Gateway 192.168.8.1

The server will be static on 192.168.4.187
The domain is Cars.local

How do I edit the cfg file to reflect the above?

Thanks in advance for any help its much appreciated.

DGortze380 is offlineTall Caf� Ubuntu

Join Date Sep 2007 Location Masschusetts Beans 1,510 —> Beans 1,510 Distro Ubuntu 9.04 Jaunty Jackalope

Re: DHCP Server for multiple Vlan’s

I think you’ll need a valid IP on each VLAN. Remember VLANS break up broadcast domains, so a broadcast packet from 192.168.(3,5-8 ).x won’t make it to the 192.168.4.x subnet.

It looks like there are some tricks you can play with Unicast to get around this (http://tcpmag.com/qanda/article.asp?editorialsid=285).

But the simplest solution would be to set up multiple Virtual Interfaces on the DHCP Server (Virtual instead of Physical due to the large number of VLANS you want).

Registered Linux User: 482377
MacBook (1,1) — OS X Leopard
ASUS P5LD2 — Core 2 Duo 3.0GHz — 2GB Corsair RAM — Nvidia 8800GT — Ubuntu 9.04 / Windows 7 Professional

KLStringer is offlineFrothy Coffee!

Re: DHCP Server for multiple Vlan’s

So far I’ve edited /etc/default/dhcp3-server to listen on eth1 instead of on eth0,

# VLAN 3 TEST CONFIG
subnet 192.168.3.0 netmask 255.255.255.0 range 192.168.3.2 192.168.3.254;
option routers 192.168.3.1;
option broadcast-address 192.168.3.255;
>

# VLAN 6 TEST CONFIG
subnet 192.168.6.0 netmask 255.255.255.0 range 192.168.6.2 192.168.6.254;
option routers 192.168.6.1;
option broadcast-address 192.168.6.255;
>

and added a static address the eth1:
auto eth1
iface eth1 inet static
address 192.168.4.187
netmask 255.255.255.0
broadcast 192.168.4.255
gateway 192.168.4.1

With all the above when I do ipconfig /renew it times out.

KLStringer is offlineFrothy Coffee!

Re: DHCP Server for multiple Vlan’s

QuoteOriginally Posted by DGortze380 View Post

I think you’ll need a valid IP on each VLAN. Remember VLANS break up broadcast domains, so a broadcast packet from 192.168.(3,5-8 ).x won’t make it to the 192.168.4.x subnet.

It looks like there are some tricks you can play with Unicast to get around this (http://tcpmag.com/qanda/article.asp?editorialsid=285).

But the simplest solution would be to set up multiple Virtual Interfaces on the DHCP Server (Virtual instead of Physical due to the large number of VLANS you want).

KLStringer is offlineFrothy Coffee!

Re: DHCP Server for multiple Vlan’s

I’ve done more troubleshooting and have found out that from the Ubuntu DHCP server I can’t ping out to the 192.168.4.1 gateway, from a test PC I can ping to the 192.168.4.1 gateway so I’m thinking something on the server itself hasn’t been correctly configured.

Currently I’m using both NIC cards eth0 is connected to vis dhcp to the 192.168.1.0 /24 network and eth1 is static at 192.18.1.187 on the 192.168.4.0 /24 and set to listen for dhcp requests. My next step is going to be disconnecting eth0 from the 192.168.1.0 /24 network and trying the set up again to see if I can ping out to the 192.168.4.1 gateway.

Onwards and upwards, there’s no turning back now our destiny is to be completely windows free going into the new year. We have a deadline of September to have the backend up and working, as said any and all help is appreciated.

Источник

Читайте также:  Astra linux установить 32 битный загрузчик
Оцените статью
Adblock
detector