Networking learning curve: No Reboot!
Hello,
This is just a learning curve thing... I shut down my network interface and then started it up again: ifconfig eth1 down ifconfig eth1 up I try to ping out and get "host unreachable" I restarted network services: /etc/init.d/networking restart but still no connection to the outside world. So I rebooted and now all is well. I don't want to have to reboot my system. How I can I manually do what the reboot is doing automatically? Many Thanks, pb |
Well, how about looking into the rc scripts to figure out the commands given and in what sequence? Just a thought ;)
|
What is 'eth1' and how is it configured?
What is your network topology and what are the machines involved? Do you have firewall rules implemented on your machine? |
Hello,
Thanks for the responses and the challenge DutchMaster ;-) I used the route command and found that my default gateway was removed, I assume when I used ifconfig eth1 down. When I used ifconfig eth1 up, the default gw still wasn't there so I ran: route add default gateway with my gw IP and all is well. What file does route edit? I ran man route but didn't see anything. Thanks Again, pb |
Route doesn't edit any files; it alters the kernel's routing table (which is all in memory - unless it somehow gets swapped to disk).
Are you assigning IP via DHCP or statically via the network 'interfaces' file? |
Thanks for the response pinniped.
Eth1 is my NIC card which is assigned a static ip address. There are no other computers in my network. It looks like ifconfig down removes the default gateway from IP tables. /etc/network/interfaces shows eth1 as static, as expected. My gw is indeed listed in that file even when I can't ping out. I guess I was thinking that the restart of some service would re-read that file and see the gw settings. As DutchMaster suggested, I read my rc2.d directory for the startup script that fixed everything at bootup. I didn't see anything that looked conspicuous: (its obviously one of these but I'm not sure which one) lrwxrwxrwx 1 root root 21 2008-11-16 20:09 S05loadcpufreq -> ../init.d/loadcpufreq lrwxrwxrwx 1 root root 17 2008-11-16 18:29 S10rsyslog -> ../init.d/rsyslog lrwxrwxrwx 1 root root 15 2008-11-16 18:31 S12acpid -> ../init.d/acpid lrwxrwxrwx 1 root root 14 2008-11-16 20:08 S12dbus -> ../init.d/dbus lrwxrwxrwx 1 root root 22 2008-11-16 20:09 S19cpufrequtils -> ../init.d/cpufrequtils lrwxrwxrwx 1 root root 14 2008-11-16 20:07 S20cups -> ../init.d/cups lrwxrwxrwx 1 root root 20 2008-11-16 20:16 S20kerneloops -> ../init.d/kerneloops lrwxrwxrwx 1 root root 20 2008-11-16 20:07 S20nfs-common -> ../init.d/nfs-common lrwxrwxrwx 1 root root 23 2008-11-16 20:07 S20openbsd-inetd -> ../init.d/openbsd-inetd lrwxrwxrwx 1 root root 25 2008-11-16 20:07 S20policycoreutils -> ../init.d/policycoreutils lrwxrwxrwx 1 root root 23 2008-11-17 16:27 S20smartmontools -> ../init.d/smartmontools lrwxrwxrwx 1 root root 22 2008-11-16 20:08 S24avahi-daemon -> ../init.d/avahi-daemon lrwxrwxrwx 1 root root 16 2008-11-16 20:10 S24dhcdbd -> ../init.d/dhcdbd lrwxrwxrwx 1 root root 13 2008-11-16 20:13 S24hal -> ../init.d/hal lrwxrwxrwx 1 root root 25 2008-11-16 20:16 S26network-manager -> ../init.d/network-manager lrwxrwxrwx 1 root root 36 2008-11-16 20:16 S26network-manager-dispatcher -> ../init.d/network-manager-dispatcher lrwxrwxrwx 1 root root 13 2008-11-16 20:11 S30gdm -> ../init.d/gdm lrwxrwxrwx 1 root root 31 2008-11-16 20:12 S30system-tools-backends -> ../init.d/system-tools-backends lrwxrwxrwx 1 root root 17 2008-11-16 20:08 S89anacron -> ../init.d/anacron lrwxrwxrwx 1 root root 13 2008-11-16 20:07 S89atd -> ../init.d/atd lrwxrwxrwx 1 root root 14 2008-11-16 18:29 S89cron -> ../init.d/cron lrwxrwxrwx 1 root root 18 2008-11-16 18:29 S99rc.local -> ../init.d/rc.local lrwxrwxrwx 1 root root 19 2008-11-16 18:29 S99rmnologin -> ../init.d/rmnologin lrwxrwxrwx 1 root root 23 2008-11-16 18:29 S99stop-bootlogd -> ../init.d/stop-bootlogd Thanks, pb |
Which distribution are you using?
If your NIC's configuration file declares a gateway, then the networking script should always set up a route through that gateway (or else there is a bug in the network scripts). |
I'm using SID. After I reboot, everything is fine. But I'm interested in what "fixes" the problem. After running ifconfig eth1 down , I restarted /etc/init.d/networking thinking that it would read the NIC file and get things running- to no avail. But the networking script is not in rc2.d. Still confused as to what script in rc2.d is gem at startup.
Thanks, pb |
That "network-manager" and "network-manager-dispatcher" scripts are alien to me; I guess you need to read through those (look for the part that begins with "start)"). If you can follow through the network startup scripts you should get some idea of what's meant to happen and you might see what's going wrong.
|
Thanks for your help pinniped.
pb |
Any chance you can paste the content of your ifcfg-eth1 file? Does this have a Gateway defined within it?
Stuart |
Hi Stuart,
Did a search and didn't find an ifcfg-eth1 file. Tried a couple of searches: aquamarine:~# find / -name ifcfg-eth1 -print aquamarine:~# find / -name ifcfg-* -print aquamarine:~# Neither returned any finding. Thanks, pb |
pb,
Look in /etc/sysconfig/network-scripts/ this is where the config files are kept. Stu. |
that file would exist on a Redhat System .. Redhat uses a seperaste file for each interface,
Debian puts all the Network interface information in a single file,. . /etc/networking/interfaces |
Thanks farslayer,
Yes, I checked /etc/network/interfaces and the gateway for eth1 is indeed listed. I checked after I ran ifconfig eth1 down and saw that the gateway was still listed there. It seems that some script at bootup is reading that file and seeing the default gw listed. I'm guessing that's why a reboot fixes the problem and successfully enables my network card. I'm still confused as to why after an ifconfig eth1 up, I still need to run route add default gateway to do the same thing (evidently that command does not read the interfaces file). I've looked at my startup scripts in /etc/rc2.d but see nothing obvious that would activate the default gw (see above listing of my rc2.d directory). I appreciate the time and interest you guys are showing in helping me with this issue. Many Thanks, pb |
Debian usually uses
ifup eth1 ifdown eth1 Have you tried using those commands instead of ifconfig ? it may trigger different script that would work properly.. I've never had the issue you are describing, maybe this is why ? Worth a shot anyway. |
Some script isn't working as expected if 'ifup' doesn't set up the gateway properly, but as I said I'm not familiar with those new networking scripts. In a worst case situation, you can always put in a "post-up" line in the interfaces file to run a program which checks the routing table and adds the gateway if necessary, but the system scripts should have handled that. If you can find a bug I'm sure a lot of people would want to know about it.
|
That was sorta my point.. he's not using ifup eth1... he's using ifconfig eth1 up
maybe the two are slightly different.. |
All times are GMT -5. The time now is 07:42 AM. |