networking - How to implement virtual network interface -


i trying write program simulate virtual network interfaces. program runs on linux pc, denoted a, connected router, denoted r, , a has 1 physical network interface eth0 ipv4 address, say, 192.168.1.2. program can obtain multiple different ipv4 addresses router via dhcp, say, 192.168.1.3, 192.168.1.4, ... (i have done part making virtual mac address). need next that, when physical pc, denoted b, connected router r, tries communicate 1 of ipv4 addresses obtained program (not 1 assigned physical interface, eth0, of a), say, 192.168.1.3 should appear b 192.168.1.3 "real" network interface. example, if b ping 192.168.1.3, should able receive response 192.168.1.3 (even thought packet pass through a's physical network interface eht0). in addition, program should able extract ip packet on virtual interface whole packet received.

in other words, program wants accomplish "bridged network" in virtual machines virutalbox or vmware player.

can please tell me should start with? should use tap? there existing libraries use? or should create link layer socket purpose? (i read "datalink access" in richard stevens's unix network programming, info not quite detailed.) thanks, tom

from understanding of requirement, can use subinterfaces. can split eth0 multiple interfaces eth0:1 eth0:2 etc. can assign ip each of these interfaces , use them regular interfaces. can run run tcpdump/wireshark on these subinterfaces , capture packets wish.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -