1

I hope I will get help here.

I need to configure an Ubuntu dhcp server (12.10), the server has 2 network cards.

What I need to do is to configure the server as DHCP to give clients IP-Addresses (need at least 8000 IPs, it's for free wifi service).

What is the best config to accomplish the following please:

I need to connect the server to one of our vlans, this vlan should provide internet access to the connected clients (network: 10.0.19.0 / 24 , gateway 10.0.19.5 , dns 192.168.xx.xx).

On the other side,I need to create an IP-Pool / Range for about 8000 IP-Addresses (eg. 172.20.0.0 /16).

What is the best option to do this? the clients who gets IP-Address from this range (172.200.0) must have access to the internet by using the Vlan above (10.0.19.0).

Could someone guide me and help to do this. It's really very important.

Many thanks

Madona33

2 Answers2

2

Let's start. First you have to install dhcp server.

sudo apt-get install isc-dhcp-server

There are two main files /etc/default/isc-dhcp-server and /etc/dhcp/dhcpd.conf which we will need to configure so lets take the first.

Configuration of DHCP server

First you need to configure /etc/default/isc-dhcp-server file so you need to edit the file using the following command

sudo nano /etc/default/isc-dhcp-server

You should see similar to the following

#Defaults for dhcp initscript
#sourced by /etc/init.d/dhcp
#installed at /etc/default/isc-dhcp-server by the maintainer scripts
#
#This is a POSIX shell fragment
#
#On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
#Separate multiple interfaces with spaces, e.g. “eth0 eth1?.
INTERFACES=”eth0?

Replace eth0 above with the name of your network interface that you want the server to lease addresses on. Save and exit the file

Now you need to configure /etc/dhcp/dhcpd.conf file for this edit this file using the following command

sudo nano /etc/dhcp/dhcpd.conf

Minimal conf is:

 # minimal sample /etc/dhcp/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;

subnet 172.20.0.0 netmask 255.255.0.0 {
 range 172.20.0.1 172.20.255.252;
 option routers 172.20.255.254;
 option domain-name-servers 192.168.x.x, 192.168.x.x;
 option domain-name "mydomain.example";
} 

Finally you have to restart the dhcp service by using the following command

sudo service isc-dhcp-server restart

You can check if your dhcp server is working properly bt running the following command

sudo netstat -uap

After this action you must forward traffic from one nic to other

Enable IP forwarding

echo 1 > /proc/sys/net/ipv4/ip_forward

Configure iptables

sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT

Change eth0 and eth1 with your interfaces.

2707974
  • 10,553
  • 6
  • 33
  • 45
  • Many thanks for that, will try it tomorrow and let you know(I was not at work today). Many thanks again, you are a star. Madona33 – madona33 May 06 '14 at 21:05
0

Many thanks for everything, it works fine now, but why can't I ping from one network card to the other, I mean I can't ping eth1 (172.20.x.x)from the 10.0.19.0 network and can't also ping eth0 (10.0.19.0) from network 172.20.0.0.

Many thanks a gain

Madona33