I have a quick question that I've been wondering about ever since I started socket programming in Python. I'm working on a server/client chat system for sending messages between computers connected to my LAN. My question is: is my LAN completely isolated from the WAN or does it have some kind of connection to it? and if so, how do I isolate my network?
the computers are connected to an all in one router/modem via ethernet cable. Also, the computer which will be running the server has another wireless connection to the internet (connected to the same modem/router but wirelessly)
I hope this makes sense, thanks for reading.
I want all traffic on my LAN to stay private and isolated so only computers in my home network can connect to the server.
Related
I have a router that makes it extremely difficult to run port-forwarding through it. Plus, I would rather be able to just pretty much plug my Pi in and have my server running. Setting up a Raspberry Pi as a wireless access point is pretty easy and straight forward. I would like to have a python server, which runs on the same Raspberry Pi, that allows me to run a public server off of the access point. So basically instead of having to use port forwarding with my router, the server made with sockets in python uses the access point to be public. is this something that sounds possible?
update This is NOT for local use, I want it to be a server that I could connect to states away
I wonder and i've been trying everything to get my program with python sockets to work remotely. When I say remotely is like, I run the server in my computer and my friend at his house can run the client and connect to my server. Is this possible without using Hamachi? Pls let me know, because I'm already dying by trying so many things and installing and uninstalling programs.
You have to activate port forwarding on your router so that everything that comes on the specific port is forwarded to your local IP (and the port should be open).
I have just written some python server and client using tcp protocol. I am using linux, and want to connect to a windows machine which isn't in my local network. How can i do that? I know it is something about NAT, but i can't find out how to do it properly. Could you please give me step by step guide? Thanks.
Just use sockets? You need to ensure that the network the windows laptop is on is configured to forward a specified port to the laptop. (means it can be accessed externally) You can then use sockets to connect to the laptop on the port you designate.
Is there anyway to use TCP/IP communication between a Beaglebone Black and PC connected only by USB cable?
I'm try to create an oscilloscope using a Beaglebone Black ADC connected to a computer using a USB cable.
I know that when I connect my BBB (Beaglebone Black) I can access it by its ip 192.168.7.2 and I see this device on my local network if I use ipconfig on cmd (I'm using Windows 10), and if I ping on this IP I receive the data. But on the Beaglebone side I cannot see my computer on its network or ping to my computer local address.
Also I tried to use a basic python socket connection tutorial between my PC and BBB, here (PC as server and BBB as client):
https://pymotw.com/2/socket/tcp.html
And I receive connection denied on my BBB.
Just to remember, I'm not pretending to solve it using an Ethernet cable or WiFi module.
I'm still working on DHCP via RNDIS and Gadget Ethernet on Arch Linux, but on Ubuntu it works flawlessly. You may need some additional commands, but the general idea is to enable Gadget Ethernet using g_ether on the beaglebone.
I am assuming that you are using Angstrom. You will likely need to modify /etc/network/interfaces and ensure that it is configured for DHCP.
[BeagleBone Black]
insmod g_ether
echo "g_ether" > /etc/modules-load.d/gadget_ethernet
iface usb0 inet dhcp (/etc/network/interfaces)
Connect to USB port on Ubuntu. Share the internet connection using Ubuntu (require IPv4 to complete). Ensure that you have the BeagleBone SSH service enabled and the port opened on both Ubuntu and BeagleBone.
[Ubuntu]
nmap 10.42.0.0/24
ssh to the IP address that Ubuntu gave to the BeagleBone via USB.
I have Arch Linux Arm installed. For your application, I recommend Arch Linux Arm, which installs without a graphical user interface.
You can send an outgoing ping so you know that a TCP/IP connection can be established. However that is an outgoing connection and you are wanting to accept and incoming connection.
Check your firewall settings on your development machine, if the incoming connection is denied there you will not be able to connect. The outgoing ping might make it through the firewall but the incoming connection can still be denied. Because you know you can connect I would recommend checking the firewall rules allow an incoming connection to be made.
If you need to debug further go and get Wireshark and see what traffic is going over the wire.
You need to set up a Static IP address in order for the BBB to use the USB Ethernet connection.
Derek Molloy explains it here: http://derekmolloy.ie/set-ip-address-to-be-static-on-the-beaglebone-black/
Overview:
I have a device sitting on a local network to a computer that is sitting on an outside network. I would like to create a software program that allows me to seamlessly connect to the device from a computer on a different network. For purposes of this question, I've created a picture to help describe the network flow. What I need help with is what python packages I would need to develop the solution for this problem.
Details:
I have a computer MYPC (IP address 192.168.0.168) that is attached to the internet running through a proxy server (ROUTER1). I have full control over MYPC's environment, which is running Linux.
I have a second computer SOMESERVER (IP address 192.168.1.168) that is attached to the internet running through a proxy server (ROUTER2). In addition, SOMESERVER (IP address 10.0.0.159) is also attached to a local network (LOCAL). SOMESERVER is running windows. I have very limited control with SOMESERVER: I am able to send an executable to SOMESERVER that can run once before it is removed. I do not know the internet/world IP address of the ROUTER2 initially.
I have a device (DEVICE1) attached to SOMESERVER through LOCAL (IP address: 10.0.0.157).
I have another device (DEVICE2) attached to SOMESERVER through LOCAL (IP address: 10.0.0.158). DEVICE(x) runs linux. I have python on DEVICE(x) and I could install a pure python package if I needed to. However, I do not have the ability to compile for DEVICE(x).
I can connect between SOMESERVER and MYPC through the internet using SSH over ROUTER1 and ROUTER2. I can connect between SOMESERVER and DEVICE1 through the local network (LOCAL) using Telnet. I can connect between SOMESERVER and DEVICE2 through the local network (LOCAL) using Telnet.
I want to send a program to SOMESERVER that allows me seamless access over SSH and Telnet to DEVICE1 and DEVICE2 from MYPC. In addition, I want that program to be running python.
Here's a picture that helps explain the above problem:
Solution:
What I think I want is as follows. I need help with the details and what packages I might need to make it happen.
Part 1: The Dial Home Client and Server
Create a "dial home" server program (DIAL_HOME_SERVER) for MYPC which listens for any one dialing home and then will "dial into" any SOMESERVER that "dials home" using SSH.
Create a "dial home" client program (DIAL_HOME_CLIENT) for SOMESERVER which is downloaded as part of a package
Part 2: The Proxy Server
Create a ssh to telnet proxy server program (PROXY_SERVER) for SOMESERVER which listens for connections from MYPC and funnels them into a telnet connection to DEVICE(x).
Thanks to Greg Hewgill, it sounds like I can use Paramiko to pull together the PROXY_SERVER code on SOMESERVER. It appears that Paramiko also requires PyCryto, and the Windows binary for it can be found here.
Future Robustness
At a future date, the telnet connection will be replaced with an SSH client (dropbox on DEVICE(x)).
In Closing
I think the above will allow MYPC to connect "seamlessly", but the details of how to put together these programs is unknown to me. I already know how to package up a python program using Innosetup and/or py2exe. What I'd love to see is links pointing to different pieces of the solution so I can pull it all together. And then I can post it.
Thanks in advance!
I have to admit that I didn't quite follow all of your description, especially the "dial home" client/server part. However, your diagram seems sufficient for understanding.
Set up port forwarding on "router2" that forwards the incoming SSH port to your Windows server.
Write a Python program (you will probably find paramiko helpful) that runs on your Windows server, listens for SSH connections, and opens a telnet connection to one of your devices on the back end.
That seems sufficient to me. If you've got weird restrictions on the Windows server about only being able to run an executable once before it is deleted, that seems like another problem to solve that doesn't really relate to this tunnelling problem.