Reputation: 10131
I'd like to learn and play with tcp/ip libraries for python, java or c++. But I only have one computer. Is it possible to "fake" remote computers to emulate remote hosts, under NAT end everything?
Upvotes: 2
Views: 388
Reputation: 3651
Run to server to listen on your network adapter, or localhost. Then issue requests to that same IP and Port. Logically, it will all take place within the network driver(s), but it will still behave the same way if that IP address were addressed to another machine (barring Firewall configurations, etc)
Upvotes: 1
Reputation: 2967
Use virtual box to install OS in your system. for any networking application, this is best. You dont have to work on two different system and its easy to see whats happening at both ends
Upvotes: 1
Reputation: 8716
The simplest way is to run both the server and client on the same computer and use the "loopback" IP address: 127.0.0.1 which always connects to the local host. I've done this many times during testing. For example, run a local webserver on port NNN and then in the browser enter http://127.0.0.1:NNN/ In fact, 127.X.Y.Z should always talk to the local machine.
Upvotes: 5
Reputation: 43077
If you are using linux, you can configure dummy
interfaces, then bind your client / server to different dummy interfaces.
[mpenning@Bucksnort ~]$ sudo modprobe dummy
[mpenning@Bucksnort ~]$ sudo ip addr add 192.168.12.12/24 dev dummy0
[mpenning@Bucksnort ~]$ ip addr show dummy0
6: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN
link/ether b6:6c:65:01:fc:ff brd ff:ff:ff:ff:ff:ff
inet 192.168.12.12/24 scope global dummy0
[mpenning@Bucksnort ~]$ ping 192.168.12.12
PING 192.168.12.12 (192.168.12.12) 56(84) bytes of data.
64 bytes from 192.168.12.12: icmp_seq=1 ttl=64 time=0.085 ms
^C
--- 192.168.12.12 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.085/0.085/0.085/0.000 ms
[mpenning@Bucksnort ~]$ sudo modprobe dummy -o dummy1
[mpenning@Bucksnort ~]$ sudo rmmod dummy
[mpenning@Bucksnort ~]$ ip addr show dummy0
Device "dummy0" does not exist.
[mpenning@Bucksnort ~]$
You should be able to run ipchains on these interfaces just like any other.
Upvotes: 2
Reputation: 40337
You can start out with talking between programs on your own computer.
You can use virtual machine software such as VirtualBox, VMWare, VirtualPC, etc to create what is essentially a second machine within yours and talk to that (though the network topology may be very slightly unusual - something more to learn about)
If you want to talk to something remote, you can rent a small cloud server running linux or windows from the likes of Amazon for pennies an hour and install whatever you want on it.
Upvotes: 1