New IT forum Follow us on Twitter
07 February 2012, 02:37:40 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: EFIKA MX now in stock!
 
   Home   SHOP Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How To set a fixed IP address  (Read 2552 times)
ericd
Newbie
*
Posts: 5


« on: 31 May 2010, 09:03:48 pm »

Hello,
I have some problems to set a static IP on eth0.
No matter the content of the config file /etc/network/interfaces, eth0 always comes with a dynamic IP assigned by the DHCP server
on the LAN. It seems it takes over my settings.
The strange thing is that if I simply change eth0 to eth1, it works perfectly, eth1 is assigned with my fixed IP.
What can be different between eth0 and eth1 in term of DHCP settings ?

If I force a network restart using "/etc/init.d/networking restart"  than the static IP is OK on eth0 !
This probably means that my network config is fine but why is that one not taken into account at boot time ?

Any hint or comment ?
Thanks
Eric

Here's the config file:

 sheevaplug-debian:/etc/network# more interfaces
  # Used by ifup and ifdown. See the interfaces manpage or
  # /usr/share/doc/ifupdown/examples for more information.
  auto lo
  iface lo inet loopback
  #
  auto eth0
  iface eth0 inet static
  address 192.168.1.40
  network 192.168.1.0
  netmask 255.255.255.0
  gateway 192.168.1.1

Logged
NewIT_Marcus
Administrator
Hero Member
*****
Posts: 960


« Reply #1 on: 01 June 2010, 07:47:27 am »

Is your plug a Guruplug or a Sheevaplug? The Guruplug has some scripts that interfere with regular networking configuration.
Logged
ericd
Newbie
*
Posts: 5


« Reply #2 on: 01 June 2010, 08:04:30 pm »

Hi,
This is a guru server plus.
I know, there's a custom script /root/init_setup.sh that's called at boot time from /etc/rc.local.
I've commented most of the commands in that script (see below).
I only want to define a static IP on eth0 at boot time and that doesn't work.
I don't need any wireless/bluetooth/dhcp/... for now.
I've looked for traces of dhcp calls in the boot log but there's nothing (at least I've not found anything).
I've extracted the boot log section about eth0 as it may help (see below).
I know I could force the static IP once again in the init_setup.sh using ifconfig command but
I want to understand first why the normal IP definition doesn't work.
Thanks in advance for your help.
Eric


ADDRCONF(NETDEV_UP): eth0: link is not ready
.
eth0: link up, 1000 Mb/s, full duplex, flow control disabled
ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready


sheevaplug-debian:~# more init_setup.sh
#!/bin/sh

# This is called from /etc/rc.local to perform the initial setup.

# We always bootup in AP mode. Delete any stale files
rm -f /etc/wlanclient.mode
SSID=Plug2-uAP-`ifconfig eth0 | awk -F ":" '/HWaddr/ {print $6$7}'`

## Disable wifi
#insmod /root/uap8xxx.ko
#ifconfig uap0 192.168.0.1 up
#/usr/bin/uaputl sys_cfg_ssid $SSID
#/usr/bin/uaputl bss_start
#iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
#iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
#echo 1 > /proc/sys/net/ipv4/ip_forward

## Disable dhcp server
#/etc/init.d/udhcpd start
#/etc/init.d/dnsmasq start
#iptables -A INPUT -i uap0 -p tcp -m tcp --dport 80 -j ACCEPT

# Disable bluetooth
rmmod libertas_sdio libertas btmrvl_sdio btmrvl bluetooth 2>/dev/null
#uaputl sys_cfg_radio_ctl 1
#/etc/init.d/bluetooth start
#modprobe btmrvl_sdio
#hciconfig hci0 up
#hciconfig hci0 piscan
#/usr/bin/mute-agent &

# Set leds
echo 1 > `eval ls /sys/class/leds/*plug*\:green\:health/brightness`
echo 1 > `eval ls /sys/class/leds/*plug*\:green\:wmode/brightness`

Logged
fragfutter
Newbie
*
Posts: 24


« Reply #3 on: 01 June 2010, 08:15:55 pm »

Code:
cat /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.4.42
netmask 255.255.255.0
gateway 192.168.4.1

cat /etc/resolv.conf
nameserver 192.168.4.1
nameserver 8.8.8.8

and remove the ifplugd (update-rc.d -f ifplugd remove), otherwise it will start a dhcp client and f** with the normal interface config


Logged
ericd
Newbie
*
Posts: 5


« Reply #4 on: 04 June 2010, 07:38:42 pm »

Hi Fragfutter,
You're right, ifplugd starts a dhcp client deamon that overrules my static IP.
It can be found here:
sheevaplug-debian:/etc/ifplugd# grep dhcp /etc/ifplugd/ifplugd.action
        dhclient3 -e IF_METRIC=100 -pf /var/run/dhclient.eth0.pid -lf /var/lib/dhcp3/dhclient.eth0.leases eth0

Many thanks for your help.
It's working great now !
Eric
Logged
varkey
Newbie
*
Posts: 15


« Reply #5 on: 04 June 2010, 07:53:01 pm »

Hi Fragfutter,
You're right, ifplugd starts a dhcp client deamon that overrules my static IP.
It can be found here:
sheevaplug-debian:/etc/ifplugd# grep dhcp /etc/ifplugd/ifplugd.action
        dhclient3 -e IF_METRIC=100 -pf /var/run/dhclient.eth0.pid -lf /var/lib/dhcp3/dhclient.eth0.leases eth0

Many thanks for your help.
It's working great now !
Eric

Thanks for that. I was wondering why my static ips are not working for eth0 whereas it worked fine for eth1 Smiley

Will remove ifplugd anyway! Tongue
Logged
sandoz
Newbie
*
Posts: 6


« Reply #6 on: 14 June 2010, 03:00:05 pm »

is there a way to always start in wlan client mode?
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!