setting static ip
I need help setting up a static ip for my linux workstation. I have all the necessary information to set it up but I'm having trouble with some other things.
1. I'll need to stop dhcp(client) from running when the machine starts up. How can I disable dhcp? I'm under the impression that some file will contain this info.
2. It's been brought to my attention that the following files are manipulated when we deal with networking: /etc/network/interface, /etc/resolve.conf, and /etc/hostname.
I am aware of what to edit in /etc/network/interface and /etc/hostname but I'm not sure what /etc/resolve.conf does. Can anyone tell me what the purpose of this file is?
What distro do you have?
/etc/resolv.conf - your name servers go in there
/etc/hostname - hostname for your box
As for the network config files, they varie from distro to distro.
I'm using debian linux. I know how to configure that /etc/network/interface because I read up on it but I wasn't sure about the other two files. It looks something like this
1. What exactly is a name server? I've had dhcp configure everything from installation so I don't know what that is. Also, I'm very new to networking so I don't have much idea about what this is.
# An example static IP setup: (broadcast and gateway are optional)
iface eth0 inet static
2. As for /etc/hostname, it's just the name of the workstation. That was pretty simple to figure out.
3. Do you know how I can stop the dhcp(client) from starting at boot time? As I mentioned before, I'm sure that every distro uses a file to have the programs when it first boots.
1 - a nameserver is a machine that snswers DNS requests, or translates www.google.com to 22.214.171.124 (google's IP address)
2 - yup
3 -if dhcp is starting on boot you must have a network device set to use dhcp, check your
/etc/sysconfig/network-scripts/ifcfg-eth0 (and maybe eth1, eth2 depending on how many NIC's you have)
(i am not certain debian uses those same filenames, but if not, man ifconfig should help
Well, thanks for your help. When I edited /etc/network/interfaces, debian actually checks that file everytime it reboots or shutdown. Therefore on the next boot, it'll know to either launch dhcp or to NOT launch it. For some reason, I always thought that there was file that specified which programs to execute upon start of the machine.
I still have a question regarding the nameserver. Do I have to have one? I'm running this machine at home for my own sake and if anything, I'd broadcast this to the network at home not to the internet. I'm thinking I can leave this alone since I don't have any servers at home or for the internet. Out of curiosity, can I run my own nameserver for the network?
By the way, what distro are you running? The example you provided didn't work at all since I don't have that directory.
I would advise you to setup a name server setup because being able to resolve hostnames does come in handle all the time :D You can run your own one. apt-get bind should install it for you. Then just
echo "nameserver 127.0.0.1" > /etc/resolv.conf
The config files that majorwoo said to change are for redhat and not debian so you won't have them anywhere.