
Originally Posted by
opnine
The issue is i dont have root or change the hosts file.
You can use alias as below
Code:
alias telnet_router 'telnet 192.168.1.1'
in your ~/bashrc file
Or you can use below function [ finally after some R&D , i created below function , just use it. may be some correction from Master
]
PHP Code:
function do_telnet () {
# just copy and past this fucntion ~/.bashrc file.
# then run "source ~/.bashrc" command to reload function or just logout and login
# then just run "do_telnet router" command to connect router or host
#
[ $# -eq 0 ] && echo "Please give hostname to connect destination" || {
. ~/.hosts # path of host file
# in this file keep entry as below
# router=192.168.1.1 # without hash sign(#)
# switch=192.168.1.100
eval telnet \$$@
}
}