LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Reconnecting to the internet? (https://www.linuxquestions.org/questions/linux-networking-3/reconnecting-to-the-internet-102830/)

rech 10-11-2003 02:11 PM

Reconnecting to the internet?
 
Hi, I have cable and somewhere in my startup internet detection is fine, but if I unplug my ethernet cable or get disconnected for whatever other reason, what's the command to reconnect? `ifconfig eth0 up` seemed to be the way to go, but that doesn't work. Thanks in advance.

DoubleOTeC 10-11-2003 02:22 PM

how many eth devices do u have?

ensure that eth0 is the correct ethernet adapter.

try also
ifconfig eth0 down
ifconfig eth0 0.0.0.0
ifconfig eth0 up

let me know

rech 10-11-2003 02:54 PM

I have two eth devices, one for my wireless (which i haven't gotten to work yet), and one for my regular ethernet, which I'm pretty sure is on eth0

#ifconfig

eth0 Link encap:Ethernet HWaddr 08:00:46:AC:F8:86
inet addr:192.168.2.10 Bcast:255.255.255.255 Mask:255.255.255.0
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1130 errors:0 dropped:0 overruns:0 frame:0
TX packets:982 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:1195925 (1.1 Mb) TX bytes:122235 (119.3 Kb)
Interrupt:9 Base address:0xb000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:2 errors:0 dropped:0 overruns:0 frame:0
TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:100 (100.0 b) TX bytes:100 (100.0 b)

rech 10-11-2003 02:57 PM

Oh yeah, trying:

ifconfig eth0 down
ifconfig eth0 0.0.0.0
ifconfig eth0 up

didn't work.

DoubleOTeC 10-11-2003 04:57 PM

ifup eth0

interestingly...ur eth0 ifconfig seems to have a class C ip address....are y on a LAN or behind a router with dhcp or sumtin?

DoubleOTeC 10-11-2003 05:08 PM

a restart of the network service depending on ur setup may also be a feasible idea

# service network restart

rech 10-11-2003 10:04 PM

Yeah, I'm behind a router - I'm using slackware and bash is telling me that it can't find the command 'service'

DoubleOTeC 10-12-2003 02:22 PM

hmmm....run a locate on service...

hmmmm....try /sbin/service

ok...so ur surfing the web and then you unplug the ethernet cable that is connected to ur machine from the router...for some reason...and wehn u reconnect it the web doesn't work.

eth0 i assume is on dhcp from the router...if so does it get an ip when it is reconnected?

can u ping the router?

rech 10-12-2003 05:28 PM

nope, no service.....

The main reason I'm asking this question is not if I disconnect from the internet, but rather, if I start my laptop without being connected to the internet and plug in an ethernet cable later on I'd rather not have to restart the computer every time.

And actually it does work if I disconnect and reconnect (at least if the interval is short enough, haven't tried it for longer periods of time) - it's just when I send the down command to ifconfig, and then try to restart it with up, it doesn't work.

eth0 is on dhcp from the router - how do i check if it gets an ip when it's reconnected? Do I even get to the point where I'm reconnected?

I'm pretty sure I can ping the router?

DoubleOTeC 10-13-2003 05:07 PM

hmmmm....i have to admit i'm not familiar with slackware but you shouldn't have to restart ur machine in such a trivial situation as cable disconnect.

the IP check can be done with the same ifconfig command ("ifconfig eth0")....

do the ip check after putting the interface down.... and then again when u bring it back up

holla back

frieza 10-13-2003 05:09 PM

did you configure the nic to use DHCP? just a thought

rech 10-13-2003 11:03 PM

Heh, I just started using 'switchto' and that fixed both my problems! Now I can connect to my wireless, and connect to my lan at whim. Thanks for all your help guys.


All times are GMT -5. The time now is 09:31 PM.