LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-25-2017, 05:28 AM   #1
jayson_paul
LQ Newbie
 
Registered: Jul 2017
Posts: 1

Rep: Reputation: Disabled
What is the command used to check the network connectivity ( not physical link)


c program to check whether the network is through Wifi or through Ethernet and to check the status of the network.

for status example

If mobile hot spot is used, you need to turn on the mobile data else you will be connected to wifi but you cannot access the INTERNET.

how to check the connectivity ???


thanks in advance
 
Old 07-25-2017, 06:14 AM   #2
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 5,568
Blog Entries: 16

Rep: Reputation: 3303Reputation: 3303Reputation: 3303Reputation: 3303Reputation: 3303Reputation: 3303Reputation: 3303Reputation: 3303Reputation: 3303Reputation: 3303Reputation: 3303
I always check by pinging 8.8.8.8. That's one of the Google nameservers. If you can ping it, you're connected. And unlike some other methods, it doesn't rely on having working dns.
 
1 members found this post helpful.
Old 07-25-2017, 06:45 AM   #3
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873
You can only have ONE default route.

# route -n
$ netstat -r

$ ip link show
$ ip addr show
$ ip route show

# ifconfig -a
# ifconfig

Mostly I just ping 8.8.8.8, and if I know my routers IP, I ping it first to make sure it's not my LAN that's being quirky. Otherwise traceroute can help ID which interface is "next" in your route based on it's "IP".
 
1 members found this post helpful.
Old 07-25-2017, 03:06 PM   #4
erik2282
Member
 
Registered: May 2011
Location: TX
Distribution: mint,deb,centos
Posts: 818

Rep: Reputation: 228Reputation: 228Reputation: 228
ip command will show you what interfaces have what IP, maybe not what you're looking for though...

Last edited by erik2282; 07-25-2017 at 03:10 PM.
 
Old 07-25-2017, 08:22 PM   #5
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,513

Rep: Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009
Hi jayson_paul,

Welcome to LQ!

You can use nmap to map the network.

Last edited by AwesomeMachine; 07-25-2017 at 08:24 PM.
 
Old 07-25-2017, 09:03 PM   #6
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 17,499
Blog Entries: 28

Rep: Reputation: 5434Reputation: 5434Reputation: 5434Reputation: 5434Reputation: 5434Reputation: 5434Reputation: 5434Reputation: 5434Reputation: 5434Reputation: 5434Reputation: 5434
traceroute will tell you the network path to a target. If you have trouble connecting, it can help you spot where the connection is failing.

For example, if you have connectivity within your LAN, but can't get past your router to the Big Wide World, it may be that your modem needs rebooting or replacement. (This happened to me.)
 
  


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
TP-LINK TL-WN821N v4.2 shown as connected, but no network connectivity aranea.network Linux - Networking 6 08-31-2016 06:16 PM
Need a command to check incoming connectivity ZAMO Linux - Security 7 06-25-2015 04:31 PM
Is there any physical topology and connectivity diagnosis tool? duyuyang Linux - Networking 7 08-22-2014 03:20 PM
CentOS 6 - KVM - Physical host losing network connectivity after Bridge configuration gkulkarni Linux - Virtualization and Cloud 10 10-27-2013 04:41 PM
Check network connectivity ggeorgak Programming 5 08-29-2006 06:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:21 PM.

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