View the Most Wanted LQ Wiki articles.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


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

Rep: Reputation: 0
Assignment of IP-Address


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

Old 06-16-2005, 07:32 AM   #2
Bruce Hill
HCL Maintainer
Registered: Jun 2003
Location: McCalla, AL
Distribution: Gentoo / Funtoo
Posts: 6,926

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

Rep: Reputation: 45
ifconfig eth0
Old 06-16-2005, 10:47 AM   #4
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, 11:22 AM   #5
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.

# 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
#	netmask
#	network
#	broadcast
#	gateway
#	address
#	netmask
#	network
#	broadcast
#	gateway

auto wlan0
#iface wlan0 inet dhcp
 iface wlan0 inet static
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:

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:

/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.


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

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration