OS/2

TCP/IP in OS/2 Warp 4.5

posted Apr 18, 2011, 6:42 AM by hyunghwan chung   [ updated Nov 25, 2011, 6:13 AM ]

Let me document some basic TCP/IP stuffs for OS/2 Warp 4.5 in the form of FAQ as a memo to myself. I seem to forget these easily as OS/2 is not my primary operating system. The information contained in this page is purely based on my experience and I don't guarantee correctness and/or completeness.



Q. What is the simplest way to configure TCP/IP?
A. Open TCP/IP Configuration Notebook from WPS or by executing tcpcfg2 from the command line.



Q. Can I configure it from the command-line?
A. Yes, OS/2 provides common networking utilities like ifconfig. See examples below.

 Command Description
 ifconfig lan0
 Show the current configuration of the first LAN interface
 netstat -r
 Show the routing table
 arp -a
 Print the arp table
 tracerte www.google.com
 Print route packets on the way to www.google.com
 iptrace lan0
 Capture packets transmitted over lan0 into iptrace.dmp
 ipformat -f iptrace.dmp
 Print iptrace.dmp in a human-readable format

You can find more networking utilities in C:\MPTN\BIN. You can get help on them by executing tcphelp.



Q. What file initializes a NIC with an IP address upon start-up?
A. C:\MPTN\BIN\SETUP.CMD. The TCP/IP Configuration Notebook can overwrite this file as necessary.

The file shows the following contents when I enable DHCP on the first LAN interface.

[C:\]type \mptn\bin\setup.cmd
route -fh
arp -f
ifconfig lo 127.0.0.1
REM ifconfig lan0 nil
REM ifconfig lan1 nil metric 1 mtu 1500
REM ifconfig lan2 metric 1 mtu 1500
REM ifconfig lan3 metric 1 mtu 1500
REM ifconfig lan4 metric 1 mtu 1500
REM ifconfig lan5 metric 1 mtu 1500
REM ifconfig lan6 metric 1 mtu 1500
REM ifconfig lan7 metric 1 mtu 1500
dhcpstrt -i lan0
REM ifconfig sl0
ipgate off

When I switches to a static IP address of 192.168.2.21 with the default gateway of 192.168.2.1, it shows the following.


[C:\]type \mptn\bin\setup.cmd
route -fh
arp -f
ifconfig lo 127.0.0.1
ifconfig lan0 192.168.2.21 netmask 255.255.255.0 metric 1 mtu 1500
REM ifconfig lan1 nil metric 1 mtu 1500
REM ifconfig lan2 metric 1 mtu 1500
REM ifconfig lan3 metric 1 mtu 1500
REM ifconfig lan4 metric 1 mtu 1500
REM ifconfig lan5 metric 1 mtu 1500
REM ifconfig lan6 metric 1 mtu 1500
REM ifconfig lan7 metric 1 mtu 1500
REM ifconfig sl0
route add default 192.168.2.1 -hopcount
ipgate off



Q. How can I change my host name?
A. You can set the host name by setting HOSTNAME in config.sys.

[C:\]find "HOSTNAME" c:\config.sys

---------- c:\config.sys
SET HOSTNAME=panda

Alternatively, you can open TCP/IP Configuration Notebook and enter the host name in the Host Names tab as shown below.


Note:
  • The host name is different from the NetBIOS computer name you can set in C:\IBMLAN\IBMLAN.INI.
  • The host name doesn't map to an IP address of your computer automatically. You may need to create an entry in %ETC%\HOSTS.


Q. What is the counterpart for /etc/resolve.conf in *nix?
A. %ETC%\RESOLV2

[C:\]type %ETC%\RESOLV2
domain abiyo.net
nameserver 8.8.8.8
nameserver 8.8.8.4

You may use TCP/IP Configuration Notebook to change the contents of this file instead of modifying it directory.



Q. Where can I find the simple host name lookup information like /etc/hosts in *nix?
A. %ETC%\HOSTS

[C:\]type %ETC%\hosts
127.0.0.1             localhost

You may use TCP/IP Configuration Notebook to manipulate the host names in this file.




Q. How can I make a TCP/IP program resolve a host name via the host file before having contacted a domain name server?
A. You can change the default behavior of contacting a domain name server by setting the environment variable USE_HOSTS_FIRST. Setting this environment variable regardless of its value makes a properly written TCP/IP program resolve a host name via the host file first, then try a domain name server.

Let's assume the following sample host file.

[C:\]type %ETC%\hosts
127.0.0.1      localhost
192.168.1.3    www.yahoo.com

Make sure that USE_HOSTS_FIRST is not set.

[C:\]set USE_HOSTS_FIRST=

[C:\]set USE_HOSTS_FIRST
USE_HOSTS_FIRST=(null)

Pinging to www.yahoo.com sends ICMP packets to the IP address resolved via a domain name server.

[C:\]nslookup www.yahoo.com
Server: google-public-dns-a.google.com
Address: 8.8.8.8

Non-authoritative answer:
Name: any-fp.wa1.b.yahoo.com
Addresses: 72.30.2.43, 98.137.149.56
Aliases: www.yahoo.com, fp.wg1.b.yahoo.com


[C:\]ping www.yahoo.com
PING any-fp.wa1.b.yahoo.com: 56 data bytes
64 bytes from 72.30.2.43: icmp_seq=0. time=110. ms
64 bytes from 72.30.2.43: icmp_seq=1. time=110. ms

----any-fp.wa1.b.yahoo.com PING Statistics----
2 packets transmitted, 2 packets received, 0% packet loss
round-trip (ms) min/avg/max = 110/110/110

The behavior changes after having set USE_HOSTS_FIRST. The ping program sends ICMP packets to 192.168.1.3 instead.

[C:\]set USE_HOSTS_FIRST=1

[C:\]set USE_HOSTS_FIRST
USE_HOSTS_FIRST=1

[C:\]ping www.yahoo.com
PING www.yahoo.com: 56 data bytes
64 bytes from 192.168.1.3: icmp_seq=0. time=10. ms
64 bytes from 192.168.1.3: icmp_seq=1. time=0. ms

----www.yahoo.com PING Statistics----
2 packets transmitted, 2 packets received, 0% packet loss
round-trip (ms) min/avg/max = 0/5/10

You can add the environment variable to CONFIG.SYS to make the new behavior permanent.

[C:\]find "USE_HOSTS_FIRST" c:\config.sys

---------- c:\config.sys
SET USE_HOSTS_FIRST=yes

If you don't like to change config.sys manually, you can open TCP/IP Configuration Notebook and check Look through Hosts list before going to Name Server.





    

Accessing Windows/Samba Shares from OS/2

posted Mar 13, 2011, 6:14 PM by hyunghwan chung   [ updated Dec 1, 2011, 5:12 PM ]

This page shows how to configure OS/2 Netbios over TCP/IP on OS/2 Warp 4.5x to access Windows/Samba shares.

Run MPTS Network Adapters and Protocol Services by choosing it from under OS/2 System - System Setup or typing mpts from the command window.


Click OK.


Click Configure.


Keep LAN adapters and protocols selected and click Configure.


Choose IBM OS/2 NETBIOS OVER TCP/IP in Protocols and click Add.


Then it is added to Current Configuration.


Remove IBM OS/2 NETBIOS from Current Configuration assuming that you access Netbios over TCP/IP only.


Choose IBM OS/2 NETBIOS OVER TCP/IP from Current Configuration and Click Edit. Choose Names list and click Configure.


Add computer names to access with an IP address or a host name. Netbios commands like net use on OS/2 cannot access a computer with a host name or an IP address directly. You should assign a separate computer name to a host name or an IP address and use the computer name to access a share on the computer. In the sample above, I've added a computer name tpedge with an IP address of 192.168.2.1. The computer names added here are stored into C:\IBMCOM\RFCNAMES.LST.


Note that the maximum number of entries into the Names list is determined by the Maximum number of name-ip address pairs in names file parameter. You may have to adjust the value for this parameter depending on the number of computers to access. To edit the value, choose Driver parameters and click OK in the NETBIOS over TCP/IP dialog box.


You can exit to the following dialog box by clicking Close and OK a few times.


Once you reach here, you can click Exit.

But this MPTS configuration program misses a critical change that must be made to C:\IBMLAN\IBMLAN.INI. The glitch is that it doesn't change NETBEUI$ to TCPBEUI$ though IBM OS/2 NETBIOS was removed IBM OS/2 NETBIOS OVER TCP/IP was added.


You need to make a manual change from NETBEUI$ to TCPBEUI$ before you reboot the system. Note that the number 0 after TCPBEUI$ must match the number shown in Current Configuration of the Adapter and Protocol Configuration dialog.


You can Save the change and reboot the system.


If a share on the computer is password protected, you may log on to the network with the logon command. Assuming that there is no domain controller or LAN server, you can execute it without verification.

[C:\] logon /v:none

It will present a dialog where you can type a user ID and a password since none of them were provided on the command-line.


You can mount a share with the net command. The following example maps a share named public from the computer tpedge to the drive X:.

[C:\] net use x: \\tpedge\public

You may unmap the drive by executing this.

[C:\] net use x: /delete

You may view shared resources by executing something like this.

[C:\] net view \\tpedge

You may log off from the network by executing this.

[C:\] logoff /l


Notes on the server side configuration
The tcpbeui protocol on OS/2 Warp 4.5 seems to be able to talk legacy LAN manager protocol only. It's important that the server should support this legacy protocol.

If you're using Samba, you can check if it is enabled by executing this.

$ testparm -v < /dev/null | grep lanman

Another thing you should not forget to check is the lanman hash field of a user account. If the password of a user account is set before lanman authentication is enabled, it's likely that the account contains X's in the lanman hash field as shown below for the user tiger, meaning that the account is disabled for legacy lanman authentication.

$ pdbedit -Lw tiger
tiger:8001:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:D7F50F219262C3AB983A7907386CC34D:[U          ]:LCT-4ECF9213:

You can enable such an account for lanman authentication by setting the password again with smbpasswd.

1-2 of 2