|
||||||||
|
Next
Previous
Contents
16. Networking using DOSEmuA mini-HOWTO from Bart Hartgers <barth@stack.nl> ( for the detailed original description see below )
16.1 The DOSNET virtual device.Dosnet.o is a kernel module that implements a special virtual network device. In combination with pktdrv.c and libpacket.c, this will enable multiple dosemu sessions and the linux kernel to be on a virtual network. Each has it's own network device and ethernet address. This means that you can telnet or ftp from the dos-session to your telnetd/ftpd running in linux and, with IP forwarding enabled in the kernel, connect to any host on your network.
16.2 Setup for virtual TCP/IPGo to ./src/dosext/net/v-net and make dosnet.o. As root, insmod dosnet.o. Now as root, configure the dsn0 interface (for example: ifconfig dsn0 192.168.74.1 netmask 255.255.255.0), and add a route for it (for example: route add -net 192.168.74.0 netmask 255.255.255.0 dsn0). Finally, start dosemu, and give your TCP/IP client and ip-address in the subnet you just configured. This address should be unique, i.e. no other dosemu, or the kernel, should have this address. For the example addresses given above, 192.168.74.2-192.168.74.254 would be good. Now you can use a dos telnet client to telnet to your own machine!
16.3 Full DetailsModified description of Vinod G Kulkarni <vinod@cse.iitb.ernet.in> Allowing a program to have its own network protocol stacks. Resulting in multiple dosemu's to use netware, ncsa telnet etc. IntroductionAllowing network access from dosemu is an important functionality. For pc based network product developers, it will offer an easy development environment will full control over all the traffic without having to run around and use several machines. It will allow already available client-server based "front-ends" to run on dosemulator. (Assuming that they are all packet driver based -- as of now ;-) ) To accomplish that, we require independent protocol stacks to coexist along with linux' IP stack. One way is to add independent network card. However, it is cumbersome and allows at most only 2-3 stacks. Other option is to use the a virtual network device that will route the packets to the actual stacks which run as user programs.
DesignHave a virtual device which provides routing interface at one end (so it is a network device from linux side) and at other end, it sends/receives packets from/to user stacks. All the user stacks AND virtual device are virtually connected by a network (equavalent to a physical cable). Any broadcast packet (sent by either user stack or router interface of the virtual device) should be sent to all the user stacks and router. All non-broadcast packets can be sent by communicating with each other. Each user stack (here dosemu process) will have an base interface which allows sending and receiving of packets. On the top of this, a proper interface (such as packet driver interface) can be built. In dosemu, a packet driver interface is emulated. Every user stack will have a unique virtual ethernet address.
ImplementationThis package includes:
Virtual device 'dsn0'Compile the module dosnet and insmod it, and give it an IP address, with a new IP network number. And You have to set up proper routing tables on all machines you want to connect to. So linux side interface is easy to set up. This device is assigned a virtual ethernet address, defined in dosnet.h. This device is usual loadable module. (Someone please check if it can be made more efficient.) However, what is interesting is the way it allows access to user stacks (i.e. dosemu's.) i.e. its media interface. A packet arrives to dosnet from linux for our virtual internal network (after routing process). If it is broadcast packet, dosnet should send it to all dosemu's/user stacks. If it is normal packet, it should send it only particular user stack which has same destination ethernet address . It performs this process by the following method, using SOCK_PACKET interface , (and not introducing new devices).: The dosemu opens a SOCK_PACKET interface for type 'x' with the dosnet device. The result of this will be an addition of entry into type handler table for type 'x'. This table stores the type and corresponding handler function (called when a packet of this type arrives.) Each dosemu will open the interface with unique 'x' .
Packet driver codeI have add the code for handling multiple protocols. When a packet arrives, it arrives on one of the two SOCK_PACKET handle we need to find out which of the registered protocols should be handled this code. (Earlier code opened multiple sockets, one for each IPX type. However it is not useful now because we use *any* type.) When a new type is registered, it is added to a Type list. When a new packet arrives, first we find out the frame type(and hence the position of type field in the packet, and then try matching it with registered types. [ ---- I missed comparing class; I will add it later.] Then call the helper corresponding to the handle of that type. Rob, you should help in the following:
ConclusionSo at last one can open multiple DOSEMU's and access network from each of them ... However, you HAVE TO set up ROUTING TABLES etc. Vinod G Kulkarni <vinod@cse.iitb.ernet.in>
Telnetting to other SystemsOther systems need to have route to this "new" network. The easiest way to do this is to have static route for dosnet IP network included in remote machine you want to connect to. After all tests are carried out, one could include them permanently (i.e. in gated configurations etc.). However, the "new" IP address should only be internal to your organisation, and not allowed to route outside. There is some rfc in this regard, I will let you know later. For e.g., I am working on 144.16.98.20. Internal network I created was 144.16.112.0. (See the above route command.) To connect to another linux system 144.16.98.26 from dosemu, I include static route by running 'route add -net 144.16.112.0 gw 144.16.98.20' on that system. It becomes more complex if you need to connect to outside of 144.16.98.0.
Accessing Novell netwareSince dosemu is now on "different device", IPX needs to be either bridged or routed. If it is bridged, then there is no requirement for any extra administration ; simply run 'ipxbridge' program supplied with the dosnet sources. (There are two versions of it; 0.1 copies all packets to from/to both interface. 0.2 is "intelligent bridge", it copies packet to other interface only if the destination lies on other interface. ) If you instead want to use "routing" for IPX, then you need to enable IPX config option in the kernel. Next, you should select a network number that won't clash with others. Set up static direct ipx routes in linux, and then in one Novell netware server which is directly connected (i.e. without any router inbetween.). (That is where you should contact Novell sysadm's ;-) The idea is, the server acts as route broadcaster. (I haven't actually tested this; and we are working on getting proper daemons etc. which will make linux act as IPX router proper.) (You could include this info along with other documentation...) Hope this helps, Vinod. I just realised one more thing: The ipxbridge-0.2 code assumes that you have 'eth0' and 'eth1' as the two interfaces. And it uses this fact while choosing the interface to put the packet. So it won't recognise when 'dsn0' is used. ipxbridge-0.1 will work though. Also, note that both these programs put the card in promiscuous mode. So my suggestion is to "somehow" get IPX routing done by linux! Vinod. Next Previous Contents |
|||||||
The DOSEMU team |