Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I wish to test a networking application between two computers connected by LAN. These computers will have different IP addresses.

I have only one computer.

How to simulate two computers connected with LAN and having different IP addresses when I have only one computer?

Platform: Linux.
Language: C
share|improve this question
    
Probably use one (or two, if you want to isolate from your host environment) virtual machines. Alternatively, you might be able to get away with just using different ports on loopback (or configuring routing such that a private IP is locally routed back to loopback). –  Bob May 13 '13 at 4:18
    
@Bob Could you explain please "how" to use virtual machine such that the physical computer sees the other's IP address? –  TheIndependentAquarius May 13 '13 at 4:19
    
What? Set up a virtual machine, set up networking depending which VM software you are using, plenty of guides, etc.. There's a reason I posted that as a comment and not an answer, but even as an answer I'd expect you to be able to search for yourself given a nudge in the right direction, not a step by step guide. A step by step guide to setting up VM networking would likely be closed as a duplicate anyway. –  Bob May 13 '13 at 5:00
5  
@AnishaKaul virtualbox networking => virtualbox.org/manual/ch06.html <= take a look at internal and host only, since you should not need to access it from other computers on the host's physical network. –  Bob May 13 '13 at 6:06
1  
@user462608 No, you won't, though it would help immensely if your CPU had hardware virtualisation support. VM networking is all software. Internet networks are just between VMs, while host-only networks create an additional interface on the host to add it to the network. NAT provides internet access out to the external network, while bridged provides access in and out (you probably won't need that). –  Bob May 29 '13 at 8:36
show 7 more comments

1 Answer

up vote 1 down vote accepted

You might want to give LXC a try. If provides lightweight virtualization (=not much resource usage) and every virtual environment has a separate network stack. You can also access the VE's disk space from the host operating system to compile your applications directly, or even bind mount a directory into them.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.