I don't want my DHCP to be a default gateway

5

1

I have a device which runs a DHCP server. When I connect it with USB to my computer, the PC gets an IP address and the device becomes the default gateway. I just want the device to agree on IP addresses and not default gateway. Is this possible?

I was using udhcpd but I got problems with authoritative mode so I switched to dnsmasq.

The PC is already connected to another network witch should contain the default gateway.

EDIT :

Here is a little diagram of how it is setup

[ Embedded Network #1 ] ----- [ PC ] ----- [ Corporate Network #2 ]

What is important here is that Net#1 has no knowledge of Net#2, its dhcp server and its default gateway

EDIT 2 :

Ok, the parameter in /etc/dnsmasq.conf should be about dhcp-option=3
If I don't specify this parameter well, there is no effect. According to this example config.

# Disable default gateway
#dhcp-option=3

This does not disable the gateway, this has no effect

EDIT 3 :

ok dhcp-option=3 DOES have an effect (Silly me). However just renewing ip is not enough for windows xp to forget about the old one

user1190

Posted 2011-07-04T13:43:48.083

Reputation: 569

Although being a little late, just for the reference, you can use ipconfig /release followed by a ipconfig /renew to make Windows forget about the old settings. – buergi – 2015-02-23T18:15:56.363

May I ask what did you do for Windows to forget about the old one? – sayap – 2012-09-14T04:14:14.803

Answers

4

Certainly possible - just reconfigure the device to not hand out a gateway over DHCP.

You probably need to provide more information to get a useful response.

add to the conf file

dhcp-option=3
dhcp-option=6

3 disables default router (gateway) and 6 disables DNS

MikeyB

Posted 2011-07-04T13:43:48.083

Reputation: 1 232

What kind of information? – user1190 – 2011-07-04T13:54:13.393

What's the device? Can you reconfig dhcp on it? Or is this enough? – MikeyB – 2011-07-04T13:55:37.810

It is a custom embedded device which runs linux. I can cross compile a lot of stuff for ARM for it. I can of course edit configs – user1190 – 2011-07-04T14:06:14.787

You need to change DHCP option 3 (Router) to point to your router. DHCP is often handled by the router, so is is usually to have the DHCP configuration to default the router setting to its address. – BillThor – 2011-07-04T14:10:01.350

Bill, I edited my question. The device network does not know the other network – user1190 – 2011-07-04T14:16:07.617

Just disable the option that provides a default gateway to the dhcp client. – wolfgangsz – 2011-07-04T14:46:55.783

Wolfie, there is no such options. It is done by default with dnsmasq. I want the option NOT to give one – user1190 – 2011-07-04T14:51:15.827

1

I'm not sure if dnsmasq will operate the way you want. I use isc-dhcp-server and although it's not the most lightweight DHCP server, if you leave out the option routers stanza, it won't hand out any information for the default gateway. I used to use udhcpd as well until I needed DHCP reservations.

You also might try configuring dnsmasq to hand out whatever IP your current default gateway as its default gateway as @BillThor suggested, or see what happens when you hand out 0.0.0.0

LawrenceC

Posted 2011-07-04T13:43:48.083

Reputation: 63 487

0.0.0.0 signals configuration error. My device's default gateway is itself. Not totally sure about what this means... – user1190 – 2011-07-04T17:43:38.523