LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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-19-2010, 05:10 PM   #16
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92

I don't know how can you solve it, but I think that you can't be connected both gprs and wifi at the same time.
Therefor and because I trust "ifconfig" I suggest to use only:
interface=`ifconfig | grep -iE "(wlan0|gprs0)" | awk '{print $1}'`

Interface status, can be changed only by ifup/ifdown, so if you have in output "wlan0", that means only that wlan0 is activated and nothing else.

P.S. But can you turn "up" both interfaces gprs and wifi?

Last edited by nimnull22; 01-19-2010 at 05:14 PM.
 
Old 01-19-2010, 05:20 PM   #17
dEM0nsTAr
LQ Newbie
 
Registered: Nov 2009
Posts: 28

Original Poster
Rep: Reputation: 15
Yes, that is possible.
 
Old 01-19-2010, 05:22 PM   #18
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Actually you know, check if Maemo has command "route". If it does, execute it like "route -n".
 
Old 01-19-2010, 05:24 PM   #19
dEM0nsTAr
LQ Newbie
 
Registered: Nov 2009
Posts: 28

Original Poster
Rep: Reputation: 15
No route command

Is it possible to detect it by ifconfig grep for wlan0 and if wlan0 is not found do something?

Last edited by dEM0nsTAr; 01-19-2010 at 05:26 PM.
 
Old 01-19-2010, 05:40 PM   #20
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
What inside of /etc/network in Maemo is?
 
Old 01-19-2010, 05:43 PM   #21
dEM0nsTAr
LQ Newbie
 
Registered: Nov 2009
Posts: 28

Original Poster
Rep: Reputation: 15
if-down.d/
if-post-down.d/
if-pre-up.d/
if-up.d/
interfaces
options
 
Old 01-19-2010, 05:54 PM   #22
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
You have "route" command, just type "route".
Attached Thumbnails
Click image for larger version

Name:	Screenshot-20091209-085437.jpg
Views:	8
Size:	24.5 KB
ID:	2520  

Last edited by nimnull22; 01-19-2010 at 05:56 PM.
 
Old 01-19-2010, 05:59 PM   #23
dEM0nsTAr
LQ Newbie
 
Registered: Nov 2009
Posts: 28

Original Poster
Rep: Reputation: 15
Oh yeah, sorry. I wasn't logged in as root for my test. It gives the same output like in your screenshot currently.
 
Old 01-19-2010, 06:04 PM   #24
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
So at the end of the line you can see interface (gprs|wlan) where your packets go out.
So if you parse that output you can be certainly sure what you are connected with.
 
Old 01-19-2010, 06:07 PM   #25
dEM0nsTAr
LQ Newbie
 
Registered: Nov 2009
Posts: 28

Original Poster
Rep: Reputation: 15
Even if gprs0 and wlan0 are active at the same time (cannot test it currently)?
What is the difference to my ifconfig solution?
 
Old 01-19-2010, 06:13 PM   #26
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
If you can, use "route -n" instead of just "route"
 
Old 01-19-2010, 06:14 PM   #27
dEM0nsTAr
LQ Newbie
 
Registered: Nov 2009
Posts: 28

Original Poster
Rep: Reputation: 15
Ok, thanks. I will try it but can you please explain me what the difference is to my ifconfig solution? It should give the same output. Is this more reliable?
 
Old 01-19-2010, 06:16 PM   #28
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
If you can, use "route -n" instead of just "route"

Default route can only one, it can point to gprs or wifi. Default route looks like in screenshot.
 
Old 01-19-2010, 06:30 PM   #29
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Default route is very important information - it shows you where your packets go to. Even if you have two active interfaces, default route will be only one - to gprs or wlan0.
 
  


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
Shell script to switch interfaces jasonenid Linux - Networking 2 10-04-2008 03:22 AM
How to switch user via shell script cool_anupam Linux - General 7 05-29-2008 10:01 PM
How do i switch users in a shell script? koobi Programming 8 01-05-2008 02:19 PM
ifconfig+no connection established coolirc Slackware 2 03-04-2007 02:12 PM
Time out in Connection established state if no Data flows on that connection asurya Linux - Networking 2 04-10-2005 03:54 PM

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

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

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
Open Source Consulting | Domain Registration