Linux experts... DH...
 

  You don't need to be an 'investor' to invest in Singletrack: 6 days left: 95% of target - Find out more

[Closed] Linux experts... DHCP client _and_ server?

20 Posts
11 Users
0 Reactions
97 Views
Posts: 8819
Full Member
Topic starter
 

I'm re-roleing one of my Raspberry Pis to act as a wireless access point (using WPA-Supplicant), but I need the wired ethernet to act as a DHCP client whilst the wireless is acting as a DHCP server.

Is such a thing possible?


 
Posted : 09/01/2018 10:21 am
 ffej
Posts: 0
Free Member
 

Won't that mean there are two DHCP servers running on the same network? Your WAP and whatever the WAP is getting its IP address from?
My understanding is that this will cause problems.

Is there a reason why your WAP can't have its ip fixed and set outside the DHCP range?

Jeff


 
Posted : 09/01/2018 10:34 am
Posts: 0
Free Member
 

Out of touch with such things nowadays, but wouldnt it be easier to use DHCP passthrough, so wifi clients get their addresses from the dhcp server on the wired side?


 
Posted : 09/01/2018 10:37 am
Posts: 8819
Full Member
Topic starter
 

Like I said, the wired side network is not entirely trusted, so the plan was to go DHCP for that, then have the Pi act as a firewalled router on its own little network, giving DHCP to the wireless clients.

DHCP passthrough may be an option, but I have no idea how big the scope is on the other side, just that i can get one IP address.


 
Posted : 09/01/2018 10:49 am
Posts: 0
Free Member
 

Like I said, the wired side network is not entirely trusted, so the plan was to go DHCP for that, then have the Pi act as a firewalled router on its own little network, giving DHCP to the wireless clients.
DHCP passthrough may be an option, but I have no idea how big the scope is on the other side, just that i can get one IP address.

Where did you say that?

Anyway, sounds like you are trying to piggyback onto someone elses network, im out.


 
Posted : 09/01/2018 11:00 am
Posts: 91000
Free Member
 

Won't that mean there are two DHCP servers running on the same network?

No - if you are using different network adapters then they are different networks, aren't they?

Aren't you making your Pi into a router, in this situation? The wireless clients would have an extra network hop and a different subnet.. isn't this an entirely normal situation?

I'm not a network engineer mind.


 
Posted : 09/01/2018 11:03 am
Posts: 0
Free Member
 

No - if you are using different network adapters then they are different networks, aren't they?
Aren't you making your Pi into a router, in this situation? The wireless clients would have an extra network hop and a different subnet.. isn't this an entirely normal situation?
I'm not a network engineer mind.

You are correct I believe, but I cannot think of a reason why the OP would have no knowledge of the wired side of his network (unless it wasnt his network of course)


 
Posted : 09/01/2018 11:06 am
Posts: 8819
Full Member
Topic starter
 

trailwagger, you're right. I think I might have thought the bit about not entirely trusted wired networks, rather than said it. It happens a lot, sorry.

The network is in a building and is designed for just using as wired. That's great, but the socket is in a cupboard and not anywhere even remotely convenient. It would be a lot easier to connect to the network using WiFi from iPhones, iPads, etc, hence the reason for the gateway.


 
Posted : 09/01/2018 11:10 am
 Aidy
Posts: 2941
Free Member
 

Should be entirely possible, I've done similar with openbsd.


 
Posted : 09/01/2018 11:14 am
Posts: 0
Free Member
 

So you need something like this

http://www.glennklockwood.com/sysadmin-howtos/rpi-wifi-island.html

*edit* but i think you will need a static ip on the wired side for the NAT to work??


 
Posted : 09/01/2018 11:18 am
Posts: 91000
Free Member
 

I've got several old routers here you could have...?


 
Posted : 09/01/2018 11:20 am
Posts: 8819
Full Member
Topic starter
 

Routers or motors Molgrips? Dare I trust the hardware of a man with such poor luck in cars? 😀

trailwagger. That looks good. I thin that is pretty much what I am after and I might be able to get a static IP for the eth0 end of things.


 
Posted : 09/01/2018 11:23 am
Posts: 1369
Free Member
 

Doable, but something to consider is whether you are wanting to NAT the entire Pi range behind one IP address, or have the Pi route its LAN to the existing domestic router.

If its the former, should be ok. If its the latter, could be a problem, as most domestic routers dont want to know about routing to other subnets, other than the default to the gateway. Playing around with many of them, I think most of the ISP-derived ones lack the ability to add a route-statement in.


 
Posted : 09/01/2018 11:28 am
Posts: 632
Free Member
 

Why not just buy a router with an RJ45 socket for the WAN connection. I have done that a few times to isolate my LAN from everyone else using the same wired internet connection.


 
Posted : 09/01/2018 11:29 am
Posts: 8819
Full Member
Topic starter
 

I have a wireless modem/router with an RJ45 WAN socket (and a HomeHub4), but the WAN socket seems dedicated to the ISP and, in the case of the HoneHub at least, asks for nothing more than BT login details, no other config options. I have not tried the other router yet.


 
Posted : 09/01/2018 11:32 am
Posts: 1369
Free Member
 

Yeah, so the Rpi would need a different DHCP scope and LAN in that case, and the ability to do NAT overload on a single IP address. Not impossible.


 
Posted : 09/01/2018 11:37 am
Posts: 0
Full Member
 

It's possible but not worth it beyond interest - you actually probably want DHCP relaying rather than serving unless you don't trust the wired network .. in which case don't connect to it without proper precautions 🙂

What eeept said is the easiest - if you set the WAN port to DHCP you'll get a valid address from the wired side and NAT the wireless side off into a normal public class c. Probably some basic filtering on there too. I use some TP Link jobbies for similar non critical tasks


 
Posted : 09/01/2018 11:43 am
Posts: 0
Free Member
 

just buy a cheap router

They are often called cable routers and should be under £20

If you want to use the pi though I think you can install open wrt , this should work as well


 
Posted : 09/01/2018 11:26 pm
 xora
Posts: 950
Full Member
 

https://www.amazon.co.uk/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=gl.inet

These guys are what I use for similar issues, they are running OpenWRT and is everything you need out of the box for as little as £20. So its basically just choose what other features you want.


 
Posted : 10/01/2018 9:47 am
Posts: 1862
Free Member
 

You don't need a router, just a wifi access point. It will bridge and forward to the wired network for you. The RPi *can* do that but unless you're doing it as a learning exercise, just buy something from amazon.


 
Posted : 10/01/2018 10:35 am
Posts: 8819
Full Member
Topic starter
 

Cheers all. I'll have a browse of the shop and see what comes up


 
Posted : 10/01/2018 11:01 am

6 DAYS LEFT
We are currently at 95% of our target!