Link to home
Start Free TrialLog in
Avatar of Mark
Mark

asked on

configure DHCP on Linux for wireless access point and wired interface at the same time

I have a Linux server acting as a router. It has an Internet facing NIC card (eth0) and a LAN facing card (eth1). I recently added a wireless card (wlan0) as an access point which appears to work (it shows up on other wireless devices).  IP's are:

eth0 - dynamic IP from the Cable modem
eth1 - 192.168.0.1
wlan0 - 192.168.0.2

My dhcp.conf is:
authoritative;
option domain-name "alluneedizluv.local";
ddns-update-style none;

subnet 192.168.0.0 netmask 255.255.255.0 {
    option routers 192.168.0.1;
    range 192.168.0.100 192.168.0.199;
    option domain-name-servers 209.18.47.61, 209.18.47.62;
}

host rover {
  hardware ethernet 44:1E:A1:C8:E8:9B;
  fixed-address 192.168.0.102;
}

Open in new window


I want to include the wireless card for wireless clients to get DHCP addresses. Note that whether host rover connects via wire or wireless, I want it to get 192.168.0.102.

I'm not sure how to configure this. All web examples I've seen for wireless are showing either only the wireless being configured for DHCP, or two subnets with different ranges. I've not found an example for two interfaces on the same range.

I tried:

option routers 192.168.0.1 192.168.0.2;

but that gave a "semi-colon expected" configuration error.

Any ideas?
Avatar of rjanowsky
rjanowsky
Flag of Germany image

Why are you using the same class c network for wired and wireless? What about using one net for wired (192.168.0.0) and one for wireless (192.168.1.0). In that case your router/dhcp server can have two scopes, which are independent from each other. By the way the host rover has different mac addresses for the lan and the wlan card.
Avatar of Mark
Mark

ASKER

I could do separate subnets. In fact, I have set it up this way currently. Maybe what I want is not possible. I've had commercial routers (Linksys, D-Link) where I could specify a DHCP reservation for various hosts and they would get that reservation regardless of whether the host connected via wireless or wired.
Yes, you can have a reservation for one unique mac address. But in your situation you have two unique network cards and also two addresses. I don't know, if there is a DHCP server, which can assign two mac addresses for one reservation. You wrote your linux server is acting as a router. To realize different media technologies (wired & wireless), your router must bridge the two segments. The configuration with two subnets seems for me a good and usable one.
ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
hi,
please use only one router ip and you can mention range for eth0 and eth1.
again you can add wireless mac address or ip for reservation. then your dhcp server will running wel.
Avatar of Mark

ASKER

Sorry for the delay in response.

rjanowsky: > By the way the host rover has different mac addresses for the lan and the wlan card.

The host "rover" is not the one hosting the LAN/WLAN interfaces. it is a host on the LAN. So, rover should alway have the same MAC address.

> The configuration with two subnets seems for me a good and usable one.

Yes, and that is working now, currently, my subnets are:

# This subnet is for eth1, the wired LAN connection
subnet 192.168.0.0 netmask 255.255.255.128 {
    option routers 192.168.0.1;
    range 192.168.0.100 192.168.0.126;
    option domain-name-servers 209.18.47.61, 209.18.47.62;
}

# This subnet is for wlan0, the wireless LAN connetion
subnet 192.168.0.128 netmask 255.255.255.128 {
    option routers 192.168.0.129;
    range 192.168.0.130 192.168.0.254;
    option domain-name-servers 209.18.47.61, 209.18.47.62;
}

(thanks to arnold, see https://www.experts-exchange.com/questions/28162388/wireless-access-point-not-quite-working-on-Linux.html)

but I would like the host "rover" to get the same IP from the linux router whether it connects via wired or wireless. That's the goal. Right now, if I connect via wired it gets 192.168.0.102; if via wireless I get  192.168.0.136-ish.

I will check out arnold's bridge suggestion and get back with the results.
Avatar of Mark

ASKER

Have not tried this yet, but I plan on doing so this weekend.
Avatar of Mark

ASKER

I haven't actually tried this solution yet because I'm switching from Slackware to Debian. However, it does appear that arnold's link would put me on the right path. I will likely re-post when I get the Debian setup working well.