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.





    
ą
hyunghwan chung,
Jul 28, 2011, 8:16 AM
ą
hyunghwan chung,
Jul 28, 2011, 8:11 AM
ą
hyunghwan chung,
Jul 28, 2011, 8:19 AM
Comments