Python Forum
is it possible to run commands on a device which is two servers away from our PC in P
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
is it possible to run commands on a device which is two servers away from our PC in P
#1
Hello Guys

I want to run python script in PC to connect to a router which can be accessed via 2 jump server, and the command out put should come my PC ,below is the scenario.if it possible how to do it in Python.

PC-----> Server1------------>Server2-------->Router

Thanks in Advance
Reply
#2
SSH? Or, if all the machines are behind your firewall, telnet?

How would you do it without python?
Reply
#3
Welcome!

Just login to the desired server and run the command. If you can't reach it I doubt that you could manage the router ;) If I am net admin I won't allow such a thing.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#4
You'll have to port forwarding the data stream:

PC_IP:3000  <-> 3000:SERVER_1_IP:3001 <-> 3001:SERVER_2_IP:3000 <-> 3000:ROUTER_IP
With port forwarding every data that arrives at port 3000 (just for example) will be forward to the port 3001 (example)
Reply
#5
(Jun-20-2018, 05:25 PM)Nirosh123 Wrote: Hello Guys I want to run python script in PC to connect to a router which can be accessed via 2 jump server, and the command out put should come my PC ,below is the scenario.if it possible how to do it in Python. PC-----> Server1------------>Server2-------->Router Thanks in Advance

(Jun-20-2018, 05:39 PM)nilamo Wrote: SSH? Or, if all the machines are behind your firewall, telnet? How would you do it without python?

Thanks for your reply,
On servers I do it using SSH and on Routers few with SSH and few with Telnet

(Jun-20-2018, 05:41 PM)gontajones Wrote: You'll have to port forwarding the data stream:
PC_IP:3000 <-> 3000:SERVER_1_IP:3001 <-> 3001:SERVER_2_IP:3000 <-> 3000:ROUTER_IP
With port forwarding every data that arrives at port 3000 (just for example) will be forward to the port 3001 (example)

Thanks friend for your reply, do your have any good document to refer
Reply
#6
(Jun-21-2018, 11:05 AM)Nirosh123 Wrote: Thanks friend for your reply, do your have any good document to refer

Search for port forwarding for the OS of both servers and for the specific router model.
It is not a big deal. If the servers are running Linux, you can do it using "iptables".

Let us know about your progress.
Reply
#7
(Jun-21-2018, 11:32 AM)gontajones Wrote:
(Jun-21-2018, 11:05 AM)Nirosh123 Wrote: Thanks friend for your reply, do your have any good document to refer
Search for port forwarding for the OS of both servers and for the specific router model. It is not a big deal. If the servers are running Linux, you can do it using "iptables". Let us know about your progress.

Thank You, I will update you on thos
Reply
#8
(Jun-21-2018, 11:05 AM)Nirosh123 Wrote:
(Jun-20-2018, 05:25 PM)Nirosh123 Wrote: Hello Guys I want to run python script in PC to connect to a router which can be accessed via 2 jump server, and the command out put should come my PC ,below is the scenario.if it possible how to do it in Python. PC-----> Server1------------>Server2-------->Router Thanks in Advance

(Jun-20-2018, 05:39 PM)nilamo Wrote: SSH? Or, if all the machines are behind your firewall, telnet? How would you do it without python?

Thanks for your reply,
On servers I do it using SSH and on Routers few with SSH and few with Telnet

Ok, then do it with python using ssh or telnet. The approach using python won't be any different from what you already do, you'll just be automating it.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  how to manage crypto trading flooding data from exchange servers Mikeardy 0 1,209 Dec-26-2021, 08:31 PM
Last Post: Mikeardy
  Sending string commands from Python to a bluetooth device Rovelin 13 9,272 Aug-31-2021, 06:40 PM
Last Post: deanhystad
  Improves performance on socket multi-threaded servers for object detection pennant 1 1,854 Aug-31-2021, 08:43 AM
Last Post: Larz60+
  Reading UDP from external device without device software ikdemartijn 2 3,334 Dec-03-2019, 04:29 PM
Last Post: Larz60+
  Create a directory structure across many servers metro17 1 1,725 Nov-05-2019, 03:35 PM
Last Post: Larz60+
  OOP and module approaches in a simple app monitoring list of servers hjzxxzjcz 1 41,255 Nov-01-2019, 04:30 PM
Last Post: nilamo
  Alternative for input() suitable for servers winnetrie 4 3,671 Jan-06-2019, 04:54 PM
Last Post: micseydel
  Display device details i.e connected with more than one device shintonp 6 5,246 May-10-2017, 06:00 AM
Last Post: shintonp

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020