LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-27-2010, 02:19 AM   #1
jo2
LQ Newbie
 
Registered: Dec 2008
Location: Finland
Distribution: Ubuntu, OpenWrt
Posts: 5

Rep: Reputation: 0
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.

All the help is appreciated. Thanks, Jo2
 
Old 10-27-2010, 02:40 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,297

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
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.
 
Old 10-27-2010, 02:55 AM   #3
jo2
LQ Newbie
 
Registered: Dec 2008
Location: Finland
Distribution: Ubuntu, OpenWrt
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by business_kid View Post
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.
 
Old 10-27-2010, 03:23 AM   #4
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: RHEL/Ubuntu/Debian/Fedora/Centos/K3OS
Posts: 1,159
Blog Entries: 4

Rep: Reputation: 149Reputation: 149
HI,

If you have DHCP Linux server then try to bind the MAC address of a particular system to a fixed IP like given below:

Quote:
host ns2 {
next-server ns2.your-domain.com;
hardware ethernet 00:02:c3:d0:e5:83;
fixed-address 192.168.10.100;
}
 
Old 10-27-2010, 03:55 AM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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.

Last edited by jschiwal; 10-27-2010 at 04:00 AM.
 
Old 10-27-2010, 06:47 AM   #6
jo2
LQ Newbie
 
Registered: Dec 2008
Location: Finland
Distribution: Ubuntu, OpenWrt
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by prayag_pjs View Post
HI,

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.

Thank you for your input!
 
Old 10-27-2010, 06:54 AM   #7
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: RHEL/Ubuntu/Debian/Fedora/Centos/K3OS
Posts: 1,159
Blog Entries: 4

Rep: Reputation: 149Reputation: 149
Hi,

Generally DHCP server is only one in single network.So you have to edit only server.I don't get the exact problem you are facing.
 
  


Reply

Tags
command line, dhcpd



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a single command to list all hardware installed (command line)? davee Linux - Hardware 6 02-28-2009 07:19 PM
Help me in Grep Command + cd command in single line JeiPrakash Linux - Newbie 3 05-27-2008 04:16 AM
a single command the spans more then 1 line bourne Programming 4 11-27-2007 05:50 AM
Command line screenshot of a single window Hko Programming 1 12-02-2005 09:21 AM
how to request a new ip from the command line? dr_zayus69 Linux - Networking 2 10-22-2005 01:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration