I think I found a solution.

The problem was: 

When I choose "NAT" as network type for a VirtualBox FreeDOS 1.1 guest, only 
mTCP DHCP.EXE is able to get the correct IP addresses from the DHCP server 
provided by VirtualBox. WATTCP applications fail to get their IPs from that 
DHCP server.

The idea: 
Let mTCPs DHCP.EXE get the correct settings and write them to C:\FDOS\MTCP.CFG. 
Then extract them from MTCP.CFG and put them as fixed network settings into 

Dave pointed me to Minitrue and provided a batch file. So I experimented a bit 
and made some additions:
- no lines from MTCP.CFG are leftover in WATTCP.CFG
- all other settings in WATTCP.CFG stay intact and are not modified.

Get Minitrue 2.02 which is free software under GNU GPL. 

Copy the files into "C:\MTR202B".
Add "C:\MTR202B" to the PATH statement in AUTOEXEC.BAT
Make a batch file "C:\FDOS\M2WAT.BAT" with the following content:

@echo off
rem This batch file extracts IP settings from MTCP.CFG and
rem writes them into WATTCP.CFG.

rem 1. Make a backup of WATTCP.CFG
copy wattcp.cfg wattcp.bak

rem 2. Preserve the settings in WATTCP.CFG
copy wattcp.cfg wattcp.mtr

rem 3. Delete the settings we need to get from MTCP.CFG
mt -b- -c -n wattcp.mtr ^my_ip.*\n =
mt -b- -c -n wattcp.mtr ^IP.*\n =
mt -b- -c -n wattcp.mtr ^netmask.*\n =
mt -b- -c -n wattcp.mtr ^gateway.*\n =
mt -b- -c -n wattcp.mtr ^nameserver.*\n =
mt -b- -c -n wattcp.mtr ^hostname.*\n =

rem 4. Get the settings from MTCP.CFG
copy mtcp.cfg wattcp.cfg

rem 5. First comment out every line with a '#'
mt -b- -c -n wattcp.cfg (^) = #

rem 6. Now uncomment the ones we want, add equal sign and change if needed
mt -b- -c -n wattcp.cfg #ipaddr = my_ip=
mt -b- -c -n wattcp.cfg #netmask = netmask=
mt -b- -c -n wattcp.cfg #gateway = gateway=
mt -b- -c -n wattcp.cfg #nameserver = nameserver=
mt -b- -c -n wattcp.cfg #hostname = hostname=

rem 7. Remove all lines leftover from MTCP.CFG
mt -b- -c -n wattcp.cfg #.*\n =
mt -b- -c -n wattcp.cfg # =

rem 8. Append all the other settings from the original WATTCP.CFG
type wattcp.mtr >> wattcp.cfg

rem 9. Clean up.
del wattcp.mtr


Now you can insert a line
after the line

Conclusion: I can now use FreeDOS 1.1 as a VirtualBox guest with NAT networking 
and DHCP. I can FTP from host to guest by using Port Forwarding in VirtualBox. 
I don't have to be connected to a network anymore to exchange files between 
host and guest with FTP (see previous mail). mTCP and WATTCP applications work 

I know the above solution is a bit ugly and can be improved. For instance it is 
not as elegant as DHCP.COM by David Dunfield, which inserts the network 
settings exactly into the places they had in the original WATTCP.CFG. So if 
anyone has more ideas, please come forward.


Slashdot TV.  
Video for Nerds.  Stuff that matters.
Freedos-user mailing list

Reply via email to