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 10-28-2016, 10:22 AM   #1
oleb
LQ Newbie
 
Registered: Oct 2016
Posts: 3

Rep: Reputation: Disabled
How to ping any IP over trivial local network


Hi, I hope someone can help me with a simple(?) question!

I want to talk from my machine to a GPS via Ethernet cable. Both units are sitting on my desk, connected through a simple ZyXEL switch. No wifi, no Internet, just a simple cabled connection.

The machine has a static IP address, say 192.168.0.1. The GPS has some random address, say 192.168.1.1. In particular, it cannot be assumed to be on the same subnet as the machine. How can I set up routing so that I can ping the GPS?

If I change my address to 192.168.1.2, both systems will be on the same subnet and so can talk; but I rather want to be able to ping any IP (inside my office only!) without having to change my machine every time.

I tried to set default routing with "route add default eth0", but then "ping" just silently waits forever. Same with "route add 192.168.1.1 eth0".

The machine is running Scientific Linux 6.5.

Note that I do know the address (and netmask) of the GPS.
Thanks for any insight!

Last edited by oleb; 10-28-2016 at 11:08 AM. Reason: Clarification
 
Old 10-28-2016, 10:35 AM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
You can't without knowing the exact IP & netmask of the GPS.
 
Old 10-28-2016, 11:03 AM   #3
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
Since it is directly connected have you looked at the arp table?

Code:
arp -n
 
Old 10-28-2016, 11:10 AM   #4
oleb
LQ Newbie
 
Registered: Oct 2016
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by AlucardZero View Post
You can't without knowing the exact IP & netmask of the GPS.
I do of course know the IP (and netmask) of the GPS. It is not a problem of knowing, but of pinging any address.
 
Old 10-28-2016, 12:38 PM   #5
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
OK, let me see if I understand you......

You have a GPS unit and your PC both connected to a switch.
The GPS unit has a different IP address then your PC.
You don't want to change your PC IP Address to the same network as the GPS.

In order to cross networks you need a layer 3 device. In your present setup you are going to have to replace the switch with a router.
Or you could add a second interface to your PC and give it an IP Address in the range of the GPS and then connect the GPS directly to the PC.
 
1 members found this post helpful.
Old 10-31-2016, 08:26 AM   #6
oleb
LQ Newbie
 
Registered: Oct 2016
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by lazydog View Post
OK, let me see if I understand you......

You have a GPS unit and your PC both connected to a switch.
The GPS unit has a different IP address then your PC.
You don't want to change your PC IP Address to the same network as the GPS.

In order to cross networks you need a layer 3 device. In your present setup you are going to have to replace the switch with a router.
Or you could add a second interface to your PC and give it an IP Address in the range of the GPS and then connect the GPS directly to the PC.
Thank you. I have so far added extra addresses (ie eth0:1, eth0:2...) to reach different GPSes. But that requires root, and I would rather want to avoid that.
 
Old 10-31-2016, 09:02 AM   #7
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
Your choices are limited.
 
Old 10-31-2016, 05:14 PM   #8
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,886

Rep: Reputation: 3615Reputation: 3615Reputation: 3615Reputation: 3615Reputation: 3615Reputation: 3615Reputation: 3615Reputation: 3615Reputation: 3615Reputation: 3615Reputation: 3615
You have two ways. One is to set subnet mask so that all ip addresses are in same subnet on both systems.


ORRRR do as I do.

I set a static arp entry for the device within my linux subnet. The default ip of the device could be any IP address but you want to set the arp entry for the mac address of the unit and within the linux subnet. Be sure to delete the static arp entry when you are done with it.

Nice to have a switch but it has nothing to do with the question other than possibly the ability to log into the switch and get the mac address. Usually the mac address is available for devices. If you do get the mac then write it on the device.

Last edited by jefro; 10-31-2016 at 05:17 PM.
 
  


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
can't ping hosts outside local network arunksit Linux - Networking 2 04-07-2009 12:34 PM
trivial: bash, local variable assignment agrestic Linux - Newbie 3 01-27-2009 12:30 PM
Suse 9.2 firewall prevents 'ping' on local network? Steerpike SUSE / openSUSE 5 11-27-2004 06:56 PM
networking - can't ping outside the local network w0lf42 Linux - Networking 3 04-10-2004 01:50 AM
Unable to ping or Traceroute or FTP from local network. retheesh Linux - Networking 3 10-15-2003 07:20 AM

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

All times are GMT -5. The time now is 03:37 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