0

I'm setting up a Linux box for a friend. She lives way out from the city and has to use dial up, but sometimes she can bring the computer into town and connect on my LAN or on someone else's LAN. She also has an NAS that does DHCP, so she can easily back up to it from this box or from her Windows laptop. Her DHCP on the NAS is using the 10.x.x.x address space, since none of her friends use that range for their LANs.

I know I can set up a route for the 10.x.x.x address space so when she dials in to the internet, her NIC will be the gateway for that subnet and the modem will act as gateway for everything else.

But I'd like to make it easy, when she brings the system in for troubleshooting or for other reasons, for her to be able to use that one NIC to access both her NAS and my LAN (or another friend's LAN).

I know I can set up a virtual network interface and give it a specific address. I also understand that I can set up a virtual interface and specify it should use DHCP to get the address.

What I would like to do is to do something like this:

eth0: DHCP, using 10.0.0.4 as DHCP server (or any in the range of 10.x.x.x) eth0:1: DHCP using any DHCP server NOT in the 10.x.x.x address range

Is that possible? I know I can order a cheap USB NIC and then use the motherboard NIC as eth0 and that would connect to the 10.x.x.x network and the USB NIC would connect to any other LAN, but I'm hoping there's a way to do this with virtual interfaces so I don't need another piece of equipment.

Is it possible to specify for a network interface the DHCP server to use or the address range the DHCP server must be in (or must not be in)?

1

The dhclient pseudo interface is what you are looking for. You will have to run two dhclient processes: one pointing at the NAS server (or the 10.x broadcast address), and one defaulting to the all-hosts broadcast address but with a reject clause for the NAS server.

However, this is a very unusual configuration, and the probability is high that it will break through fragility and lack of testing. Have you considered configuring the NAS to be available via IPv6? IPv6 and IPv4 can coexist almost independently on a single link. The host can use an address of the form fe80:...%eth0 to address the NAS machine, once you know its address, of course.

  • I had not even thought of using IPv6. I'm not sure if my friend's other computers can use that. (I know one is a rather old Linux system and I think one old one she still needs is XP - don't know if that does IPv6.) you make a good point about it being unstable, and I'd hate for that to happen when she's at home, away from all tech help! With the fragility in mind, it might be best to spend the $20 on a USB NIC for her. – Tango Feb 3 '15 at 20:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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