how to set static ip to pc - ip

I use tor proxy and i set the tunnel port to 192.168.1.2:9050.
I also set my router dhcp that give 192.168.1.2 to my pc
but my problem is that sometimes I use another router or my phone hotspot and they give my pc anothre ip (like 192.168.43.164/24) . I can't set their dhcp. so tor doesn't work.
Is there any way to always get the same ip ?
Or Is there any way to refer my wifi ip (something like localhost that refer to 127.0.0.1) to set in tor?

Your phone hotspot gives you a different DHCP's IP because it is threated as another network bridging one network (your PC) to another one (current network connected on your phone).
If you are using wireless hotspot and connecting to your phone's network on wi-fi, that is not possible because tethering IP that is provided for your phone router to use DHCP services is hardcoded in com.android.server.connectivity.Tethering, unless you have root access privileges.
And that it the reason to your phone routing service (USB Bridged or Wi-Fi Hostpot) gives you always an 192.168.42.X IP address.
If you are using Android, you can get more details in this thread on Android Enthusiasts in Stack Exchange:
https://android.stackexchange.com/questions/46499/how-configure-the-dhcp-settings-of-wifi-tethering-hotspot-on-android

Related

Accessing connected devices to a local network wirelessly

Hello Everyone!
I want to know that is there any way to access a photocopier machine which is connected to a computer through Ethernet wire and that computer is connected to my WiFi network?
P.S: What if I don't know the IP assigned to that Photocopier machine?
If the wireless network is part of the wired network you should have any problem reaching the photocopier.
If you don't know the IP address, you can reach it by host name if the DHCP and DNS are working properly. If you are on an Active Directory infrastructure and DHCP and DNS are integrated it should be transparent.
If you are on your home with a "home" router they usually do the hostname to IP resolve (DNS).
You can nslookup hostname in your machine to see if your dns is resolving the ip address. you can also ping hostname or ping ip address to test that you can reach the desired host. Some hosts block ping (ICMP) requests, please note that ping is ping does not respond is not a definitive solution.
Please note that in your home router you should use your router or default gateway to be the DNS also, and then add the google public DNS or your ISP.
Also when connecting the access point to an existing network you may have 2 DHCP servers providing IP addresses to hosts, you should disable DHCP on the Access Point and connect the AP to the network using the switch port and not the WAN port (the WAN port will try to do NAT and assign a different set of IP addresses).

two routers in one network; one as gateway, one as DHCP server

My ISP changed their network configuration and now my home setup is not working anymore. I had one Asus router which features like QoS and parental control, my physical network consists of UTP, powerlan and wifi.
In the new setup I'm required to run a new router (functionally crippled) to handle IPTV and telephone, but I would still like to run all my LAN traffic through my Asus for the additional functionality it provides. Not a problem I thought, until it turned out that the IPTV units are required to be connected directly to the new router. Which means all other systems using the powerlan (a.o. a Wifi Access Point) also bypass the Asus. Parental control is useless.
Is there anyway I can setup the new router to only function as a gateway, and let everything go though the Asus?
This setup did not work: internet <-> [extern IP] newrouter [192.168.2.254] <-> [192.168.2.253] Asus [192.168.2.1] <-> LAN [192.168.2.100-199]
The new router has 254 as its LAN IP
The Asus has a static WAN ip of 253, and its LAN IP to 1 (with 254 as the gateway).
DHCP hands out IP configs with 1 as the gateway
Theoretically this means any LAN device getting an IP will send to the Asus on IP 1, it forwards that via 253 to the new router at 254, which pushes it out to the internet.
But alas. Any suggestions if this can be made to work?
I cannot change the subnet on the new router, it is blocked to 255.255.255.0.
I do want wat to run switches everywhere to setup a VLAN.
You could just use a different subnet for your asus router.
e.g. use the 192.168.2.1 address for your asus router and configure DHCP to hand out IPs of that network (192.168.2.x). Then configure your new Router to have the IP 192.168.1.1.
Now add a static route from your asus router to your new router and the other way round. That way every device in the 192.168.2.x network has to go through your asus router.
Of course that does only work if you can configure routes on your new router.

