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