LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 01-26-2011, 09:23 PM   #1
adrianmariano
Member
 
Registered: Dec 2004
Distribution: Ubuntu Yakkety
Posts: 188

Rep: Reputation: 15
static IP (or name server?)


I have two linux machines plugged into my wired router and I had set them to have static IPs so that I could ssh between them. I then listed their static IPs in each machine's /etc/hosts.

This all worked fine. But I just upgraded hardware and it doesn't work any more.

So my /etc/network/interfaces looks like this:

Code:
auto lo 
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
#iface eth0 inet dhcp
iface eth0 inet static
      address 192.168.1.99
      netmask 255.255.255.0
      gateway 192.168.1.1
      dns-nameservers 68.100.16.25 68.100.16.30  68.105.28.12
      dns-search cox.net
And ifconfig gives me this:

Code:
root# ifconfig
eth1      Link encap:Ethernet  HWaddr 70:71:bc:dd:29:17  
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::7271:bcff:fedd:2917/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2056404 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1838660 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2026298633 (1.8 GiB)  TX bytes:526334810 (501.9 MiB)
          Interrupt:20 Memory:f7200000-f7220000
When I tried changing the stuff in the interfaces file to refer to eth1 I believe the networking device came up as eth2, but I can't double check that without rebooting. Mysteriously when I type "ifdown eth1" I get the error "ifdown: itnerface eth1 not configured." And if I do "/etc/init.d/networking stop" the networking doesn't actually stop. Is something else handling the networking? I'm in kernel 2.6.37-trunk-686-bigmem on one machine (because it's sandybridge) and the latest testing, 2.6.32 on the other one

So I'm a little confused about this. The only reason I care about static IPs is that I want to be able to ssh or scp files between machines. It would be nice if I could do the same with a mac that is connecting to the LAN wirelessly as well.

So is there some way to fix things so I again get static IPs? Or should I run a name server somehow or do something else to solve this problem? (That seems like a more complex solution.)
 
Old 01-26-2011, 09:27 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mageia, and whatever VMs I happen to be playing with
Posts: 14,195
Blog Entries: 24

Rep: Reputation: 3858Reputation: 3858Reputation: 3858Reputation: 3858Reputation: 3858Reputation: 3858Reputation: 3858Reputation: 3858Reputation: 3858Reputation: 3858Reputation: 3858
Which hardware did you upgrade?

If it was the router, check the DHCP settings in the router and make sure they are not conflicting with your static ip settings in your computer.

Last edited by frankbell; 01-26-2011 at 09:31 PM. Reason: clarity
 
Old 01-26-2011, 09:44 PM   #3
adrianmariano
Member
 
Registered: Dec 2004
Distribution: Ubuntu Yakkety
Posts: 188

Original Poster
Rep: Reputation: 15
Old motherboard died so I got a new motherboard, cpu and RAM. All other hardware, including the router, is the same.

I double checked the DHCP settings in the router. I have starting IP set to 192.168.1.100, which shouldn't conflict. From the ifconfig output it is apparent that it got the first DHCP IP number.
 
Old 01-26-2011, 10:57 PM   #4
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mageia, and whatever VMs I happen to be playing with
Posts: 14,195
Blog Entries: 24

Rep: Reputation: 3858Reputation: 3858Reputation: 3858Reputation: 3858Reputation: 3858Reputation: 3858Reputation: 3858Reputation: 3858Reputation: 3858Reputation: 3858Reputation: 3858
Cool.

Try setting the computers back to DHCP and testing, running ifconfig and checking the settings, then resetting to the static ip.

What I find a little puzzling is that, in my Linux computers, regardless of the distro, the wired ethernet is invariably eth0, not eth1.
 
Old 01-26-2011, 11:34 PM   #5
adrianmariano
Member
 
Registered: Dec 2004
Distribution: Ubuntu Yakkety
Posts: 188

Original Poster
Rep: Reputation: 15
It sure would be easier to test stuff if I could figure out a way to reset the networking that didn't require rebooting. Why does "ifdown eth1" tell me I have no such device when ifconfig lists eth1 as the device?