Connect ethernet PC to other wifi connected devices (the same router)

I have a PC (Windows 10) connected to my router through an ethernet cable. I also have a few devices connected to the same router. What I would like to do is make them "see" each other. I want to transfer files from my phone to my pc and back using ES File Explorer. I want to Broadcast movies to my smart TV using apps like Wondershare.
My PC is visible for other devices but I can't seem to find it using my TV or phone. Therefore... i guess all these devices are not connected to the same "mini-network". I don't know how to call it.
What should I do?
If you are in the same subnet as the router and there are no firewall rules blocking it, you should be able to see the devices on your computer. If you go to your phone settings, search for the IP and try to ping it with the command line of your choice. If it does not work, compare the subnet mask and ip address of your devices, make sure they are in the same subnet.
On windows the command is: ipconfig on linux: ifconfig or the new form: ip addr

Same ip address for multiple devices?

I want to develop an Android app that connects with a Windows desktop application via TCP/IP.
However I have very little knowledge of networking and so please forgive me if this is a very basic doubt.
My Windows based laptop as well as Android phone are connected to the internet via the same WiFi router.
Now I checked the IP address for my laptop as well as phone using a website.
Both are same!
If both have the same IP address, then to achieve networking between these devices I will choose different set of port numbers.
Will this connection work?
Is the connection happening via the internet or just locally on my
router?
EDIT: After reading the answer from #Doon, I have broadened my question.
Let's say the local address of laptop is 192.168.1.10 and that of phone is 192.168.1.20.
If I code my application to use these IP addresses, it should work as it is a local network.
But what if I want my laptop to connect with another phone which is not connected to the WiFi router, rather by 3G network.
Then which IP address should be used for the laptop and the other phone?
Since I am not allowed to use any other server, I am going to use port forwarding i.e. the user will type in the IP address displayed on the other device. The connection could be initiated on either one of the devices.
If you could also show how to do this programmatically, it would be very helpful.
My Windows application is developed in C++ using Qt.
All of your devices are sharing 1 external or WAN IP address using NAPT (network address port translation). Internally on your LAN each device has its own address. So yes it will work but you are going to need to use internal addrss and the devices actual IP address not its perceived address via an external service.
As for the connection locally or via router that all depends on where you are connecting to. If both end points are on your lan or on the same Subnet then the router will not be involved. So in the average home network between your phone and desktop both connected to the same network say via wifi then they are most likely layer 2 adjacent (see the OSI 7 layer model for more info on layer 2 vs layer 3). But once they are not on the same network then routing will be involved and your router will be used. If the phone is connected to 3G or the cell data network and you want it to talk to your desktop on your home network you are going to need to deal with port forwarding on your router and other such fun things.
In regards to updates. Once you leave the local network it gets more complicated especially with IPv4 as address are running out so there is more and more use of nat or IPv6 with 6 to 4 gateways. Do you want the laptop to initiate connect to the phone or phone to the laptop? But normally you will need to iterate your address on your interfaces. Then connect with an external service to get your external IP address and compare and see if they are the same. if both endpoints are dynamically assigned you will need some sort of location mechanism could be dynamic DNS could be locator service etc.

Setting a networked pc to keep its IP

Is it possible to have one of our networked PC's to keep using the same IP address (192.168.1.54) so that if the master computer or a failure / shutdown etc happens then the system IP addresses are not reset so i don't have to update all the other pc's hosts files to this PC's new IP address?
You will need to make a reservation based on the MAC address of your network card. You can find this by typing "ipconfig /all" inside the command prompt.
The IP addresses can be reserved on your router or on your server depending on how they are distributed.
You should solve this in the DHCP server (typically in your router), make a reserved IP for the mac-address of the PC in question. Or you configure the PC to not use DHCP but configure a fixed IP. But that should be, if possible, an IP that is not in the DHCP range.

Resources