Thank you very much Sylvain. Your nice solution answers my first question. In fact, I stumbled upon brctl once or twice in the past and I remember that working with it sometimes led to unpredictable results (like losing communication with my machine). Yet, I'm still unsure about my second question - is there a worthy linux alternative to winpcap that works well with lwip and doesn't require adding a new device?
Thanks a lot guys, Enrique. On Sun, Oct 20, 2013 at 9:31 PM, Sylvain Rochet <[email protected]>wrote: > Hi Enrique, > > On Sun, Oct 20, 2013 at 11:33:11AM +0200, Enrique Wellborn wrote: > > Hi, > > I was wondering whether it is possible to use the lwip linux port so that > > it'll use an ip address on my existing subnet. > > The scenario i'm trying to create is as follows: > > My Ubuntu machine has a single ethernet device (eth0) with ip: > > 192.168.0.3/24, gw: 192.168.0.1. > > I want to create an lwip application that will have ip addr 192.168.0.4 > and > > the same mask and gw. > > I managed to do it using the windows port (that utilizes winpcap for the > > task) and it worked great, but when I'm running the simhost app(from the > > linux port) with the relevant arguments it just fails (I think it has > > something to do with it trying to create a tun device with an ip address > > that belongs to the existing subnet of eth0). > > So, I have 2 questions: > > 1. Is it possible to create a tun device with ip addr in the existing > > subnet of eth0? > > 2. Is there a linux alternative for winpcap that works well on linux (I > saw > > that pcap was not supported on linux), in a way that will enable the > above > > scenario? > > What you are looking for is a Linux bridge: > > brctl addbr br0 > ifconfig br0 192.168.0.3 netmask 255.255.255.0 > ifconfig eth0 0.0.0.0 > route del default # probably not nessary > route add default gw 192.168.0.1 > ifconfig br0 up > brctl addif br0 eth0 > brctl addif br0 tap0 # once lwIP is running > ifconfig tap0 up > > brctl show # should display the following: > bridge name bridge id STP enabled interfaces > br0 xxx no eth0 > tap0 > Sylvain > > _______________________________________________ > lwip-users mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/lwip-users >
_______________________________________________ lwip-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/lwip-users
