Answering to a single DHCP request from command line (for temp device configuration)?
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Answering to a single DHCP request from command line (for temp device configuration)?
I'm often configuring different devices. For that I have two Ethernet interfaces in my Ubuntu pc. Eth0 interface uses dhcp to receive IP for public network, and eth1 interface is configured manually to match network settings of the device to be configured.
However some of devices which I have to configure are requesting address by dhcp. Is there way to not run dhcp server for them, but just issue single IP temporarily for the configuration process. And of course it should not mess up my normal routing table.
Ideally I'm looking something like
./give_ip 10.1.1.17 -i eth1
Probably some dhcp servers programs could do this, but mayby I have not found the correct search terms yet.
The dhcp interchange is quite complicated.
If you use a dhcp server you can assign IPs to the boxes that log in. Way to go. The dhcp process is not trivial.
The dhcp interchange is quite complicated.
If you use a dhcp server you can assign IPs to the boxes that log in. Way to go. The dhcp process is not trivial.
Thank you for suggestion. I have used dhcp server for that, but I do not want to run dhcp server by default as it can interfere with other things. One thing is that the interface gets it's IP range changed quite often.
Solution could be any dhcp server software, which can be instructed to issue single IP address to selected interface. I assume that one of the servers must have sufficient command line options and I just have not found it yet.
Even a cable/dns router allows you to assign fixed IP addresses to certain hosts based on their MAC address. I do this at home, using a Linksys wireless router. This enables me to maintain a constant /etc/hosts file.
You can configure your first interface to use DHCP and the second manually. The Ubuntu host won't request an address from DHCP if you don't configure it to.
Also, most routers have a range where they assign addresses. By default a Linksys router will start at at .100 for the last octet. Assign your manual IPs from .2 to .99 and you won't have any conflicts.
If you have DHCP Linux server then try to bind the MAC address of a particular system to a fixed IP like given below:
This requires me to edit configuration file for each client device and restart the service. Point is that I have a large number of devices that I have randomly play around. Devices are connected one by one directly to eth1, so from my point of view simply approach would be to give selected ip to next client requesting one.
Entering data to configuration file is something that I can do, but I was wishing that I control everything directly from a command line tool.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.