Telnet Script

Hello,
I wrote a script for doing telnet.However the requirement got changed and now I have to write a telnet script that will

  1. Do the telnet from all the virtual ips in a box(Ex: x.x.x.x is the box ip, and x.x.x.1,x.x.x.2 etc are virtual ips associated with that box.)
  2. The port range has come up
    telnet x.x.x.x y.y.y.y 1
    telnet x.x.x.x y.y.y.y 2 etc

This is my script.And Nmap is not an option as these are work computers.

portcheck.sh
#!/bin/bash

while read line
do
telnet $line < /dev/tty
done < /home/m/demo.txt

demo.txt
x.x.x.x 1
abc.xy.we.e 1

Any help is greatly appreciated.