The easiest (and not recommended) way to set up the networking in DOSEMU is to use the direct NIC access. It means that DOSEMU will exclusively use one of your network interfaces, say eth0. No other processes will be able to use that interface. If they try to, the data exchange will became unreliable. So you have to make sure that this network interface is not used by anything including the kernel itself, before starting DOSEMU. The settings for this method are as follows:
$_pktdriver = (on) $_netdev = "eth0" $_vnet = "direct"
As you can see, this simple method has many shortcomings. If you don't have the network card dedicated specially for dosemu, consider using more advanced method called "Virtual Networking".
Virtual networking is a mechanism that allows to overcome all the limitations of the direct NIC access method, but it requires more work to set up everything properly. A special virtual network devices can be created using TUN/TAP interface. This will enable multiple dosemu sessions and the linux kernel to be on a separate virtual network. Each dosemu will have its own network device and ethernet address.
First make sure that your Linux kernel comes with support for TUN/TAP; for details check Documentation/networking/tuntap.txt in the Linux kernel source. The user who runs DOSEMU should have read/write access to /dev/net/tun. Then either:
$_pktdriver=(on) $_vnet = "tap" $_netdev = ""
Start DOSEMU as usual and configure the network device while DOSEMU is running (using ifconfig manually as root, a script, or usernetctl if your distribution supplies that), e.g.
ifconfig tap0 up 192.168.74.1
Configure the DOS TCP/IP network clients to have another 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. Your network should now be up and running and you can, for example, use a DOS SSH client to ssh to your own machine, but it will be down as soon as you exit DOSEMU.
$_pktdriver=(on) $_vnet = "tap $_netdev = "tap0"
Obtain tunctl from the user mode linux project. Then set up a persistent TAP device using tunctl (use the -u owner option if you do that as root). Configure the network using ifconfig as above, but now before starting DOSEMU. Now start DOSEMU as often as you like and you can use the network in the same way as you did above.
Note, however, that multiple DOSEMU sessions that run at the same time need to use multiple tapxx devices. $_netdev can be changed without editing dosemu.conf/~./dosemurc (if you leave it commented out there) by using [x]dosemu -I "netdev tap1".
With the above you did set up a purely virtual internal network between the DOSEMU and the real Linux box. This is why in the above example 192.168.74.1 should *not* be a real IP address of the Linux box, and the 192.168.74 network should not exist as a real network. To enable DOS programs to talk to the outside world you have to set up Ethernet bridging or IP routing.
Bridging, using brctl (look for the bridge-utils package if you don't have it), is somewhat easier to accomplish than the IP routing. You set up a bridge, for example named "br0" and connect eth0 and tap0 to it. Suppose the Linux box has IP 192.168.1.10 on eth0, where 192.168.1.x can be a real LAN, and the uid of the user who is going to use DOSEMU is 500, then you can do (as root):
brctl addbr br0 ifconfig eth0 0.0.0.0 promisc up brctl addif br0 eth0 ifconfig br0 192.168.1.10 netmask 255.255.255.0 up tunctl -u 500 ifconfig tap0 0.0.0.0 promisc up brctl addif br0 tap0
If you like to use IP routing, note that unlike with bridging, each DOSEMU box will reside in a separate IP subnet, which consists only of 2 nodes: DOSEMU itself and the corresponding TAP device on Linux side. You have to choose an IP address for that subnet. If your LAN has the address 192.168.1.0 and the netmask is 255.255.255.0, the dosemu subnet can have the address 192.168.74.0 and tap0 can have the address 192.168.74.1:
ifconfig tap0 192.168.74.1 netmask 255.255.255.0 up
route add -net 192.168.74.0 netmask 255.255.255.0 dev tap0
Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.74.0 * 255.255.255.0 U 0 0 0 tap0
route add -net 192.168.74.0 netmask 255.255.255.0 gw 192.168.1.10
echo 1 > /proc/sys/net/ipv4/ip_forward
Yet one more thing have to be done if you want dosemu to be able to access Internet. Unlike in your LAN, you are not supposed to change the routing tables on an every Internet host, so how to make them to direct the IP packets back to dosemu's virtual network? To accomplish this, you only have to enable the IP Masquerading on the network interface that looks into Internet. If your machine serves as a gateway in a LAN, then the masquerading is most likely already enabled, and no further work is required. Otherwise you must add the following into your iptables configuration file (assuming the eth0 interface serves the Internet connection):
*nat -A POSTROUTING -o eth0 -j MASQUERADE COMMIT