LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 05-21-2009, 01:13 AM   #1
HolyJoe
LQ Newbie
 
Registered: Feb 2008
Distribution: Ubuntu
Posts: 20

Rep: Reputation: 0
What is the difference between 'networking restart' and 'ifup ethx'


Hi,

I had a D-Link 802.11g router and it connected to Internet. Other computers at my home can connected to Internet through an Ubuntu 8.04 Server squid3 box via the D-Link router. But, there is a headache :
If the D-Link router restart, for go Internet again I must execute '/etc/init.d/networking restart'. At same time, the squid3 daemon workings fine.

I don't know what's the exact problem at there and need any advice and help.


Thanks.
 
Old 05-21-2009, 02:27 AM   #2
suga_rray
LQ Newbie
 
Registered: Dec 2004
Location: India
Distribution: Debian Lenny
Posts: 6

Rep: Reputation: 1
Lightbulb Re: What is the difference between 'networking restart' and 'ifup ethx'

When your wireless router gets restarted/power cycled, the connections on your computer also gets broken. By doing a "/etc/init.d/networking restart" you are basically re-establishing the wireless connections.

Your squid daemon will be accepting connections, but as long as the squid cannot access internet it wont be able to serve the clients.

I guess this is what is happening with you.
 
Old 05-21-2009, 03:09 AM   #3
linusali
LQ Newbie
 
Registered: Jul 2007
Location: Dubai
Distribution: Kubuntu - 9.04
Posts: 18

Rep: Reputation: 1
Yes, You are right suga_rray. But why is it now establishing the connection automatically? I don't know much about the Ubuntu 8.04, but if HolyJoe requires a automatic reconnect, he/she may run a cron job every minute checking the availablity of the router.

ping -c 3 192.168.0.1 -w 3 ; if [ $? != 0 ] ; then /etc/init.d/networking restart ; fi

192.168.0.1 is the router IP address.

Hope this helps
 
Old 05-21-2009, 07:30 AM   #4
HolyJoe
LQ Newbie
 
Registered: Feb 2008
Distribution: Ubuntu
Posts: 20

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by linusali View Post
Yes, You are right suga_rray. But why is it now establishing the connection automatically? I don't know much about the Ubuntu 8.04, but if HolyJoe requires a automatic reconnect, he/she may run a cron job every minute checking the availablity of the router.

ping -c 3 192.168.0.1 -w 3 ; if [ $? != 0 ] ; then /etc/init.d/networking restart ; fi

192.168.0.1 is the router IP address.

Hope this helps
Thanks.

Yes, I want to establish the Internet connection automatically. I can receive the replies from ping to the router, but I cannot connect to Internet and I must execute '/etc/init.d/networking restart' (does not need to restart the squid3)
What's wrong?
 
Old 05-21-2009, 07:33 AM   #5
HolyJoe
LQ Newbie
 
Registered: Feb 2008
Distribution: Ubuntu
Posts: 20

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by suga_rray View Post
When your wireless router gets restarted/power cycled, the connections on your computer also gets broken. By doing a "/etc/init.d/networking restart" you are basically re-establishing the wireless connections.

Your squid daemon will be accepting connections, but as long as the squid cannot access internet it wont be able to serve the clients.

I guess this is what is happening with you.
Thanks.

Yes, But how can I establish the Internet connection automatically.
 
Old 05-21-2009, 07:41 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,309

Rep: Reputation: 1031Reputation: 1031Reputation: 1031Reputation: 1031Reputation: 1031Reputation: 1031Reputation: 1031Reputation: 1031
You shouldn't need to - I reset my (home) router regularly. Ubuntu desktop, not Server mind you.
The only time I've needed to issue a network restart is when the driver hasn't loaded successfully. Always at startup, not later on though.
 
Old 05-21-2009, 09:09 PM   #7
HolyJoe
LQ Newbie
 
Registered: Feb 2008
Distribution: Ubuntu
Posts: 20

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by syg00 View Post
You shouldn't need to - I reset my (home) router regularly. Ubuntu desktop, not Server mind you.
The only time I've needed to issue a network restart is when the driver hasn't loaded successfully. Always at startup, not later on though.
Hi, syg00,
Thank you for your reply.

I don't like execute '/etc/init.d/networking restart' all the time after the router restart/power cycled too May be I should let my problem more clear, make some examples to emulate the situation:
$sudo ifdown eth0 #eth0 is the public NIC of my Ubuntu 8.04 Server
$sudo ifup eth0
after above commands has been executed, I can receive ping replies from the router except other outside URL such as www.ubuntu.com.

Need your help to find the key of the headache, thank you.
 
Old 05-24-2009, 06:31 AM   #8
linusali
LQ Newbie
 
Registered: Jul 2007
Location: Dubai
Distribution: Kubuntu - 9.04
Posts: 18

Rep: Reputation: 1
Hi there,

I think you have to check if your the default route is up after you do sudo ifup eth0. check it using route command. you should see some thing like

default 192.168.0.1 0.0.0.0 UG 0 0 0 eth0

towards the end of the output. If it is not there issue the following command to set the default route.

route add default gw 192.168.0.1

of-course 192.168.0.1 is you router IP address.

cheers
 
Old 05-25-2009, 02:46 AM   #9
HolyJoe
LQ Newbie
 
Registered: Feb 2008
Distribution: Ubuntu
Posts: 20

Original Poster
Rep: Reputation: 0
Unhappy

Quote:
Originally Posted by linusali View Post
Hi there,

I think you have to check if your the default route is up after you do sudo ifup eth0. check it using route command. you should see some thing like

default 192.168.0.1 0.0.0.0 UG 0 0 0 eth0

towards the end of the output. If it is not there issue the following command to set the default route.

route add default gw 192.168.0.1

of-course 192.168.0.1 is you router IP address.

cheers
Hi, linusali,
Thank you for your help.

After 'ifup eth0' the 'router -n' has the following output:
Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.18.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.15.0    0.0.0.0         255.255.255.0   U     0      0        0 eth1
0.0.0.0         192.168.15.1    0.0.0.0         UG    100    0        0 eth1
0.0.0.0         192.168.18.18   0.0.0.0         UG    100    0        0 eth0
0.0.0.0         192.168.18.1    0.0.0.0         UG    100    0        0 eth0

So, I think my Ubuntu box had connected to router successful.
 
  


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
/etc/init.d/networking restart (ERRORS) lrt Linux - Networking 13 03-10-2009 10:44 AM
no wireless connection after /etc/init.d/networking restart cccc Linux - Wireless Networking 5 11-09-2008 08:19 PM
Restart Networking mikanoot Linux - Newbie 6 09-01-2008 03:00 AM
difference bet shutdown and restart aashishdhabarde Linux - Kernel 1 01-31-2008 05:23 AM


All times are GMT -5. The time now is 07:04 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration