LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
Search this Thread
Old 04-07-2006, 03:03 PM   #1
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Rep: Reputation: 73
Staticly Assign IP


Where in Debian can I staticly set an IP? I did a search and the board and found /etc/network/interface and there I have this text file...

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# This is a list of hotpluggable network interfaces.
# They will be activated automatically by the hotplug subsystem.
mapping eth0
script grep
map eth0

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp


I am not sure how to add my static IP, gateway and mask.
 
Old 04-07-2006, 03:19 PM   #2
manishsingh4u
Member
 
Registered: Oct 2005
Location: Pune, India
Distribution: OpenSUSE 11.0
Posts: 422

Rep: Reputation: 30
Try this in your /etc/network/interfaces. This must help
Code:
auto eth0
iface eth0 inet static
address 192.168.0.2
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1

Last edited by manishsingh4u; 04-07-2006 at 03:38 PM.
 
Old 04-07-2006, 04:57 PM   #3
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 73
Thanks makes sense however my info is as follows but I am not sure what my network and broadcast Ip would be...

Code:
auto eth0
iface eth0 inet static
address 10.1.1.204
netmask 255.255.0.0
network 10.1.0.0 < ------?
broadcast 10.1.255.255 <-----?
gateway 10.1.1.1
 
Old 04-07-2006, 08:02 PM   #4
Dead Parrot
Senior Member
 
Registered: Mar 2004
Distribution: Debian GNU/kFreeBSD
Posts: 1,597

Rep: Reputation: 46
You can simply omit the network and broadcast lines. Most likely you won't need them.
 
Old 04-07-2006, 08:13 PM   #5
pljvaldez
Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Squeeze (x86)
Posts: 6,092

Rep: Reputation: 269Reputation: 269Reputation: 269
If you leave them, I believe yours should read
Quote:
Originally Posted by Carlwill
Code:
auto eth0
iface eth0 inet static
address 10.1.1.204
netmask 255.255.0.0
network 10.1.1.0 < ------?
broadcast 10.1.1.255 <-----?
gateway 10.1.1.1
because they all need to be on the same subnet (10.1.1.xxx)
 
Old 04-07-2006, 08:25 PM   #6
rickh
Senior Member
 
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250

Rep: Reputation: 60
I don't really understand this issue, so maybe I'm way off base, but my router allows me to match the MAC address of any computer connected to it with whatever IP address I want that computer to have. Isn't that the same thing?

For that matter, I've noticed that without me doing anything, the router always assigns each PC the same IP whenever it connects even if I don't specify that it should.
 
Old 04-07-2006, 08:49 PM   #7
pljvaldez
Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Squeeze (x86)
Posts: 6,092

Rep: Reputation: 269Reputation: 269Reputation: 269
Sort of. What your router is allowing is called "static DHCP". You enter the MAC and assign an IP. But all the clients are still using DHCP (i.e. they're polling the router asking for an address).

Right now it might appear that all the machines are always getting the same address. But if you turned all the machines off until the lease expired (mine defaults to 24 hours) and then started the computers up in a different order, the machines would get different IP's because they're assigned by the router on a first come first serve basis (unless you're using static dhcp).

Now it's also possible to make the client static. That's what is happening here. This is useful if the router doesn't have static dhcp capability, but you always want you machine at the same IP (for example if you're forwarding ports to a server on your internal network and don't want the routing table messed up if you reboot and it gets assigned a different address). This is mostly a problem on large networks because if you have hundreds of machines, some of them being shut off at different times (like over a weekend) and then turned on in a different order, you could mess up your routing table if your server went down for the weekend also...
 
Old 04-08-2006, 05:56 AM   #8
Tons of Fun
Member
 
Registered: Dec 2004
Location: Orlando, Florida
Distribution: Debian Squeeze / BackTrack 5/ Linux Mint 11
Posts: 367

Rep: Reputation: 33
I am not sure that the network address and broadcast address is correct? Looking at the subnet mask of 255.255.0.0, it seems he would want a network of 10.1.0.0 and a broadcast of 10.1.0.255. He is using a class B subnet with a class A private address, that is where I got my calculations. Now I am by no way a TCP guru, so if I'm off base, please let me know because I am always trying to learn more, but this one seemed pretty straight forward.
I also think Dead Parrot is correct, I don't think they are even required in the interfaces file as those are normally used for routers. However, if they are in there, they need to be correct.

 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Assign binary value manu82 Programming 21 04-02-2013 11:39 AM
Staticly linked jre? lsakhvoruk Linux - Software 0 10-13-2003 04:34 PM
How to assign a driver... whitmell Linux - Newbie 4 09-16-2003 08:36 AM
compiling glibc staticly - error matt_w_lambert Linux - Software 0 09-10-2003 09:07 PM
How to assign shortcouts? Xiangbuilder Linux - Newbie 2 08-31-2003 08:46 AM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration