PDA

View Full Version : can i assign static ip's based on mac addresses?



mrmachine
12th November 2005, 07:57 PM
i've got a pppoe connection on the internal ethernet. the modem is connected to my switch. i have enabled internet sharing on the same internet ethernet interface. that's all working fine (to my surprise), but i'd like to be able to assign machines on my lan a static ip based on their mac address. is it possible to configure this on the mac with internet sharing? or do i have to set the static ip address on the client machine? i'd rather leave them on dhcp so they can connect to other networks when they go elsewhere.

also, since enabling internet sharing, my terminal prompt has changed from "newton" (the name of my computer) to "l196156" (the host part of my pppoe connection in dns). how can i set it back to "newton"?

Currawong
12th November 2005, 08:18 PM
Here's the trick: you can set, in network preferences, different preferences for different locations. When the machines go elsewhere, you just change via the menu which location you are at. That'll save you having to manually change all the settings each time.

The answer, though, to your actual question is "not without a commercial server".

mrmachine
12th November 2005, 08:25 PM
that's a trick on the client. i don't wanna set anything on the client. it's annoying having to maintain configurations on multiple machines :) but i guess this is ok. i don't really need static ip's on the lan clients, as long as i can still refer to them by their name for windows file sharing etc.

mac_man_luke
12th November 2005, 10:34 PM
If you dig into mac os x underbelly im sure its possible with the power of open source

geektechnu
13th November 2005, 08:08 AM
You want a feature called "Static Maps", which is built into OS X Server.
I'm pretty sure this functionality isn't built into regular OS X.

You could try something like dnsmasq (http://thekelleys.org.uk/dnsmasq/doc.html), which is a DNS server that supports static DHCP leases.

You might also be able to find certain hardware routers that can do this natively.

Squozen
13th November 2005, 09:01 AM
Try this:

http://www.faisal.com/software/DHCP-3.0.readme.html

It's fairly trivial to set up a DHCP server on Linux, and I doubt that much differs on a BSD variant like OS X.

bljpoad
13th November 2005, 09:30 AM
Originally posted by mrmachine@Nov 12 2005, 07:57 PM
also, since enabling internet sharing, my terminal prompt has changed from "newton" (the name of my computer) to "l196156" (the host part of my pppoe connection in dns). how can i set it back to "newton"?
You should be able to set your terminal prompt using the PS1="variables go here" command. Some of the variables you could use are:
\w current working dir
\h short host name
\u your username
\$ A $ if you are not root, otherwise you get a #

any changes you make will only be effective in that terminal session, so you will want to edit (or create if you don't have one) a file called ".profile" and add the line

PS1="\h:\w \u \$ " (for example, this should give you back the original terminal prompt)

If your hostname has changed then you will want to edit /etc/hostconfig and add a line saying HOSTNAME=newton.local or if you don't want to set that back then you could use
PS1="newton:\w \u \$"

bljpoad
13th November 2005, 09:37 AM
oops, forgot that you can change the hostname in system preferences too, under sharing! Much easier! :lol:

mrmachine
13th November 2005, 06:17 PM
thanks bljpoad. i'm familiar with all of that. i have already set my prompt to include \h, which is why it changed in the first place. the host is still set correctly in sharing, but \h takes the en0 interface's host which comes from a reverse dns lookup on the ip assigned by my isp. i fixed the problem with:

sudo hostname newton