LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 11-07-2004, 10:55 AM   #1
bobbens
Member
 
Registered: Sep 2004
Location: Barcelona
Distribution: Debian, FreeBSD, Gentoo
Posts: 586

Rep: Reputation: 30
ip based network from DHCP?


How would i set two boxes static IP addresses instead of using DHCP (with DHCP already installed)? I've tried looking in the internet for something but havent found what i needed, and since the linuxquestions.org search is down i have no choice but to post. thanks
 
Old 11-07-2004, 10:59 AM   #2
masand
LQ Guru
 
Registered: May 2003
Location: INDIA
Distribution: Ubuntu, Solaris,CentOS
Posts: 5,522

Rep: Reputation: 69
hi there

try this
[root@gaurav root]# ifconfig eth0 192.168.0.20/24
to set the ip address 192.168.0.20

or edit
[root@gaurav root]# vi /etc/sysconfig/network-scripts/ifcfg-eth0

and out the entry as
-----------
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.0.2
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
------------

regards
 
Old 11-07-2004, 11:02 AM   #3
zaicheke
Member
 
Registered: Apr 2004
Distribution: Slackware 10, Open BSD 3.6, Mac OS 10.3.7, Splack 10 beta
Posts: 393

Rep: Reputation: 30
in /etc/network there are several config file. In one of the config files there should be a line that says DHCP NONE NONE NONE, or something similar. Look in the man pages and it should tell you what to change it to.

I'm very sorry for the vague response. I don't have a debian box at the moment and i'm relying on memory.

Last edited by zaicheke; 11-07-2004 at 11:03 AM.
 
Old 11-07-2004, 01:37 PM   #4
bobbens
Member
 
Registered: Sep 2004
Location: Barcelona
Distribution: Debian, FreeBSD, Gentoo
Posts: 586

Original Poster
Rep: Reputation: 30
That doesnt work, but i suppose that's because i have my router set with DHCP active. Or is static IP address compatible with DHCP? Dunno i have my DHCP IP lease time set to Forever, but that doesnt really seem to do anything. If i deactivate DHCP on my router would the computers automatically get assigned a static IP or would i have to manually edit them all?
I really have no clue about networking...
 
Old 11-07-2004, 02:12 PM   #5
masand
LQ Guru
 
Registered: May 2003
Location: INDIA
Distribution: Ubuntu, Solaris,CentOS
Posts: 5,522

Rep: Reputation: 69
hi there

u need to do one thing
either set ur systems for static ip adress or dynamic(DHCP) ones
u can change the configuration while the system is running and do
service network restart
that will take in effect the new settings
if ur systems do not get a dhcp adress from ur router then ur NIC will not start
u can edit that later and do the
service network restart

regards
 
Old 11-08-2004, 12:48 AM   #6
cryptwizard
Member
 
Registered: Aug 2004
Location: Sydney, Australia
Distribution: Debian Squeeze
Posts: 49

Rep: Reputation: 15
A bit of theory.

If your router has DHCP enabled, it is not garuntee that all computers (or routers) on the network will get a DHCP assigned IP.
If you wish to have a statically, DHCP does not need to be turned off or anything.
When you run dhclient it send a request to the DHCP server for a IP address. If no DHCP server is present it will fail.

Simply issue a "ifconfig eth0 netmask 192.168.0.1" subsituting the IP address for a static IP, however, you will need to do that each time you start up.
I don't know about config files and all that.
 
Old 11-08-2004, 12:57 AM   #7
rabeea
Member
 
Registered: Aug 2004
Location: Pakistan
Posts: 52

Rep: Reputation: 15
hi there,

What cryptwizard suggested was right but u will have to do it everytime u reboot ur system , so its better to either wirite this command in rc.local or otherwise u can configure a DHCp server on ur machine which assigns a static ip to ur machine everytime u boot. For this reason u have to look at the man page of dhcp or search the net for dhcp configuration. I hope it wil help.
thnx
 
Old 11-08-2004, 01:18 AM   #8
bobbens
Member
 
Registered: Sep 2004
Location: Barcelona
Distribution: Debian, FreeBSD, Gentoo
Posts: 586

Original Poster
Rep: Reputation: 30
I tried "ifconfig eth1 192.168.2.9" but it didnt work. But ill look around, thanks for your insight.
 
Old 11-08-2004, 01:24 AM   #9
rabeea
Member
 
Registered: Aug 2004
Location: Pakistan
Posts: 52

Rep: Reputation: 15
just check writing ifconfig whether ur network card is installed or not.
Hey tell me one thing u have two boxes then u will use eth0 for both the boxes not eth1
On the other hand if u have two ethernet cards installed on one system try using
ifconfig eth0:1 ipaddress netmask
thnx
 
Old 11-08-2004, 01:43 AM   #10
bobbens
Member
 
Registered: Sep 2004
Location: Barcelona
Distribution: Debian, FreeBSD, Gentoo
Posts: 586

Original Poster
Rep: Reputation: 30
Here's my ifconfig:

Code:
eth1      Link encap:Ethernet  HWaddr 00:60:B0:3C:33:79
          inet addr:192.168.2.4  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::260:b0ff:fe3c:3379/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:23072 errors:0 dropped:0 overruns:0 frame:0
          TX packets:28753 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:11382562 (10.8 MiB)  TX bytes:21610969 (20.6 MiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:355 errors:0 dropped:0 overruns:0 frame:0
          TX packets:355 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:25254 (24.6 KiB)  TX bytes:25254 (24.6 KiB)
The setup is i have two computers, one which has no mouse, keyboard or screen, so i have to connect to it with SSH. On boot up i want to automatically mount some folders using NFS, but it wont do that if everytime i boot them up i get diferent IP address's so i have to manually mount them. I want to be able to mount the files automaticallly. My main box (with screen, keyboard and mouse) has an onboard ethernet controller and an add-on card. The onboard is the nForce2 chipset that i usually have to manually install so i added an S82557 card which always works. After that i have set up my nForce2 chipset, but since i dont use it, i am using my eth1 which is the card. All i want to do is have these two debian boxes get static IP address's and all the other computers which log on to use DHCP. Thanks
 
Old 11-08-2004, 02:12 AM   #11
rabeea
Member
 
Registered: Aug 2004
Location: Pakistan
Posts: 52

Rep: Reputation: 15
hi again,

this if config belongs to ur machine without mouse, keyboard or with mouse keyboard etc.

the best way to setup static ip on ur terminal(without mouse keyborad) is to write ifconfig eth0 ipaddress in rc.local and u dont have to give ip everytime.
 
Old 11-08-2004, 10:27 AM   #12
bobbens
Member
 
Registered: Sep 2004
Location: Barcelona
Distribution: Debian, FreeBSD, Gentoo
Posts: 586

Original Poster
Rep: Reputation: 30
This ifconfig is my main rigs. My second will probably have the same thing but with eth0 instead of eth1, cuz its motherboard got no onboard eth, so its running with the same card my main has. Gonna see if i can get it fooling around with some files.
 
Old 11-09-2004, 06:00 PM   #13
ruiP
LQ Newbie
 
Registered: Nov 2004
Posts: 11

Rep: Reputation: 0
just 2 small notes

1st, if you have debian boxes, is not rc.local (it won't exist!) but some link at /etc/rcS.d to a file in /etc/init.d. You should know that, but just in case...

2nd...
Quote:
On boot up i want to automatically mount some folders using NFS, but it wont do that if everytime i boot them up i get diferent IP address's so i have to manually mount them.
I had the same question and solved the way you tring to do... but then return to dhcp, wich work fine, by doing the exports (/etc/export) not a single (static) IP, but a range like 195.245.0.* (or 195.245.0.0), whatever your DHCP gives. No matter wich IP the cards gets as long as they belong to the range you wrote... everything should be exported nice and mountable at computers on your network. if you add another computer you don't need to add another IP to your configuration files, just a mount of the NFS export. Your Internet connection can continue with dhcp, and you don't have to think about IPs anymore

(I think something like 195.245.0.1/10, e.g., should work too, exporting for all ips from termination 1 to 10; and of course using the IP ranges that your dhcp server assign to your lans)

hope this give you some help.

Edit: oh... and you could use the name (or domains) of computers, instead of IPs at exports file.

Last edited by ruiP; 11-10-2004 at 06:36 AM.
 
  


Reply



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
Segfaultin' when I try to do anything network based Epix Slackware 1 01-02-2005 02:53 PM
MAC based DHCP configuration ! Help wanted aronnok Linux - Networking 5 10-30-2004 06:37 AM
Accounting of DHCP based hotel clients ivanp Linux - Networking 0 08-21-2004 06:29 AM
My network-based activities are slower than XP! rolandus Linux - Networking 2 04-17-2004 12:27 AM
Linux based network dtournas Linux - Networking 1 10-06-2003 12:58 AM

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

All times are GMT -5. The time now is 10:57 AM.

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