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 Code:
root# ifconfig 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.) |
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. |
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. |
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. |
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. |
have you tried changing "allow-hotplug eth0" to "auto eth0" ?
|
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. |
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. |
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 |
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. |
All times are GMT -5. The time now is 10:38 PM. |