LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-02-2006, 04:47 PM   #1
elrohir_telperi
LQ Newbie
 
Registered: May 2004
Location: Malaysia
Distribution: Mandrake 9.2, Mandrake 10.0, Ubuntu 5.10 Breezy Badger
Posts: 17

Rep: Reputation: 0
Scripting at start up


hello,

I would like to have a few pointers on scripting, be it shell scripting or etc, whichever appropriate.

I would like to do the following automatically when i log on:

telnet 192.168.1.1 (my DSL router)
admin (username)
admin (password)
cd /proc/sys/net/ipv4/netfilter
echo 2048 > ip_conntrack_max
echo 50 > ip_conntrack_generic_timeout
echo 5 > ip_conntrack_tcp_timeout_close
echo 120 > ip_conntrack_tcp_timeout_close_wait
echo 1200 > ip_conntrack_tcp_timeout_established
echo 120 > ip_conntrack_tcp_timeout_fin_wait
echo 60 > ip_conntrack_tcp_timeout_time_wait
echo 10 > ip_conntrack_udp_timeout

I have tried putting these into .bash_profile, but it will only proceed up to the first line, and stops when the router asks for username/password.

Any help is appreciated, thanks.


best regards
 
Old 03-02-2006, 05:44 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
It would be better to have the DSL box do that for you. I'm assuming that DSL supports sysctl, so you can modify /etc/sysctl.conf to do it for you:
Code:
net.ipv4.netfilter.ip_conntrack_max = 2048
net.ipv4.netfilter.ip_conntrack_generic_timeout = 50
etc.
Then just have sysctl read the new values with sysctl -p. Or, just add them to one of your startup scripts:
Code:
echo 2048 > /proc/sys/net/ipv4/netfilter/ip_conntrack_max
etc.
 
Old 03-03-2006, 06:40 AM   #3
elrohir_telperi
LQ Newbie
 
Registered: May 2004
Location: Malaysia
Distribution: Mandrake 9.2, Mandrake 10.0, Ubuntu 5.10 Breezy Badger
Posts: 17

Original Poster
Rep: Reputation: 0
Nope, my DSL router (it's a D-Link) does not support sysctl.

Maybe I should rephrase my question:

how to I use scripting to automate telnet login to my router?
 
Old 03-03-2006, 01:49 PM   #4
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
I see DSL here so often meaning Damn Small Linux that it never occurred to me Have you tried something like the following expect script from http://linuxgazette.net/issue50/tag/34.html?
Code:
#!/usr/bin/expect -f
# Sample telnet automation
## call with autotel host username password

set host [lindex $argv 0]
set rcfile [open ~/.autotel/$host  r ]
gets $rcfile user
gets $rcfile pass
spawn telnet  "$host"
expect "login:"
send "$user\r"
expect "word:"
send "$pass\r"
interact
You'd need to change the last line from interact to send your echo statements, but it looks like it can do what you need.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
when i try to start samba pdc's smb service nmbd failed to start . sandeepchau123 Linux - Newbie 2 10-20-2007 01:59 PM
Start up scripting and auto login for stand alone linux box kzazula Linux - General 7 01-13-2006 05:22 AM
fc2-gnome : Applications dont start / very slow to start nox104 Linux - Software 0 08-18-2004 08:53 PM
Can I gett KPPP to start when I start a browser on a network machine? duffboygrim Linux - Networking 0 03-25-2004 04:49 PM
shell scripting.. where to start? f0rmula Linux - Software 5 02-11-2004 09:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration