sshd and dhcp bind to specific address

2009-08-05 Thread Stefan Miklosovic
hi,

my pc gets ip address from dhcp server,
but on my pc, there is running
sshd.

I want to make ssh to listen to only one
ip address, but if ip changes due to dhcp,
ssh server do not work properly.

I know, that dhcp is able to assign ip address
to client from some range e.g. 192.168.0.1-254
It is possible to do the same with ssh in case
that it is not possible to do it only with one ip?

I want a solution which would work every time,
not only some specific one.

thank you
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: sshd and dhcp bind to specific address

2009-08-05 Thread Erik Norgaard

Stefan Miklosovic wrote:

hi,

my pc gets ip address from dhcp server,
but on my pc, there is running
sshd.

I want to make ssh to listen to only one
ip address, but if ip changes due to dhcp,
ssh server do not work properly.

I know, that dhcp is able to assign ip address
to client from some range e.g. 192.168.0.1-254
It is possible to do the same with ssh in case
that it is not possible to do it only with one ip?

I want a solution which would work every time,
not only some specific one.


I don't know if this will solve your problem, you can set ListenAddress 
in sshd_config, by default this is 0.0.0.0 or any. You can have multiple 
ListenAddress entries.


I do not know if you can specify an ip-range, that would solve the 
problem I guess. It doesn't seem like you can configure sshd to bind to 
a particular interface, whichever address it may have, that would be the 
best solution.


BR, Erik
--
Erik Nørgaard
Ph: +34.666334818/+34.915211157  http://www.locolomo.org
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: sshd and dhcp bind to specific address

2009-08-05 Thread Glen Barber
On Wed, Aug 5, 2009 at 5:11 PM, Stefan
Miklosovicmiklosovic.free...@gmail.com wrote:
 hi,

 my pc gets ip address from dhcp server,
 but on my pc, there is running
 sshd.

 I want to make ssh to listen to only one
 ip address, but if ip changes due to dhcp,
 ssh server do not work properly.

 I know, that dhcp is able to assign ip address
 to client from some range e.g. 192.168.0.1-254
 It is possible to do the same with ssh in case
 that it is not possible to do it only with one ip?


Is this a local network, inside 192.168.0.0/24 ?  Are you able to
configure a static IP for this machine?

If not, I wrote a little script that runs every 15 minutes via cron(8)
which gets my IP address, performs a diff(1) against a static file
containing the current IP.  If the IP is different, it mails me the
new IP.  However, this assumes t hat outside access is the problem,
not internal access.


-- 
Glen Barber
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: sshd and dhcp bind to specific address

2009-08-05 Thread Mel Flynn
On Wednesday 05 August 2009 13:11:08 Stefan Miklosovic wrote:

 my pc gets ip address from dhcp server,
 but on my pc, there is running
 sshd.

 I want to make ssh to listen to only one
 ip address, but if ip changes due to dhcp,
 ssh server do not work properly.

 I know, that dhcp is able to assign ip address
 to client from some range e.g. 192.168.0.1-254
 It is possible to do the same with ssh in case
 that it is not possible to do it only with one ip?

 I want a solution which would work every time,
 not only some specific one.

Create a script called /etc/dhclient-exit-hooks. Check the dhclient-script 
manpage for some info on the available variables. From there you can work out 
if $new_ip_address is different from $old_ip_address, rewrite /etc/sshd_config 
with the new ip address and restart sshd.
-- 
Mel
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: sshd and dhcp bind to specific address

2009-08-05 Thread Robert Huff

Glen Barber wrote:


my pc gets ip address from dhcp server,
but on my pc, there is running
sshd.

I want to make ssh to listen to only one
ip address, but if ip changes due to dhcp,
ssh server do not work properly.

I know, that dhcp is able to assign ip address
to client from some range e.g. 192.168.0.1-254
It is possible to do the same with ssh in case
that it is not possible to do it only with one ip?



Is this a local network, inside 192.168.0.0/24 ?  Are you able to
configure a static IP for this machine?

If not, I wrote a little script that runs every 15 minutes via cron(8)
which gets my IP address, performs a diff(1) against a static file
containing the current IP.  If the IP is different, it mails me the
new IP.  However, this assumes that outside access is the problem,
not internal access.


	I have a set of scripts I run when I know I have been handed a 
different address; they're not pretty, but they change the IP for 
sshd.conf and various stuff in bind.



Robert Huff
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org