home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 May / PCO_5_97.ISO / FilesBBS / OS2 / OS2WWW42.ARJ / OS2WWW42 / OS2WWW42.ZIP / SYS402.R4 / ADMIN / WIZARDS / MULTIP3.INC < prev    next >
Encoding:
Text File  |  1996-06-03  |  2.3 KB  |  75 lines

  1. /* Create multiple virtual IP addresses under OS/2 TCP/IP version 3 */
  2. /* This batch file was generated by CompuSource PowerWeb Server++ */
  3.  
  4. /* These are all the setup variables: */
  5.  
  6. comport    = '<!--#echo var=comport -->'    /* This is a dummy com port set up with SIO.SYS */
  7. multiple    =  <!--#echo var=multiple -->    /* This is how many IP addresses you want, up to 32 */
  8. realip    = '<!--#echo var=realip -->'    /* This is the IP through which you will route */
  9. baseip    = '<!--#echo var=baseip -->'    /* This is the class C ip base address */
  10. startip    =  <!--#echo var=startip -->    /* This is the first class C ip address to use */
  11. startppp    =  <!--#echo var=startppp -->    /* This is the first PPP interface to use, use 1 if PPP0 is used for dialup */
  12. ether        = '<!--#echo var=ether -->'    /* This is the MAC address of the ethernet card in your machine */
  13.  
  14. /* Have any of the IP's already been configured? If so, don't redefine. */
  15.  
  16. if multiple == 0 then do
  17.     say 'No IP Addresses to configure.'
  18.     return;
  19. end
  20.  
  21. '@ipdetect' baseip'.'startip
  22. if rc == 0 then do
  23.     say 'Multiple IP Addresses ALREADY configured.'
  24.     say 'If you are extending the existing set, you should first reboot.'
  25.     return;
  26. end
  27.  
  28. say 'Configuring' multiple 'Multiple IP Addresses ...'
  29. say 'This takes a while, sometimes 8-15 seconds per IP address that has to be configured, so please be patient.'
  30.  
  31. /* Load sleeping code */
  32.  
  33. call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
  34. call SysLoadFuncs
  35.  
  36. /* Now the work begins - start each PPP connection as a separate process */
  37.  
  38. do interface=0 to multiple-1
  39.     ppp = interface + startppp
  40.     '@start /n /min /i "ppp'ppp'" ppp' comport 'idle 1 silent'
  41.     rc=syssleep(1)
  42. end
  43.  
  44. /* Configure the routing IP if not already set up */
  45.  
  46. if realip == '127.0.0.1' then do
  47.     '@ipdetect' realip
  48.     if rc \= 0 then
  49.         '@ifconfig lo' realip
  50. end
  51.  
  52. /* Configure each interface and its routing in turn */
  53.  
  54. do interface=0 to multiple-1
  55.     ip = interface + startip
  56.     ppp = interface + startppp
  57.     call setup 'ppp'ppp baseip'.'ip
  58. end
  59.  
  60. return
  61.  
  62. /* Set up a PPP interface on a specified ip */
  63.  
  64. setup: parse arg int virtual
  65.  
  66. '@ifconfig' int virtual realip 'up'
  67. '@route delete' realip virtual
  68. '@route add' virtual realip '0'
  69.  
  70. if ether \= '' then
  71.     '@arp -s' virtual ether 'pub'
  72.  
  73. return
  74.  
  75.