-   Linux - Software (
-   -   Assignment of IP-Address (

santosh_pn 06-16-2005 07:23 AM

Assignment of IP-Address

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


Bruce Hill 06-16-2005 07:32 AM


Half_Elf 06-16-2005 10:31 AM

ifconfig eth0

Lleb_KCir 06-16-2005 10:47 AM

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.

Lleb_KCir 06-16-2005 11:22 AM

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.

All times are GMT -5. The time now is 01:25 PM.