LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 06-16-2005, 08:23 AM   #1
santosh_pn
LQ Newbie
 
Registered: Mar 2005
Posts: 5

Rep: Reputation: 0
Assignment of IP-Address


Hi,

How to assign the IP-Address to a system by software.

Regards.
 
Old 06-16-2005, 08:32 AM   #2
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: Tupelo, MS
Distribution: Gentoo
Posts: 6,926

Rep: Reputation: 124Reputation: 124
netconfig
 
Old 06-16-2005, 11:31 AM   #3
Half_Elf
Guru
 
Registered: Sep 2001
Location: Montreal, Canada
Distribution: Slackware; Debian; Gentoo...
Posts: 2,163

Rep: Reputation: 45
ifconfig eth0 1.2.3.4
 
Old 06-16-2005, 11:47 AM   #4
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Rep: Reputation: 45
if you are using debian, then you can edit your /etc/network/interfaces file and put all of the data there you need:

when i get to the house i will post what my interfaces file looks like and explain why i do it the way i do.
 
Old 06-16-2005, 12:22 PM   #5
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Rep: Reputation: 45
here is the /etc/network/interfaces file on my laptop.

Code:
# 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

# The primary network interface
#auto eth0
#iface eth0 inet dhcp
#iface eth0 inet static
#	address 192.168.2.50
#	netmask 255.255.255.0
#	network 192.168.2.0
#	broadcast 192.168.2.255
#	gateway 192.168.2.1
#	address 192.168.1.55
#	netmask 255.255.255.0
#	network 192.168.1.0
#	broadcast 192.168.1.255
#	gateway 192.168.1.1

auto wlan0
#iface wlan0 inet dhcp
 iface wlan0 inet static
	address 192.168.2.55
	netmask 255.255.255.0
	network 192.168.2.1
	broadcast 192.168.2.255
	gateway 192.168.2.1
the reason i have the eth0 # out is that i do not want to use that connection when i am at the house. it is enough of a pain in the arse to get the ndiswrappers to work properly after a reboot (takes about 5-20 attempts to get it stable and working). I also set a static IP for the wlan0 so i always know exactly what LAN IP my laptop has for when i am going to ssh into that box.

In the eth0 you notice it has 2 differnt sets of IPs. one is for the house when i do use the eth0 (only when i get really tired of ndiswrappers locking up my laptop) and the other is when i am at the office. this allows me to go in and just remove the # for the proper IP range, if i want to go static, then type the following command:

Code:
ifconfig restart
and poof away i run on the eth0. you do have to # out the wlan0 portion to prevent it from giving you fits while running on the eth0.

notice that i also have the dhcp setting line for both eth0 and wlan0 device. If i choose or need to use the local DHCP server, then i comment everything else out, and uncomment the line with the iface device inet dhcp and away i go after running the above command to restart my network.

FYI if the above line does not work you should also be able to type the following:

Code:
/etc/init.d/networking restart
that should also do the trick. you can always replace restart with stop/start and do the command 2 times. ifconfig maybe up/down not restart/stop/start but either way it will get the job done for you.

best of luck.
 
  


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
how to get ip address, broadcast address, mac address of a machine sumeshstar Programming 2 03-12-2005 05:33 AM
Last assignment and I am lost Veteq Programming 2 08-12-2004 02:55 PM
IP address assignment n3tw0rk Linux - Networking 1 01-05-2004 01:23 AM
IPv6 anycast address assignment harpal Linux - Networking 0 04-27-2003 01:47 AM
point to point address assignment of ppp0 andyn Linux - Networking 0 10-11-2002 11:45 PM


All times are GMT -5. The time now is 10:22 PM.

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