I got the impression somehow that the system went to eth1 because it didn't like the config info I put in for eth0. I was surprised to see it list eth1. Also note that the config does specify eth0. Could some other network configuration application be at work? I think I saw something in a man page about some dhcp stuff having its own config and not paying attention to /etc/network/interfaces.
 
Old 01-27-2011, 07:42 AM   #6
Dani1973
Member
 
Registered: Dec 2010
Distribution: Debian testing
Posts: 148

Rep: Reputation: 16
have you tried changing "allow-hotplug eth0" to "auto eth0" ?
 
Old 01-27-2011, 06:07 PM   #7
adrianmariano
Member
 
Registered: Dec 2004
Distribution: Ubuntu Yakkety
Posts: 188

Original Poster
Rep: Reputation: 15
So I tried "auto eth0" and the behavior was unchanged. Running ifconfig still showed eth1 as the device, and with the wrong IP.

I went through and changed all the references from eth0 to eth1. I swear I did this before...but this time it worked. I also find that ifdown and ifup work now to take down and bring up eth1. (But whatever happened the eth0??)

And if that isn't strange enough, I went over to my other machine and ran ifconfig and found that it was listing eth2 as the device. I went through the interfaces file and changed the references to all indicate eth2. And that worked too.

So I feel like I don't really understand what's going on...but the problem seems to be solved.
 
Old 01-28-2011, 05:22 AM   #8
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Ubuntu 10.10, Slackware 64-current
Posts: 2,124

Rep: Reputation: 780Reputation: 780Reputation: 780Reputation: 780Reputation: 780Reputation: 780Reputation: 780
I suspect that when you changed the motherboard, the adapter MAC address changed and at least part of what is happening is that you have left over information mapping your old adapter to eth0. Consequently, your new adapter is being declared eth1, but since there is no eth0 things are getting messed up.

I believe that the device mapping information is normally handled by udev. For example, on my system (Ubuntu / debian) the file /etc/udev/rules.d/70-persistent-net.rules contains the mapping and ordering of the MAC address to eth devices. While this will vary according to distribution, you probably have something very similar and if you remove the old MAC address, your eth device will probably revert back to eth0.

Here is a link to some info on udev (it is for debian, but seems to contain a lot of generic information too.

Last edited by Noway2; 01-28-2011 at 05:23 AM. Reason: added link
 
Old 01-28-2011, 05:51 AM   #9
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,187

Rep: Reputation: 1037Reputation: 1037Reputation: 1037Reputation: 1037Reputation: 1037Reputation: 1037Reputation: 1037Reputation: 1037
The file might be called differently, but should have something like persistent-net as part of the file name. Delete any line which ends in eth0 or eth1, and reboot. You'll have eth0 back and this will be assigned the correct IP.

jlinkels
 
Old 01-28-2011, 06:03 PM   #10
adrianmariano
Member
 
Registered: Dec 2004
Distribution: Ubuntu Yakkety
Posts: 188

Original Poster
Rep: Reputation: 15
Thumbs up

I located that udev file and sure enough, there were entries left over from old networking devices. I deleted the obsolete entries, and tweaked the remaining entry to specify eth0 and now the device comes up as eth0. (And with the interfaces file modified to specify eth0, I get the desired static ip.) So now everything is worked as expected and desired.

Thanks.
 
  


Reply


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
SHH server needs static IP to allow user? clifford227 Linux - Server 5 05-11-2010 02:55 AM
Unable to access the server with static IP narendravijayarao Ubuntu 20 10-02-2009 12:31 PM
Setting server to static IP DarkFlame Linux - Server 2 02-10-2009 12:02 AM
assign static IP to the server ashley75 Linux - General 2 03-10-2005 04:47 PM
FTP server + static IP -> Firewall necessary ? Ben2210 Linux - Security 5 02-01-2005 04:43 PM

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

All times are GMT -5. The time now is 01:09 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration