Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

My ISP gave me a really crappy router-modem-combination that lacks basic features. For instance you can't assign a constant ip to the mac adress of a client PC. I run a server for my home entertainment system and a storage server. Both should have a static ip within my LAN.

So my thought was to disable the DHCP-Server on the crappy modem and let my home entertainment server do the ip assignments. I was thinking dnsmasq, but I don't seem to get it to work. I thought maybe someone can help me

So the situation:

192.168.0.1 is the server ip in LAN, lets say its mac is aa:aa:aa:aa:aa:aa and it is connected to a switch with device eth0. Here it's /etc/network/interfaces:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
    address 192.168.0.1
    netmask 255.255.255.0
    gateway 192.168.0.2

192.168.0.2 is the ip of the cable modem (set statically). It is connected to the internet and the same switch as the server. mac: bb:bb:bb:bb:bb:bb

192,168.0.3 is supposed to be the future ip of the network storage system, lets say its mac adress is cc:cc:cc:cc:cc:cc. It is also connected to the same switch as the other devices

What I've done so far:

I've installed dnsmasq on the server, stopped the service and edited /etc/dnsmasq.conf to look like this:

interface=eth0
dhcp-range=192.168.0.10,192.168.0.254,72
dhcp-host=aa:aa:aa:aa:aa:aa,server,192.168.0.1,infinite
dhcp-host=bb:bb:bb:bb:bb:bb,cable,192.168.0.1,infinite
dhcp-host=cc:cc:cc:cc:cc:cc,storage,192.168.0.3,infinite

I've edited /etc/resolv.conf to contain the localhost (server) and the nameservers of the ISP:

nameserver 127.0.0.1
nameserver 123.321.123.321
nameserver 321.123.321.123

The Problem:

The DHCP works just fine, but for some reason dnsmasq gives the wrong gateway. It gives the server's ip instead of the gateways.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Okay, I just found out about the dhcp-option in /etc/dnsmasq.conf:

interface=eth0
dhcp-option=3,192.168.0.2
dhcp-range=192.168.0.10,192.168.0.254,72

That solves the problem. Sorry to bother you. Hope it will help someone else, at least!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.