For various reasons, I prefer to use known static addresses for the machines on
my LAN and find that NetworkManager doesn't handle static addresses well for me.
If it works for you OR if you are running on a wireless card, you probably should
do whatever is necessary to make NetworkManager work with your setup. In a
perfect world, NetworkManager would do what everyone needs without giving it a
second thought and the devs working on it are getting much closer to perfection
... however, for my funky WDS setup, it was easier to use brute force. Furthermore,
I should have been able to get the DD-WRT firmware's DHCP server on my router to
hand out quasi-static addresses to the various MAC addresses of the interfaces
connected to my LAN but alas, I could never get this to work right ... so even
when DHCP was working properly, knowing what address was assigned to a box was
still a headache. There are better solutions than static assignments but what
can I say ... I'm old school and set-in-my-ways. And as mentioned elsewhere,
my DHCP server and #! don't play together nicely and doing without #! simply
wasn't an option.
Turning off NetworkManager and supplying static addresses really ought to only be
done in dire circumstances and ONLY to an installed system if you know what you
are doing. Making these changes while running the LiveCD is okay. They are only
temporary so you really can't do any harm ... a reboot will put you back to where
you were in the first place ... but this will break 'net connectivity (which may
already be broken) on an installed system if you aren't careful. If NetworkManager
is working for you, don't mess with it. If it isn't or you really need a static
address, the following works for me ... YMMV.
A regular user doesn't have the proper permissions to modify any of the files mentioned
below so you will need to use sudo with all the commands. If you edit the files
without the proper permissions, you won't get to write your edited file ... and that
might cause you to mutter rude things ... you have been warned.
First, make a backup copy of /etc/network/interfaces:
sudo cp /etc/network/interfaces /etc/network/interfaces.orig
I'm using absolute addressing here ... you might have used cd to get to /etc and
would use a address relative to your cwd but you already knew that, right?
Next we need to make auto eth0 static rather than dynamic. LEAVE THE LOOPBACK
STANZA AS IS ... UNSPEAKABLE THINGS WILL HAPPEN IF LOOPBACK IS LEFT NON-FUNCTIONAL.
Here is what my /etc/network/interfaces looks like:
iface lo inet loopback
iface eth0 inet static
Note that my network is using 192.168.1.xx ... your choice might be different,
especially if you have another infamous OS running on your net. Running my
8.10.2 LiveCD, #! tried to use 192.168.0.xx and if I wanted to use that, DHCP
might well have worked without further hassle ... if I want to change all the
other machines on my network to this subnet, the LiveCD and Installer would
have worked without problem ... but I was much too lazy to do that. At any rate,
anyplace where it says 192.168.1.xx above, make appropriate adjustments for your
system/LAN as necessary. In particular, your gateway address might be different.
Running ifconfig from a terminal emulator such as the default Terminator and making
note of that information is a good idea.
Remember also that you will need to make sure that your DHCP server isn't trying
to dynamically assign the static address that you used above. How to make sure
your DHCP server allows your to reserve static addresses is beyond the scope of
this article and would vary for each installation so if you don't know how to do
this, you should perhaps find a way to get DHCP/NM working for you.
Next you might have to do something about DNS resolution. In my case, I have a
caching nameserver at 192.168.1.14 ... and that address was also messed up so
name resolution wasn't working with the LiveCD or Installer ... both were
convinced I should be on a 192.168.0.xx network and wouldn't look past that to
get at the other nameservers that were listed. I expect that without a nameserver
on the LAN, resolv.conf as supplied by DHCP/NetworkManager would have been correct
and name resolution would have worked once the above changes in /etc/network/interfaces
were made and the network restarted. Alas, things were messed up here for me so
I had to resort to making manual changes ... your /etc/resolv.conf probably is
correct ... but when you restart your network, if NM is still running and since you
are now not using DHCP, it will stomp all over /etc/resolv.conf and things will
be broken again. Being clever enough to anticipate such untoward behavior, we
saved a backup of resolv.conf *before* restarting the network so we just needed
to restore it (ok, I'd been through this scenario before so I had a backup ready
... if you don't have your ISP's nameservers addresses memorized as I do, you
will regret not making the backup before the restart we'll do a bit later).
Just for grins, we'll do a
sudo cp /etc/resolv.conf /etc/resolv.conf.orig
to prevent saying things at a later stage that shouldn't be heard by small
children that might possibly be laying about.
Just in case things went pear-shaped at some previous point and you really do
need to generate your own resolver, here is what mine looks like. Yours will
more or less fit this template but would contain real addresses in place of
all the x's and y's and perhaps you need to search elsewhere too. NetworkManager
most likely did give you a proper resolv.conf so other than making a backup for
disaster recovery, you might not need to concern yourself with this.
nameserver 192.168.1.14 #this is my local caching nameserver
nameserver xx.xx.xx.xx #this is supplied by my ISP as the primary nameserver
nameserver yy.yy.yy.yy #this is supplied by my ISP as the secondary nameserver
Now we need to shut off NetworkManager permanently:
sudo update-rc.d NetworkManager remove
You could use apt-get to then totally remove NM from your system but I don't see
any particular reason to, and doing so might yank dependencies that are need by
other things so it is prolly better to leave well enough alone.
All that is left to do now restart your network:
sudo /etc/init.d/networking restart
If all went properly, your box is now running at the static address assigned by
you. If any of the above doesn't make sense to you, remember that Google is your
friend (and since you are reading this, you have Net access working somewhere).
Enjoy the #! goodness
messing about with /etc/network/interfaces is fun (I've typed that so often in terminal, I was itching to hit tab for auto-complete.... bad mehall!)
I was doing that earlier. Was making a bridge box and securing it, then making it secure the rest of our network too.