LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-21-2012, 07:57 PM   #1
D1ver
Member
 
Registered: Jan 2010
Distribution: Slackware 13.37
Posts: 598
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
Network Interface Loses Static IP Address When Cable Is Removed


Hello,
I'm working on an embedded Linux application and I need to give the USB ethernet interface (shows up as usb1 in ifconfig) a static IP address.

I've added the following to /etc/network/interfaces and usb1 successfully gets the correct IP on bootup
Code:
auto usb1
iface usb1 inet static
    address 192.168.1.100
    netmask 255.255.255.0
    broadcast 192.168.1.255
However, when I unplug the rj45 cable and plug it back in again the IP address is lost. Doing a simple
Code:
ifdown usb1
ifup usb1
fixes this problem, but it doens't seem to do it automatically.


I need to be able to turn the device on, and whenever I plug in the Ethernet cable, be able to talk to it on a specific IP address..


Any help is appreciated.
 
Old 02-21-2012, 09:05 PM   #2
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,669

Rep: Reputation: 498Reputation: 498Reputation: 498Reputation: 498Reputation: 498
Hi,

To make the interface available at boot up and permanent try to fix it at the /etc/rc.d/rc.inet1.conf.

There find something like --

IFNAME[4]="wlan0" (Change this to "usb1")
IPADDR[4]=""
NETMASK[4]=""
USE_DHCP[4]="no"

fill up the IPADDR with the static IP so that the kernel will not treat it as eth0.

After fixing these values in the rc.inet1.conf just restart the script being root

"--# /etc/rc.d/rc.inet1 restart"

This might work. But I have not tested it yet.

Hope that helps. Good luck.

mm

Last edited by malekmustaq; 02-21-2012 at 09:08 PM.
 
Old 02-22-2012, 11:21 PM   #3
D1ver
Member
 
Registered: Jan 2010
Distribution: Slackware 13.37
Posts: 598

Original Poster
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
Managed to get this working by building ifplugd in openembedded. Marking as solved.
 
  


Reply



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
Network address changes despite being static kaplan71 Ubuntu 3 05-31-2011 11:45 AM
static ipv6 address not showing on eth0 interface gitecravirs Linux - Newbie 0 06-10-2009 09:01 AM
opensuse11.1 loses network connection but retains ip address kaplan71 SUSE / openSUSE 6 01-16-2009 09:45 AM
Gateway ip address removed from /etc/sysconfig/network files ehedetniem Linux - Newbie 2 04-12-2005 10:29 AM
How do I map registered domain to my cable modem static ip address munisp Linux - Networking 2 11-20-2001 06:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:43 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration