PDA

Bekijk de volledige versie : pppoe ssh an iptables



johngicu
26-09-2007, 09:23
here is my problem,
I have a pppoe connection which i don't know why, once every 3-4 day wl700 reconnects?,... i don't know. The idea is that I get a new ip and the INPUT table is rewritten. Now the bad thing is that in the INPUT table I have this line:
iptables -I INPUT -p tcp --dport ssh -j ACCEPT witch opens's ssh from wan.
If I'm at work and want to ssh into my router, if this happens the only solution for me is to reboot the router so that rc.local might start again and open ssh from wan.
Is there any solution for my problem so I'm not forced to reset my router?

Opening ssh port from web doesen't work because it does something like iptables -A INPUT ...

kfurge
28-09-2007, 02:45
Execute a script similar to this periodically with cron:

#!/opt/bin/bash

lines=`/usr/sbin/iptables --list | /opt/bin/grep dpt:ssh | /opt/bin/wc -l`

if test $lines -eq "1"; then
iptables -I INPUT -p tcp --dport 22 -j ACCEPT
fi


- K.C.

johngicu
28-09-2007, 12:16
Execute a script similar to this periodically with cron:

#!/opt/bin/bash

lines=`/usr/sbin/iptables --list | /opt/bin/grep dpt:ssh | /opt/bin/wc -l`

if test $lines -eq "1"; then
iptables -I INPUT -p tcp --dport 22 -j ACCEPT
fi


- K.C.

Tks kfurge only a small problem:

-bash-3.2# wc -l
wc: error while loading shared libraries: wc: symbol vprintf, version GLIBC_2.0 not defined in file libc.so.6 with link time reference

How do i fix this?

johngicu
04-10-2007, 09:04
-bash-3.2# wc -l
wc: error while loading shared libraries: wc: symbol vprintf, version GLIBC_2.0 not defined in file libc.so.6 with link time reference

Does someone know how to fix this?
tks

kfurge
05-10-2007, 02:39
I'd recommend setting:

export LD_LIBRARY_PATH=/opt/lib:/shares/lib

in the script, like is done in rc.local.

- K.C.