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.
I've got a couple of Linux machines, a Windows XP machine, and my daughter's Mac here at the house. We get our IPs from an AT&T router/gateway, and of course they're always the same IPs; except when I go experimenting with bridging etc. So, my question is: How can I address all these DHCP clients by name, so that I don't have to just go look to see what address they've gotten? Would I somehow use Windows networking to get to it? Is there some way to tell the DHCP server what my machines names are? What am I missing about a DHCP environment?
Added:
As an example of what I want, suppose I want to rsync to one of the machines. What do I type if I don't want to go take a look a the machine to see what it's address is, but I know it's name?
Last edited by Quakeboy02; 10-31-2008 at 07:15 PM.
One way to approach this could be to forget the DHCP server and just give all the boxes a secondary static IP. Then in the /etc/hosts files you put whatever names you want for the boxes like linux1.example.net, linux2.example.net, windows.example.net, mac.example.net, etc. The /etc/hosts file might look like:
Yeah, I understand that, but then I have to replicate the /etc/hosts file among all my machines, which of course is why we have DNS. I have no intention of setting up a private DNS for four machines.
Is there a way through a shell script that I could use windows networking to get an ip for a machine in a windows workgroup? example:
I'll stand back and let someone familiar with Windows networks answer that.
Regarding the OP, do you know what DHCP daemon the device runs? Knowing that can help someone tell you how to get client IDs to work with it so that your boxes always get the same hostname regardless of IP. BTW, is it giving you public or private IPs?
Regarding the OP, do you know what DHCP daemon the device runs? Knowing that can help someone tell you how to get client IDs to work with it so that your boxes always get the same hostname regardless of IP. BTW, is it giving you public or private IPs?
The device itself? No. All I know about it is that it's a 3800HGV-B. It's giving me private IPs in the 192.168.1.x subnet. Oh, and my daughter has some gaming doohickies attached, so we'd need the DHCP in any case, I think.
The device itself? No. All I know about it is that it's a 3800HGV-B. It's giving me private IPs in the 192.168.1.x subnet. Oh, and my daughter has some gaming doohickies attached, so we'd need the DHCP in any case, I think.
Does it have a DNS daemon on it? What gateway address does its DHCP give you? Is the IP it gives you for DNS servers (look in your /etc/resolv.conf) the same as the gateway address or is it like ISP nameservers? Do you have a control panel on this device?
Telling a DHCP server to always give you a certain client IP and/or hostname should be really easy (unless your ISP has restricted administration options on the device, or if it lacks them). But if the device doesn't come with a DNS daemon then you're gonna have to bind the hostname to the IPs in some other way, such as installing dnsmasq or something.
I always get the same IP unless I fool it with something I have going on here, such as turning off the wireless card and plugging into a wireless bridge. We wanted to backup some 35GB of data from my daughter's Mac and via wireless just wasn't cutting it, so I strung a wire and then tried to route through her bridge. Other things like that tend to change my IP on this machine. We don't do that stuff on the others so they're stable. I don't see any way into the device, itself. There are some maintenance items when I point firefox at it, but I don't really want to try to get into the thing.
BTW, I've got dbndns (debian vsn of djbdns) running on my Linux machines. I don't try to tell my daughter what to do on her Mac , and the XP box is just turned on to serve the printers in the other room. Oh, and the reason I don't want to run DNS is because I'd be compelled to leave one or two machines running to serve it. Not such a good limitation in a home environment.
I'll have to research how to get the IP for a samba device. Maybe there's an answer there.
Have you considered buying something like a WRT54G? I think they're like less than 40 bucks now and you can install a nice firmware GNU/Linux distro on it (Tomato, for example) which will let you handle all of this stuff for your network with great convenience. I think even the stock firmware does what you want.
I just found "nmblookup" and it kind of does what I want, but the output is noisy. Maybe I could do some awk magic on it and clean it up enough to use.
Code:
nmblookup -B -L hedgehog
returns:
Code:
querying hedgehog on 192.168.0.255
querying hedgehog on 192.168.1.255
192.168.1.69 hedgehog<00>
I just want a script that I can enter the samba machine name and get the ip address out. If the machine isn't connected or turned on, I suppose null would be appropriate. What I was thinking of was to be able to rsync without having to remember what the ip address was. Something like this:
BTW, why do you ignore so many of the questions I've asked you?
Sorry, I guess I missed a couple. Didn't mean to. If you're referring to the WRT54G, I started to answer that, but then got sidetracked and never got back to it. I've got a WGT624 here, and I'm waiting for OpenWGT to get around to it.
BTW, I now see that you posted the answer already, but I just didn't see it on the page. Did I forget to scroll down? Dang. Sorry about that.
Sweet! I'll have to figure out whether I need to do something different for hosts that aren't there or are typed wrong. But, it gives "name_query" in those cases, so that'll probably work well enough.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.